diff --git a/frontend/src/Metamaps/Filter.js b/frontend/src/Metamaps/Filter.js index f67c6ec8..59aa1bae 100644 --- a/frontend/src/Metamaps/Filter.js +++ b/frontend/src/Metamaps/Filter.js @@ -186,7 +186,7 @@ const Filter = { $('#filter_by_' + listToModify + ' li[data-id="' + identifier + '"]').fadeOut('fast', function () { $(this).remove() }) - index = self.visible[filtersToUse].indexOf(identifier) + const index = self.visible[filtersToUse].indexOf(identifier) self.visible[filtersToUse].splice(index, 1) }) diff --git a/frontend/src/Metamaps/Mapper.js b/frontend/src/Metamaps/Mapper.js index 3858101d..70cbd81a 100644 --- a/frontend/src/Metamaps/Mapper.js +++ b/frontend/src/Metamaps/Mapper.js @@ -1,17 +1,19 @@ +/* global $ */ + /* - * Metamaps.Backbone + * Dependencies: + * Metamaps.Backbone */ const Mapper = { // this function is to retrieve a mapper JSON object from the database // @param id = the id of the mapper to retrieve get: function (id, callback) { - return fetch(`/users/${id}.json`, { - }).then(response => { - if (!response.ok) throw response - return response.json() - }).then(payload => { - callback(new Metamaps.Backbone.Mapper(payload)) + $.ajax({ + url: `/users/${id}.json`, + success: data => { + callback(new Metamaps.Backbone.Mapper(data)) + } }) } } diff --git a/frontend/src/Metamaps/ReactComponents.js b/frontend/src/Metamaps/ReactComponents.js deleted file mode 100644 index a2495245..00000000 --- a/frontend/src/Metamaps/ReactComponents.js +++ /dev/null @@ -1,7 +0,0 @@ -import Maps from '../components/Maps' - -const ReactComponents = { - Maps -} - -export default ReactComponents diff --git a/frontend/src/Metamaps/Views/ExploreMaps.js b/frontend/src/Metamaps/Views/ExploreMaps.js index 155e8453..c9f9b78b 100644 --- a/frontend/src/Metamaps/Views/ExploreMaps.js +++ b/frontend/src/Metamaps/Views/ExploreMaps.js @@ -4,7 +4,7 @@ import React from 'react' import ReactDOM from 'react-dom' // TODO ensure this isn't a double import import Active from '../Active' -import ReactComponents from '../ReactComponents' +import Maps from '../../components/Maps' /* * - Metamaps.Loading @@ -42,7 +42,7 @@ const ExploreMaps = { loadMore: self.loadMore } ReactDOM.render( - React.createElement(ReactComponents.Maps, exploreObj), + React.createElement(Maps, exploreObj), document.getElementById('explore') ) diff --git a/frontend/src/Metamaps/index.js b/frontend/src/Metamaps/index.js index 5d15559c..e1aa8b34 100644 --- a/frontend/src/Metamaps/index.js +++ b/frontend/src/Metamaps/index.js @@ -30,7 +30,6 @@ import TopicCard from './TopicCard' import Util from './Util' import Views from './Views' import Visualize from './Visualize' -import ReactComponents from './ReactComponents' Metamaps.Account = Account Metamaps.Active = Active @@ -55,7 +54,6 @@ Metamaps.Mouse = Mouse Metamaps.Organize = Organize Metamaps.PasteInput = PasteInput Metamaps.Realtime = Realtime -Metamaps.ReactComponents = ReactComponents Metamaps.Router = Router Metamaps.Selected = Selected Metamaps.Settings = Settings diff --git a/frontend/src/components/Header.js b/frontend/src/components/Header.js index c8c67619..ee4184d5 100644 --- a/frontend/src/components/Header.js +++ b/frontend/src/components/Header.js @@ -1,9 +1,9 @@ import React, { Component, PropTypes } from 'react' -import { objectWithoutProperties } from '../utils' +import _ from 'lodash' const MapLink = props => { const { show, text, href, linkClass } = props - const otherProps = objectWithoutProperties(props, ['show', 'text', 'href', 'linkClass']) + const otherProps = _.omit(props, ['show', 'text', 'href', 'linkClass']) if (!show) { return null } diff --git a/frontend/src/index.js b/frontend/src/index.js index 176ac329..67f69141 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,8 +1,6 @@ -// create global references to some utility libraries -import ReactDOM from 'react-dom' +// create global references import _ from 'underscore' -window.ReactDOM = ReactDOM -window._ = _ - import Metamaps from './Metamaps' + +window._ = _ window.Metamaps = Metamaps diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js deleted file mode 100644 index 1743b9b5..00000000 --- a/frontend/src/utils/index.js +++ /dev/null @@ -1,9 +0,0 @@ -export const objectWithoutProperties = (obj, keys) => { - const target = {} - for (let i in obj) { - if (keys.indexOf(i) !== -1) continue - if (!Object.prototype.hasOwnProperty.call(obj, i)) continue - target[i] = obj[i] - } - return target -} diff --git a/package.json b/package.json index bb32377d..08c4f086 100644 --- a/package.json +++ b/package.json @@ -18,26 +18,24 @@ }, "homepage": "https://github.com/metamaps/metamaps#readme", "dependencies": { - "autolinker": "^0.17.1", - "babel-cli": "^6.11.4", - "babel-loader": "^6.2.4", - "babel-plugin-transform-class-properties": "^6.11.5", - "babel-preset-es2015": "^6.9.0", - "babel-preset-react": "^6.11.1", - "backbone": "^1.0.0", - "chai": "^3.5.0", - "jquery": "1.12.1", - "mocha": "^3.0.2", - "mocha-jsdom": "^1.1.0", + "autolinker": "0.17.1", + "babel-cli": "6.11.4", + "babel-loader": "6.2.4", + "babel-plugin-transform-class-properties": "6.11.5", + "babel-preset-es2015": "6.9.0", + "babel-preset-react": "6.11.1", + "backbone": "1.0.0", "node-uuid": "1.2.0", - "react": "^15.3.0", - "react-dom": "^15.3.0", - "requirejs": "^2.1.1", + "react": "15.3.0", + "react-dom": "15.3.0", + "requirejs": "2.1.1", "socket.io": "0.9.12", - "underscore": "^1.4.4", - "webpack": "^1.13.1" + "underscore": "1.4.4", + "webpack": "1.13.1" }, "devDependencies": { + "chai": "^3.5.0", + "mocha": "^3.0.2", "babel-eslint": "^6.1.2", "eslint": "^3.5.0", "eslint-config-standard": "^6.0.1",