prep urls for proxying
This commit is contained in:
parent
74ad3d33c8
commit
db2ca5945c
26 changed files with 49 additions and 49 deletions
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -5,7 +5,7 @@ import Mapper from './Mapper'
|
|||
|
||||
const MapperCollection = Backbone.Collection.extend({
|
||||
model: Mapper,
|
||||
url: '/users'
|
||||
url: '/main/users'
|
||||
})
|
||||
|
||||
export default MapperCollection
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -5,7 +5,7 @@ import Mapping from './Mapping'
|
|||
|
||||
const MappingCollection = Backbone.Collection.extend({
|
||||
model: Mapping,
|
||||
url: '/mappings'
|
||||
url: '/main/mappings'
|
||||
})
|
||||
|
||||
export default MappingCollection
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -5,7 +5,7 @@ import Message from './Message'
|
|||
|
||||
const MessageCollection = Backbone.Collection.extend({
|
||||
model: Message,
|
||||
url: '/messages'
|
||||
url: '/main/messages'
|
||||
})
|
||||
|
||||
export default MessageCollection
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -5,7 +5,7 @@ import Synapse from './Synapse'
|
|||
|
||||
const SynapseCollection = Backbone.Collection.extend({
|
||||
model: Synapse,
|
||||
url: '/synapses'
|
||||
url: '/main/synapses'
|
||||
})
|
||||
|
||||
export default SynapseCollection
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -5,7 +5,7 @@ import Topic from './Topic'
|
|||
|
||||
const TopicCollection = Backbone.Collection.extend({
|
||||
model: Topic,
|
||||
url: '/topics'
|
||||
url: '/main/topics'
|
||||
})
|
||||
|
||||
export default TopicCollection
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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'))
|
||||
|
||||
|
|
|
@ -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() {}
|
||||
})
|
||||
|
|
|
@ -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() {}
|
||||
})
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue