diff --git a/src/Metamaps/Cable.js b/src/Metamaps/Cable.js index bd181c0c..f35afb99 100644 --- a/src/Metamaps/Cable.js +++ b/src/Metamaps/Cable.js @@ -67,7 +67,7 @@ const Cable = { }) } $.ajax({ - url: '/synapses/' + event.synapse.id + '.json', + url: '/main/synapses/' + event.synapse.id + '.json', success: function(response) { DataModel.Synapses.add(response) synapse = DataModel.Synapses.get(response.id) @@ -77,7 +77,7 @@ const Cable = { } }) $.ajax({ - url: '/mappings/' + event.mapping_id + '.json', + url: '/main/mappings/' + event.mapping_id + '.json', success: function(response) { DataModel.Mappings.add(response) mapping = DataModel.Mappings.get(response.id) @@ -149,7 +149,7 @@ const Cable = { }) } $.ajax({ - url: '/topics/' + event.topic.id + '.json', + url: '/main/topics/' + event.topic.id + '.json', success: function(response) { DataModel.Topics.add(response) topic = DataModel.Topics.get(response.id) @@ -159,7 +159,7 @@ const Cable = { } }) $.ajax({ - url: '/mappings/' + event.mapping_id + '.json', + url: '/main/mappings/' + event.mapping_id + '.json', success: function(response) { DataModel.Mappings.add(response) mapping = DataModel.Mappings.get(response.id) diff --git a/src/Metamaps/Create.js b/src/Metamaps/Create.js index 454ab331..eded47e7 100644 --- a/src/Metamaps/Create.js +++ b/src/Metamaps/Create.js @@ -147,7 +147,7 @@ const Create = { $.ajax({ type: 'POST', dataType: 'json', - url: '/user/updatemetacodes', + url: '/main/user/updatemetacodes', data: mdata, success: function(data) { console.log('selected metacodes saved') @@ -206,7 +206,7 @@ const Create = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/topics/autocomplete_topic?term=%QUERY', + url: '/main/topics/autocomplete_topic?term=%QUERY', wildcard: '%QUERY' } }) @@ -296,7 +296,7 @@ const Create = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/search/synapses?term=%QUERY', + url: '/main/search/synapses?term=%QUERY', wildcard: '%QUERY' } }) @@ -304,7 +304,7 @@ const Create = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/search/synapses?topic1id=%TOPIC1&topic2id=%TOPIC2', + url: '/main/search/synapses?topic1id=%TOPIC1&topic2id=%TOPIC2', prepare: function(query, settings) { var self = Create.newSynapse if (Selected.Nodes.length < 2 && self.topic1id && self.topic2id) { diff --git a/src/Metamaps/DataModel/Map.js b/src/Metamaps/DataModel/Map.js index 1f618763..7af31306 100644 --- a/src/Metamaps/DataModel/Map.js +++ b/src/Metamaps/DataModel/Map.js @@ -9,7 +9,7 @@ import InfoBox from '../Map/InfoBox' import Mapper from '../Mapper' const Map = Backbone.Model.extend({ - urlRoot: '/maps', + urlRoot: '/main/maps', blacklist: ['created_at', 'updated_at', 'created_at_clean', 'updated_at_clean', 'user_name', 'contributor_count', 'topic_count', 'synapse_count', 'topics', 'synapses', 'mappings', 'mappers'], toJSON: function(options) { return _.omit(this.attributes, this.blacklist) diff --git a/src/Metamaps/DataModel/Mapper.js b/src/Metamaps/DataModel/Mapper.js index 735bda86..806f02a6 100644 --- a/src/Metamaps/DataModel/Mapper.js +++ b/src/Metamaps/DataModel/Mapper.js @@ -4,7 +4,7 @@ try { Backbone.$ = window.$ } catch (err) {} import outdent from 'outdent' const Mapper = Backbone.Model.extend({ - urlRoot: '/users', + urlRoot: '/main/users', blacklist: ['created_at', 'updated_at', 'follows'], toJSON: function(options) { return _.omit(this.attributes, this.blacklist) diff --git a/src/Metamaps/DataModel/MapperCollection.js b/src/Metamaps/DataModel/MapperCollection.js index 836ee48f..ce3fd73a 100644 --- a/src/Metamaps/DataModel/MapperCollection.js +++ b/src/Metamaps/DataModel/MapperCollection.js @@ -5,7 +5,7 @@ import Mapper from './Mapper' const MapperCollection = Backbone.Collection.extend({ model: Mapper, - url: '/users' + url: '/main/users' }) export default MapperCollection diff --git a/src/Metamaps/DataModel/Mapping.js b/src/Metamaps/DataModel/Mapping.js index 2cd2b0b8..c7da551e 100644 --- a/src/Metamaps/DataModel/Mapping.js +++ b/src/Metamaps/DataModel/Mapping.js @@ -8,7 +8,7 @@ import Synapse from '../Synapse' import Topic from '../Topic' const Mapping = Backbone.Model.extend({ - urlRoot: '/mappings', + urlRoot: '/main/mappings', blacklist: ['created_at', 'updated_at'], toJSON: function(options) { return _.omit(this.attributes, this.blacklist) diff --git a/src/Metamaps/DataModel/MappingCollection.js b/src/Metamaps/DataModel/MappingCollection.js index 9a69f56b..4cf9b51d 100644 --- a/src/Metamaps/DataModel/MappingCollection.js +++ b/src/Metamaps/DataModel/MappingCollection.js @@ -5,7 +5,7 @@ import Mapping from './Mapping' const MappingCollection = Backbone.Collection.extend({ model: Mapping, - url: '/mappings' + url: '/main/mappings' }) export default MappingCollection diff --git a/src/Metamaps/DataModel/Message.js b/src/Metamaps/DataModel/Message.js index 5def166f..e3ba8819 100644 --- a/src/Metamaps/DataModel/Message.js +++ b/src/Metamaps/DataModel/Message.js @@ -3,7 +3,7 @@ import Backbone from 'backbone' try { Backbone.$ = window.$ } catch (err) {} const Message = Backbone.Model.extend({ - urlRoot: '/messages', + urlRoot: '/main/messages', blacklist: ['created_at', 'updated_at'], toJSON: function(options) { return _.omit(this.attributes, this.blacklist) diff --git a/src/Metamaps/DataModel/MessageCollection.js b/src/Metamaps/DataModel/MessageCollection.js index 3ce440eb..cd5b83e5 100644 --- a/src/Metamaps/DataModel/MessageCollection.js +++ b/src/Metamaps/DataModel/MessageCollection.js @@ -5,7 +5,7 @@ import Message from './Message' const MessageCollection = Backbone.Collection.extend({ model: Message, - url: '/messages' + url: '/main/messages' }) export default MessageCollection diff --git a/src/Metamaps/DataModel/MetacodeCollection.js b/src/Metamaps/DataModel/MetacodeCollection.js index 80022780..3fc7d583 100644 --- a/src/Metamaps/DataModel/MetacodeCollection.js +++ b/src/Metamaps/DataModel/MetacodeCollection.js @@ -5,7 +5,7 @@ import Metacode from './Metacode' const MetacodeCollection = Backbone.Collection.extend({ model: Metacode, - url: '/metacodes', + url: '/main/metacodes', comparator: function(a, b) { a = a.get('name').toLowerCase() b = b.get('name').toLowerCase() diff --git a/src/Metamaps/DataModel/Synapse.js b/src/Metamaps/DataModel/Synapse.js index d090d1ba..8f799b46 100644 --- a/src/Metamaps/DataModel/Synapse.js +++ b/src/Metamaps/DataModel/Synapse.js @@ -11,7 +11,7 @@ import Visualize from '../Visualize' import DataModel from './index' const Synapse = Backbone.Model.extend({ - urlRoot: '/synapses', + urlRoot: '/main/synapses', blacklist: ['edge', 'created_at', 'updated_at'], toJSON: function(options) { return _.omit(this.attributes, this.blacklist) diff --git a/src/Metamaps/DataModel/SynapseCollection.js b/src/Metamaps/DataModel/SynapseCollection.js index 8d315353..88b84f5e 100644 --- a/src/Metamaps/DataModel/SynapseCollection.js +++ b/src/Metamaps/DataModel/SynapseCollection.js @@ -5,7 +5,7 @@ import Synapse from './Synapse' const SynapseCollection = Backbone.Collection.extend({ model: Synapse, - url: '/synapses' + url: '/main/synapses' }) export default SynapseCollection diff --git a/src/Metamaps/DataModel/Topic.js b/src/Metamaps/DataModel/Topic.js index 6ce59d6e..06f334ad 100644 --- a/src/Metamaps/DataModel/Topic.js +++ b/src/Metamaps/DataModel/Topic.js @@ -10,7 +10,7 @@ import Visualize from '../Visualize' import DataModel from './index' const Topic = Backbone.Model.extend({ - urlRoot: '/topics', + urlRoot: '/main/topics', blacklist: ['node', 'created_at', 'updated_at', 'user_name', 'user_image', 'map_count', 'synapse_count'], toJSON: function(options) { return _.omit(this.attributes, this.blacklist) diff --git a/src/Metamaps/DataModel/TopicCollection.js b/src/Metamaps/DataModel/TopicCollection.js index a1de51d6..3025b012 100644 --- a/src/Metamaps/DataModel/TopicCollection.js +++ b/src/Metamaps/DataModel/TopicCollection.js @@ -5,7 +5,7 @@ import Topic from './Topic' const TopicCollection = Backbone.Collection.extend({ model: Topic, - url: '/topics' + url: '/main/topics' }) export default TopicCollection diff --git a/src/Metamaps/GlobalUI/Notifications.js b/src/Metamaps/GlobalUI/Notifications.js index 29908695..6aeeb335 100644 --- a/src/Metamaps/GlobalUI/Notifications.js +++ b/src/Metamaps/GlobalUI/Notifications.js @@ -9,7 +9,7 @@ const Notifications = { }, fetch: render => { $.ajax({ - url: '/notifications.json', + url: '/main/notifications.json', success: function(data) { Notifications.notifications = data render() @@ -27,7 +27,7 @@ const Notifications = { markAsRead: (render, id) => { const n = Notifications.notifications.find(n => n.id === id) $.ajax({ - url: `/notifications/${id}/mark_read.json`, + url: `/main/notifications/${id}/mark_read.json`, method: 'PUT', success: function(r) { if (n) { @@ -44,7 +44,7 @@ const Notifications = { markAsUnread: (render, id) => { const n = Notifications.notifications.find(n => n.id === id) $.ajax({ - url: `/notifications/${id}/mark_unread.json`, + url: `/main/notifications/${id}/mark_unread.json`, method: 'PUT', success: function() { if (n) { diff --git a/src/Metamaps/GlobalUI/Search.js b/src/Metamaps/GlobalUI/Search.js index 7e28906c..f15eadb3 100644 --- a/src/Metamaps/GlobalUI/Search.js +++ b/src/Metamaps/GlobalUI/Search.js @@ -68,7 +68,7 @@ const Search = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/search/topics', + url: '/main/search/topics', prepare: function(query, settings) { settings.url += '?term=' + query if (Active.Mapper && self.limitTopicsToMe) { @@ -101,7 +101,7 @@ const Search = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/search/maps', + url: '/main/search/maps', prepare: function(query, settings) { settings.url += '?term=' + query if (Active.Mapper && self.limitMapsToMe) { @@ -135,7 +135,7 @@ const Search = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/search/mappers?term=%QUERY', + url: '/main/search/mappers?term=%QUERY', wildcard: '%QUERY' } }) diff --git a/src/Metamaps/Import.js b/src/Metamaps/Import.js index d4051ddb..d77a7921 100644 --- a/src/Metamaps/Import.js +++ b/src/Metamaps/Import.js @@ -370,7 +370,7 @@ const Import = { { success: function(topic) { if (topic.get('name') !== 'Link') return - $.get('/hacks/load_url_title', { + $.get('/main/hacks/load_url_title', { url }, function success(data, textStatus) { if (typeof data === 'string' && data.trim() === '') return diff --git a/src/Metamaps/Map/InfoBox.js b/src/Metamaps/Map/InfoBox.js index d3edc16d..4604928b 100644 --- a/src/Metamaps/Map/InfoBox.js +++ b/src/Metamaps/Map/InfoBox.js @@ -213,7 +213,7 @@ const InfoBox = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/search/mappers?term=%QUERY', + url: '/main/search/mappers?term=%QUERY', wildcard: '%QUERY' } }) @@ -237,7 +237,7 @@ const InfoBox = { var self = InfoBox DataModel.Collaborators.remove(DataModel.Collaborators.get(collaboratorId)) var mapperIds = DataModel.Collaborators.models.map(function(mapper) { return mapper.id }) - $.post('/maps/' + Active.Map.id + '/access', { access: mapperIds }) + $.post('/main/maps/' + Active.Map.id + '/access', { access: mapperIds }) self.updateNumbers() }, addCollaborator: function(newCollaboratorId) { @@ -251,13 +251,13 @@ const InfoBox = { function callback(mapper) { DataModel.Collaborators.add(mapper) var mapperIds = DataModel.Collaborators.models.map(function(mapper) { return mapper.id }) - $.post('/maps/' + Active.Map.id + '/access', { access: mapperIds }) + $.post('/main/maps/' + Active.Map.id + '/access', { access: mapperIds }) var name = DataModel.Collaborators.get(newCollaboratorId).get('name') GlobalUI.notifyUser(name + ' will be notified') self.updateNumbers() } - $.getJSON('/users/' + newCollaboratorId + '.json', callback) + $.getJSON('/main/users/' + newCollaboratorId + '.json', callback) }, handleResultClick: function(event, item) { var self = InfoBox diff --git a/src/Metamaps/Map/index.js b/src/Metamaps/Map/index.js index f337d1d0..06dcb4ec 100644 --- a/src/Metamaps/Map/index.js +++ b/src/Metamaps/Map/index.js @@ -63,7 +63,7 @@ const Map = { self.setAccessRequest() const mapId = Active.Map.id $.post({ - url: `/maps/${mapId}/access_request` + url: `/main/maps/${mapId}/access_request` }) GlobalUI.notifyUser('Map creator will be notified of your request') }, @@ -117,7 +117,7 @@ const Map = { else { Loading.show() $.ajax({ - url: '/maps/' + id + '/contains.json', + url: '/main/maps/' + id + '/contains.json', success: function(data) { Active.Map = new DataModelMap(data.map) DataModel.Mappers = new DataModel.MapperCollection(data.mappers) @@ -153,7 +153,7 @@ const Map = { var self = Map if (!Active.Map) return - $.post('/maps/' + Active.Map.id + '/star') + $.post('/main/maps/' + Active.Map.id + '/star') DataModel.Stars.push({ user_id: Active.Mapper.id, map_id: Active.Map.id }) DataModel.Maps.Starred.add(Active.Map) GlobalUI.notifyUser('Map is now starred') @@ -164,7 +164,7 @@ const Map = { var self = Map if (!Active.Map) return - $.post('/maps/' + Active.Map.id + '/unstar') + $.post('/main/maps/' + Active.Map.id + '/unstar') DataModel.Stars = DataModel.Stars.filter(function(s) { return s.user_id !== Active.Mapper.id }) DataModel.Maps.Starred.remove(Active.Map) self.mapIsStarred = false @@ -263,7 +263,7 @@ const Map = { $.ajax({ type: 'PATCH', dataType: 'json', - url: `/maps/${Active.Map.id}`, + url: `/main/maps/${Active.Map.id}`, data: formData, processData: false, contentType: false, diff --git a/src/Metamaps/Mapper.js b/src/Metamaps/Mapper.js index bf13950e..25b39da5 100644 --- a/src/Metamaps/Mapper.js +++ b/src/Metamaps/Mapper.js @@ -7,7 +7,7 @@ const Mapper = { // @param id = the id of the mapper to retrieve get: function(id, callback) { $.ajax({ - url: `/users/${id}.json`, + url: `/main/users/${id}.json`, success: data => { callback(new DataModel.Mapper(data)) } diff --git a/src/Metamaps/Realtime/sendable.js b/src/Metamaps/Realtime/sendable.js index cc464891..f68f45c6 100644 --- a/src/Metamaps/Realtime/sendable.js +++ b/src/Metamaps/Realtime/sendable.js @@ -101,7 +101,7 @@ export const acceptCall = self => userid => { invited: Active.Mapper.id, inviter: userid }) - $.post('/maps/' + Active.Map.id + '/events/conversation') + $.post('/main/maps/' + Active.Map.id + '/events/conversation') self.joinCall() GlobalUI.clearNotify() } diff --git a/src/Metamaps/Synapse.js b/src/Metamaps/Synapse.js index 3d6c5f9a..3361e322 100644 --- a/src/Metamaps/Synapse.js +++ b/src/Metamaps/Synapse.js @@ -18,7 +18,7 @@ const Synapse = { // if the desired topic is not yet in the local topic repository, fetch it if (DataModel.Synapses.get(id) === undefined) { $.ajax({ - url: '/synapses/' + id + '.json', + url: '/main/synapses/' + id + '.json', success: function(data) { DataModel.Synapses.add(data) callback(DataModel.Synapses.get(id)) diff --git a/src/Metamaps/SynapseCard.js b/src/Metamaps/SynapseCard.js index 5855441c..6d5c383d 100644 --- a/src/Metamaps/SynapseCard.js +++ b/src/Metamaps/SynapseCard.js @@ -85,7 +85,7 @@ const SynapseCard = { $('#edit_synapse_desc').attr('data-bip-attribute', 'desc') $('#edit_synapse_desc').attr('data-bip-type', 'textarea') $('#edit_synapse_desc').attr('data-bip-nil', dataNil) - $('#edit_synapse_desc').attr('data-bip-url', '/synapses/' + synapse.id) + $('#edit_synapse_desc').attr('data-bip-url', '/main/synapses/' + synapse.id) $('#edit_synapse_desc').attr('data-bip-value', synapse.get('desc')) $('#edit_synapse_desc').html(synapse.get('desc')) diff --git a/src/Metamaps/Topic.js b/src/Metamaps/Topic.js index 1b1abe88..0026876b 100644 --- a/src/Metamaps/Topic.js +++ b/src/Metamaps/Topic.js @@ -28,7 +28,7 @@ const Topic = { // if the desired topic is not yet in the local topic repository, fetch it if (DataModel.Topics.get(id) === undefined) { $.ajax({ - url: '/topics/' + id + '.json', + url: '/main/topics/' + id + '.json', success: function(data) { DataModel.Topics.add(data) callback(DataModel.Topics.get(id)) @@ -55,7 +55,7 @@ const Topic = { else { Loading.show() $.ajax({ - url: '/topics/' + id + '/network.json', + url: '/main/topics/' + id + '/network.json', success: function(data) { Active.Topic = new DataModel.Topic(data.topic) DataModel.Creators = new DataModel.MapperCollection(data.creators) @@ -90,7 +90,7 @@ const Topic = { onTopicFollow: topic => { const isFollowing = topic.isFollowedBy(Active.Mapper) $.post({ - url: `/topics/${topic.id}/${isFollowing ? 'un' : ''}follow` + url: `/main/topics/${topic.id}/${isFollowing ? 'un' : ''}follow` }) if (isFollowing) { GlobalUI.notifyUser('You are no longer following this topic') @@ -166,7 +166,7 @@ const Topic = { $.ajax({ type: 'GET', - url: '/topics/' + topic.id + '/relatives.json?' + paramsString, + url: '/main/topics/' + topic.id + '/relatives.json?' + paramsString, success: successCallback, error: function() {} }) diff --git a/src/Metamaps/Views/ContextMenu.js b/src/Metamaps/Views/ContextMenu.js index f1553706..185ce4b0 100644 --- a/src/Metamaps/Views/ContextMenu.js +++ b/src/Metamaps/Views/ContextMenu.js @@ -98,7 +98,7 @@ const ContextMenu = { $.ajax({ type: 'GET', - url: `/topics/${id}/relative_numbers.json?network=${topicsString}`, + url: `/main/topics/${id}/relative_numbers.json?network=${topicsString}`, success: successCallback, error: function() {} }) diff --git a/src/Metamaps/Views/ExploreMaps.js b/src/Metamaps/Views/ExploreMaps.js index ac546f71..9cfbf91a 100644 --- a/src/Metamaps/Views/ExploreMaps.js +++ b/src/Metamaps/Views/ExploreMaps.js @@ -109,7 +109,7 @@ const ExploreMaps = { // first load the mapper object and then call the render function $.ajax({ - url: '/users/' + self.collection.mapperId + '/details.json', + url: '/main/users/' + self.collection.mapperId + '/details.json', success: function(response) { self.mapper = response document.title = self.mapper.name + ' | Metamaps' @@ -122,7 +122,7 @@ const ExploreMaps = { }) }, onStar: function(map) { - $.post('/maps/' + map.id + '/star') + $.post('/main/maps/' + map.id + '/star') map.set('star_count', map.get('star_count') + 1) if (DataModel.Stars) DataModel.Stars.push({ user_id: Active.Mapper.id, map_id: map.id }) DataModel.Maps.Starred.add(map) @@ -131,14 +131,14 @@ const ExploreMaps = { }, onRequest: function(map) { $.post({ - url: `/maps/${map.id}/access_request` + url: `/main/maps/${map.id}/access_request` }) GlobalUI.notifyUser('You will be notified by email if request accepted') }, onMapFollow: function(map) { const isFollowing = map.isFollowedBy(Active.Mapper) $.post({ - url: `/maps/${map.id}/${isFollowing ? 'un' : ''}follow` + url: `/main/maps/${map.id}/${isFollowing ? 'un' : ''}follow` }) if (isFollowing) { GlobalUI.notifyUser('You are no longer following this map')