diff --git a/frontend/src/Metamaps/Create.js b/frontend/src/Metamaps/Create.js index 088622e3..1327821f 100644 --- a/frontend/src/Metamaps/Create.js +++ b/frontend/src/Metamaps/Create.js @@ -11,7 +11,7 @@ import GlobalUI from './GlobalUI' * Metamaps.Create.js * * Dependencies: - * - Metamaps.Backbone + * - Metamaps.DataModel * - Metamaps.Metacodes * - Metamaps.Topics */ @@ -59,7 +59,7 @@ const Create = { } var codesToSwitchToIds - var metacodeModels = new Metamaps.Backbone.MetacodeCollection() + var metacodeModels = new Metamaps.DataModel.MetacodeCollection() Create.selectedMetacodeSetIndex = index Create.selectedMetacodeSet = 'metacodeset-' + set diff --git a/frontend/src/Metamaps/Backbone/index.js b/frontend/src/Metamaps/DataModel/index.js similarity index 97% rename from frontend/src/Metamaps/Backbone/index.js rename to frontend/src/Metamaps/DataModel/index.js index ff4c48b9..1aaac52f 100644 --- a/frontend/src/Metamaps/Backbone/index.js +++ b/frontend/src/Metamaps/DataModel/index.js @@ -17,7 +17,7 @@ import TopicCard from '../TopicCard' import Visualize from '../Visualize' /* - * Metamaps.Backbone.js.erb + * Metamaps.DataModel.js * * Dependencies: * - Metamaps.Collaborators @@ -30,9 +30,9 @@ import Visualize from '../Visualize' * - Metamaps.Topics */ -const _Backbone = {} +const DataModel = {} -_Backbone.Map = Backbone.Model.extend({ +DataModel.Map = Backbone.Model.extend({ urlRoot: '/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) { @@ -106,8 +106,8 @@ _Backbone.Map = Backbone.Model.extend({ } } }) -_Backbone.MapsCollection = Backbone.Collection.extend({ - model: _Backbone.Map, +DataModel.MapsCollection = Backbone.Collection.extend({ + model: DataModel.Map, initialize: function (models, options) { this.id = options.id this.sortBy = options.sortBy @@ -174,7 +174,7 @@ _Backbone.MapsCollection = Backbone.Collection.extend({ } }) -_Backbone.Message = Backbone.Model.extend({ +DataModel.Message = Backbone.Model.extend({ urlRoot: '/messages', blacklist: ['created_at', 'updated_at'], toJSON: function (options) { @@ -190,12 +190,12 @@ _Backbone.Message = Backbone.Model.extend({ */ } }) -_Backbone.MessageCollection = Backbone.Collection.extend({ - model: _Backbone.Message, +DataModel.MessageCollection = Backbone.Collection.extend({ + model: DataModel.Message, url: '/messages' }) -_Backbone.Mapper = Backbone.Model.extend({ +DataModel.Mapper = Backbone.Model.extend({ urlRoot: '/users', blacklist: ['created_at', 'updated_at'], toJSON: function (options) { @@ -211,13 +211,13 @@ _Backbone.Mapper = Backbone.Model.extend({ } }) -_Backbone.MapperCollection = Backbone.Collection.extend({ - model: _Backbone.Mapper, +DataModel.MapperCollection = Backbone.Collection.extend({ + model: DataModel.Mapper, url: '/users' }) -_Backbone.init = function () { - var self = _Backbone +DataModel.init = function () { + var self = DataModel self.Metacode = Backbone.Model.extend({ initialize: function () { @@ -658,6 +658,6 @@ _Backbone.init = function () { } } self.attachCollectionEvents() -}; // end _Backbone.init +}; // end DataModel.init -export default _Backbone +export default DataModel diff --git a/frontend/src/Metamaps/GlobalUI/CreateMap.js b/frontend/src/Metamaps/GlobalUI/CreateMap.js index a24c73c8..d53b4106 100644 --- a/frontend/src/Metamaps/GlobalUI/CreateMap.js +++ b/frontend/src/Metamaps/GlobalUI/CreateMap.js @@ -4,7 +4,7 @@ import Active from '../Active' import GlobalUI from './index' /* - * Metamaps.Backbone + * Metamaps.DataModel * Metamaps.Maps */ @@ -17,7 +17,7 @@ const CreateMap = { init: function () { var self = CreateMap - self.newMap = new Metamaps.Backbone.Map({ permission: 'commons' }) + self.newMap = new Metamaps.DataModel.Map({ permission: 'commons' }) self.bindFormEvents() @@ -128,7 +128,7 @@ const CreateMap = { } self.bindFormEvents() - self.newMap = new Metamaps.Backbone.Map({ permission: 'commons' }) + self.newMap = new Metamaps.DataModel.Map({ permission: 'commons' }) return false } diff --git a/frontend/src/Metamaps/GlobalUI/index.js b/frontend/src/Metamaps/GlobalUI/index.js index 4f1feb18..580aa831 100644 --- a/frontend/src/Metamaps/GlobalUI/index.js +++ b/frontend/src/Metamaps/GlobalUI/index.js @@ -11,7 +11,7 @@ import Account from './Account' import ImportDialog from './ImportDialog' /* - * Metamaps.Backbone + * Metamaps.DataModel * Metamaps.Maps */ @@ -38,7 +38,7 @@ const GlobalUI = { $('#lightbox_screen, #lightbox_close').click(self.closeLightbox) // initialize global backbone models and collections - if (Active.Mapper) Active.Mapper = new Metamaps.Backbone.Mapper(Active.Mapper) + if (Active.Mapper) Active.Mapper = new Metamaps.DataModel.Mapper(Active.Mapper) var myCollection = Metamaps.Maps.Mine ? Metamaps.Maps.Mine : [] var sharedCollection = Metamaps.Maps.Shared ? Metamaps.Maps.Shared : [] @@ -51,13 +51,13 @@ const GlobalUI = { } var featuredCollection = Metamaps.Maps.Featured ? Metamaps.Maps.Featured : [] var activeCollection = Metamaps.Maps.Active ? Metamaps.Maps.Active : [] - Metamaps.Maps.Mine = new Metamaps.Backbone.MapsCollection(myCollection, { id: 'mine', sortBy: 'updated_at' }) - Metamaps.Maps.Shared = new Metamaps.Backbone.MapsCollection(sharedCollection, { id: 'shared', sortBy: 'updated_at' }) - Metamaps.Maps.Starred = new Metamaps.Backbone.MapsCollection(starredCollection, { id: 'starred', sortBy: 'updated_at' }) + Metamaps.Maps.Mine = new Metamaps.DataModel.MapsCollection(myCollection, { id: 'mine', sortBy: 'updated_at' }) + Metamaps.Maps.Shared = new Metamaps.DataModel.MapsCollection(sharedCollection, { id: 'shared', sortBy: 'updated_at' }) + Metamaps.Maps.Starred = new Metamaps.DataModel.MapsCollection(starredCollection, { id: 'starred', sortBy: 'updated_at' }) // 'Mapper' refers to another mapper - Metamaps.Maps.Mapper = new Metamaps.Backbone.MapsCollection(mapperCollection, mapperOptionsObj) - Metamaps.Maps.Featured = new Metamaps.Backbone.MapsCollection(featuredCollection, { id: 'featured', sortBy: 'updated_at' }) - Metamaps.Maps.Active = new Metamaps.Backbone.MapsCollection(activeCollection, { id: 'active', sortBy: 'updated_at' }) + Metamaps.Maps.Mapper = new Metamaps.DataModel.MapsCollection(mapperCollection, mapperOptionsObj) + Metamaps.Maps.Featured = new Metamaps.DataModel.MapsCollection(featuredCollection, { id: 'featured', sortBy: 'updated_at' }) + Metamaps.Maps.Active = new Metamaps.DataModel.MapsCollection(activeCollection, { id: 'active', sortBy: 'updated_at' }) }, showDiv: function (selector) { $(selector).show() diff --git a/frontend/src/Metamaps/Import.js b/frontend/src/Metamaps/Import.js index 6fd43bfe..b829c0b1 100644 --- a/frontend/src/Metamaps/Import.js +++ b/frontend/src/Metamaps/Import.js @@ -14,7 +14,7 @@ import Topic from './Topic' * Metamaps.Import.js.erb * * Dependencies: - * - Metamaps.Backbone + * - Metamaps.DataModel * - Metamaps.Mappings * - Metamaps.Metacodes * - Metamaps.Synapses @@ -299,7 +299,7 @@ const Import = { var topic_permission = permission || Active.Map.get('permission') var defer_to_map_id = permission === topic_permission ? Active.Map.get('id') : null - var topic = new Metamaps.Backbone.Topic({ + var topic = new Metamaps.DataModel.Topic({ name: name, metacode_id: metacode.id, permission: topic_permission, @@ -314,7 +314,7 @@ const Import = { self.cidMappings[import_id] = topic.cid } - var mapping = new Metamaps.Backbone.Mapping({ + var mapping = new Metamaps.DataModel.Mapping({ xloc: xloc, yloc: yloc, mappable_id: topic.cid, @@ -340,7 +340,7 @@ const Import = { return } // if - var synapse = new Metamaps.Backbone.Synapse({ + var synapse = new Metamaps.DataModel.Synapse({ desc: desc || '', category: category || 'from-to', permission: permission, @@ -349,7 +349,7 @@ const Import = { }) Metamaps.Synapses.add(synapse) - var mapping = new Metamaps.Backbone.Mapping({ + var mapping = new Metamaps.DataModel.Mapping({ mappable_type: 'Synapse', mappable_id: synapse.cid }) diff --git a/frontend/src/Metamaps/Map/index.js b/frontend/src/Metamaps/Map/index.js index 09790b89..bcf4397b 100644 --- a/frontend/src/Metamaps/Map/index.js +++ b/frontend/src/Metamaps/Map/index.js @@ -22,7 +22,7 @@ import InfoBox from './InfoBox' * Metamaps.Map.js.erb * * Dependencies: - * - Metamaps.Backbone + * - Metamaps.DataModel * - Metamaps.Erb * - Metamaps.Loading * - Metamaps.Mappers @@ -82,17 +82,16 @@ const Map = { $('.viewOnly').removeClass('sendRequest sentRequest requestDenied').addClass(className) }, launch: function (id) { - var bb = Metamaps.Backbone var start = function (data) { - Active.Map = new bb.Map(data.map) - Metamaps.Mappers = new bb.MapperCollection(data.mappers) - Metamaps.Collaborators = new bb.MapperCollection(data.collaborators) - Metamaps.Topics = new bb.TopicCollection(data.topics) - Metamaps.Synapses = new bb.SynapseCollection(data.synapses) - Metamaps.Mappings = new bb.MappingCollection(data.mappings) + Active.Map = new Metamaps.DataModel.Map(data.map) + Metamaps.Mappers = new Metamaps.DataModel.MapperCollection(data.mappers) + Metamaps.Collaborators = new Metamaps.DataModel.MapperCollection(data.collaborators) + Metamaps.Topics = new Metamaps.DataModel.TopicCollection(data.topics) + Metamaps.Synapses = new Metamaps.DataModel.SynapseCollection(data.synapses) + Metamaps.Mappings = new Metamaps.DataModel.MappingCollection(data.mappings) Metamaps.Messages = data.messages Metamaps.Stars = data.stars - Metamaps.Backbone.attachCollectionEvents() + Metamaps.DataModel.attachCollectionEvents() var map = Active.Map var mapper = Active.Mapper diff --git a/frontend/src/Metamaps/Mapper.js b/frontend/src/Metamaps/Mapper.js index 70cbd81a..4beff8bf 100644 --- a/frontend/src/Metamaps/Mapper.js +++ b/frontend/src/Metamaps/Mapper.js @@ -2,7 +2,7 @@ /* * Dependencies: - * Metamaps.Backbone + * Metamaps.DataModel */ const Mapper = { @@ -12,7 +12,7 @@ const Mapper = { $.ajax({ url: `/users/${id}.json`, success: data => { - callback(new Metamaps.Backbone.Mapper(data)) + callback(new Metamaps.DataModel.Mapper(data)) } }) } diff --git a/frontend/src/Metamaps/Realtime/index.js b/frontend/src/Metamaps/Realtime/index.js index 49fd357d..1e91975a 100644 --- a/frontend/src/Metamaps/Realtime/index.js +++ b/frontend/src/Metamaps/Realtime/index.js @@ -1,23 +1,11 @@ -/* global Metamaps, $ */ - -/* - * Metamaps.Realtime.js - * - * Dependencies: - * - Metamaps.Backbone - * - Metamaps.Erb - * - Metamaps.Mappers - * - Metamaps.Mappings - * - Metamaps.Messages - * - Metamaps.Synapses - * - Metamaps.Topics - */ +/* global $ */ import _ from 'lodash' import SimpleWebRTC from 'simplewebrtc' import SocketIoConnection from 'simplewebrtc/socketioconnection' import Active from '../Active' +import DataModel from '../DataModel' import GlobalUI from '../GlobalUI' import JIT from '../JIT' import Synapse from '../Synapse' @@ -121,12 +109,14 @@ let Realtime = { broadcastingStatus: false, inConversation: false, localVideo: null, - init: function () { + 'junto_spinner_darkgrey.gif': '', + init: function (serverData) { var self = Realtime self.addJuntoListeners() - self.socket = new SocketIoConnection({ url: Metamaps.Erb['REALTIME_SERVER']}) + self.socket = new SocketIoConnection({ url: serverData['REALTIME_SERVER']}) + self['junto_spinner_darkgrey.gif'] = serverData['junto_spinner_darkgrey.gif'] self.socket.on('connect', function () { console.log('connected') @@ -230,7 +220,7 @@ let Realtime = { self.setupSocket() self.setupLocalSendables() } - self.room.addMessages(new Metamaps.Backbone.MessageCollection(Metamaps.Messages), true) + self.room.addMessages(new DataModel.MessageCollection(DataModel.Messages), true) } }, endActiveMap: function () { diff --git a/frontend/src/Metamaps/Realtime/receivable.js b/frontend/src/Metamaps/Realtime/receivable.js index 3e9b5d16..c1432333 100644 --- a/frontend/src/Metamaps/Realtime/receivable.js +++ b/frontend/src/Metamaps/Realtime/receivable.js @@ -7,6 +7,7 @@ everthing in this file happens as a result of websocket events import { JUNTO_UPDATED } from './events' import Active from '../Active' +import DataModel from '../DataModel' import GlobalUI from '../GlobalUI' import Control from '../Control' import Map from '../Map' @@ -22,7 +23,7 @@ export const juntoUpdated = self => state => { } export const synapseRemoved = self => data => { - var synapse = Metamaps.Synapses.get(data.mappableid) + var synapse = DataModel.Synapses.get(data.mappableid) if (synapse) { var edge = synapse.get('edge') var mapping = synapse.getMapping() @@ -36,8 +37,8 @@ export const synapseRemoved = self => data => { if (edge.getData('displayIndex')) { delete edge.data.$displayIndex } - Metamaps.Synapses.remove(synapse) - Metamaps.Mappings.remove(mapping) + DataModel.Synapses.remove(synapse) + DataModel.Mappings.remove(mapping) } } @@ -63,18 +64,18 @@ export const synapseCreated = self => data => { } } - mapper = Metamaps.Mappers.get(data.mapperid) + mapper = DataModel.Mappers.get(data.mapperid) if (mapper === undefined) { Mapper.get(data.mapperid, function(m) { - Metamaps.Mappers.add(m) + DataModel.Mappers.add(m) mapper = m }) } $.ajax({ url: '/synapses/' + data.mappableid + '.json', success: function (response) { - Metamaps.Synapses.add(response) - synapse = Metamaps.Synapses.get(response.id) + DataModel.Synapses.add(response) + synapse = DataModel.Synapses.get(response.id) }, error: function () { cancel = true @@ -83,8 +84,8 @@ export const synapseCreated = self => data => { $.ajax({ url: '/mappings/' + data.mappingid + '.json', success: function (response) { - Metamaps.Mappings.add(response) - mapping = Metamaps.Mappings.get(response.id) + DataModel.Mappings.add(response) + mapping = DataModel.Mappings.get(response.id) }, error: function () { cancel = true @@ -94,13 +95,13 @@ export const synapseCreated = self => data => { } export const topicRemoved = self => data => { - var topic = Metamaps.Topics.get(data.mappableid) + var topic = DataModel.Topics.get(data.mappableid) if (topic) { var node = topic.get('node') var mapping = topic.getMapping() Control.hideNode(node.id) - Metamaps.Topics.remove(topic) - Metamaps.Mappings.remove(mapping) + DataModel.Topics.remove(topic) + DataModel.Mappings.remove(mapping) } } @@ -120,18 +121,18 @@ export const topicCreated = self => data => { } } - mapper = Metamaps.Mappers.get(data.mapperid) + mapper = DataModel.Mappers.get(data.mapperid) if (mapper === undefined) { Mapper.get(data.mapperid, function(m) { - Metamaps.Mappers.add(m) + DataModel.Mappers.add(m) mapper = m }) } $.ajax({ url: '/topics/' + data.mappableid + '.json', success: function (response) { - Metamaps.Topics.add(response) - topic = Metamaps.Topics.get(response.id) + DataModel.Topics.add(response) + topic = DataModel.Topics.get(response.id) }, error: function () { cancel = true @@ -140,8 +141,8 @@ export const topicCreated = self => data => { $.ajax({ url: '/mappings/' + data.mappingid + '.json', success: function (response) { - Metamaps.Mappings.add(response) - mapping = Metamaps.Mappings.get(response.id) + DataModel.Mappings.add(response) + mapping = DataModel.Mappings.get(response.id) }, error: function () { cancel = true @@ -152,7 +153,7 @@ export const topicCreated = self => data => { } export const messageCreated = self => data => { - self.room.addMessages(new Metamaps.Backbone.MessageCollection(data)) + self.room.addMessages(new DataModel.MessageCollection(data)) } export const mapUpdated = self => data => { @@ -182,7 +183,7 @@ export const mapUpdated = self => data => { } export const topicUpdated = self => data => { - var topic = Metamaps.Topics.get(data.topicId) + var topic = DataModel.Topics.get(data.topicId) if (topic) { var node = topic.get('node') topic.fetch({ @@ -195,7 +196,7 @@ export const topicUpdated = self => data => { } export const synapseUpdated = self => data => { - var synapse = Metamaps.Synapses.get(data.synapseId) + var synapse = DataModel.Synapses.get(data.synapseId) if (synapse) { // edge reset necessary because fetch causes model reset var edge = synapse.get('edge') @@ -214,7 +215,7 @@ export const topicDragged = self => positions => { if (Active.Map) { for (var key in positions) { - topic = Metamaps.Topics.get(key) + topic = DataModel.Topics.get(key) if (topic) node = topic.get('node') if (node) node.pos.setc(positions[key].x, positions[key].y) } // for @@ -332,7 +333,7 @@ export const invitedToCall = self => inviter => { self.soundId = self.room.chat.sound.play('sessioninvite') var username = self.mappersOnMap[inviter].name - var notifyText = '' + var notifyText = '' notifyText += username + ' is inviting you to a conversation. Join live?' notifyText += ' ' notifyText += ' ' diff --git a/frontend/src/Metamaps/Synapse.js b/frontend/src/Metamaps/Synapse.js index 8253d6ba..4b80c05a 100644 --- a/frontend/src/Metamaps/Synapse.js +++ b/frontend/src/Metamaps/Synapse.js @@ -13,7 +13,7 @@ import Visualize from './Visualize' * Metamaps.Synapse.js.erb * * Dependencies: - * - Metamaps.Backbone + * - Metamaps.DataModel * - Metamaps.Mappings * - Metamaps.Synapses * - Metamaps.Topics @@ -112,14 +112,14 @@ const Synapse = { for (var i = 0; i < synapsesToCreate.length; i++) { node1 = synapsesToCreate[i] topic1 = node1.getData('topic') - synapse = new Metamaps.Backbone.Synapse({ + synapse = new Metamaps.DataModel.Synapse({ desc: Create.newSynapse.description, topic1_id: topic1.isNew() ? topic1.cid : topic1.id, topic2_id: topic2.isNew() ? topic2.cid : topic2.id, }) Metamaps.Synapses.add(synapse) - mapping = new Metamaps.Backbone.Mapping({ + mapping = new Metamaps.DataModel.Mapping({ mappable_type: 'Synapse', mappable_id: synapse.cid, }) @@ -139,7 +139,7 @@ const Synapse = { node2 self.get(id, synapse => { - var mapping = new Metamaps.Backbone.Mapping({ + var mapping = new Metamaps.DataModel.Mapping({ mappable_type: 'Synapse', mappable_id: synapse.id, }) diff --git a/frontend/src/Metamaps/Topic.js b/frontend/src/Metamaps/Topic.js index 91c720aa..38596b9e 100644 --- a/frontend/src/Metamaps/Topic.js +++ b/frontend/src/Metamaps/Topic.js @@ -22,7 +22,7 @@ import Visualize from './Visualize' * Metamaps.Topic.js.erb * * Dependencies: - * - Metamaps.Backbone + * - Metamaps.DataModel * - Metamaps.Creators * - Metamaps.Mappings * - Metamaps.Synapses @@ -45,13 +45,13 @@ const Topic = { } else callback(Metamaps.Topics.get(id)) }, launch: function (id) { - var bb = Metamaps.Backbone + var bb = Metamaps.DataModel var start = function (data) { Active.Topic = new bb.Topic(data.topic) Metamaps.Creators = new bb.MapperCollection(data.creators) Metamaps.Topics = new bb.TopicCollection([data.topic].concat(data.relatives)) Metamaps.Synapses = new bb.SynapseCollection(data.synapses) - Metamaps.Backbone.attachCollectionEvents() + Metamaps.DataModel.attachCollectionEvents() document.title = Active.Topic.get('name') + ' | Metamaps' @@ -128,9 +128,9 @@ const Topic = { if (data.topics.length > 0) Metamaps.Topics.add(data.topics) if (data.synapses.length > 0) Metamaps.Synapses.add(data.synapses) - var topicColl = new Metamaps.Backbone.TopicCollection(data.topics) + var topicColl = new Metamaps.DataModel.TopicCollection(data.topics) topicColl.add(topic) - var synapseColl = new Metamaps.Backbone.SynapseCollection(data.synapses) + var synapseColl = new Metamaps.DataModel.SynapseCollection(data.synapses) var graph = JIT.convertModelsToJIT(topicColl, synapseColl)[0] Visualize.mGraph.op.sum(graph, { @@ -311,7 +311,7 @@ const Topic = { var metacode = Metamaps.Metacodes.get(Create.newTopic.metacode) - var topic = new Metamaps.Backbone.Topic({ + var topic = new Metamaps.DataModel.Topic({ name: Create.newTopic.name, metacode_id: metacode.id, defer_to_map_id: Active.Map.id @@ -321,7 +321,7 @@ const Topic = { if (Create.newTopic.pinned) { var nextCoords = AutoLayout.getNextCoord({ mappings: Metamaps.Mappings }) } - var mapping = new Metamaps.Backbone.Mapping({ + var mapping = new Metamaps.DataModel.Mapping({ xloc: nextCoords ? nextCoords.x : Create.newTopic.x, yloc: nextCoords ? nextCoords.y : Create.newTopic.y, mappable_id: topic.cid, @@ -377,7 +377,7 @@ const Topic = { }) Metamaps.Topics.add(topic) - var mapping = new Metamaps.Backbone.Mapping({ + var mapping = new Metamaps.DataModel.Mapping({ xloc: Metamaps.Create.newTopic.x, yloc: Metamaps.Create.newTopic.y, mappable_id: topic.cid, @@ -400,7 +400,7 @@ const Topic = { self.get(id, (topic) => { var nextCoords = AutoLayout.getNextCoord({ mappings: Metamaps.Mappings }) - var mapping = new Metamaps.Backbone.Mapping({ + var mapping = new Metamaps.DataModel.Mapping({ xloc: nextCoords.x, yloc: nextCoords.y, mappable_type: 'Topic', diff --git a/frontend/src/Metamaps/Views/Room.js b/frontend/src/Metamaps/Views/Room.js index 7075e017..9bbd5e31 100644 --- a/frontend/src/Metamaps/Views/Room.js +++ b/frontend/src/Metamaps/Views/Room.js @@ -14,7 +14,7 @@ import VideoView from './VideoView' /* * Dependencies: - * Metamaps.Backbone + * Metamaps.DataModel */ const Room = function(opts) { @@ -170,14 +170,14 @@ Room.prototype.init = function () { var self = this //this.roomRef.child('messages').push(data) if (self.chat.alertSound) self.chat.sound.play('sendchat') - var m = new Metamaps.Backbone.Message({ + var m = new Metamaps.DataModel.Message({ message: data.message, resource_id: Active.Map.id, resource_type: "Map" }) m.save(null, { success: function (model, response) { - self.addMessages(new Metamaps.Backbone.MessageCollection(model), false, true) + self.addMessages(new Metamaps.DataModel.MessageCollection(model), false, true) $(document).trigger(Room.events.newMessage, [model]) }, error: function (model, response) { diff --git a/frontend/src/Metamaps/index.js b/frontend/src/Metamaps/index.js index bf2e2d60..5dc99aa5 100644 --- a/frontend/src/Metamaps/index.js +++ b/frontend/src/Metamaps/index.js @@ -4,7 +4,7 @@ import Account from './Account' import Active from './Active' import Admin from './Admin' import AutoLayout from './AutoLayout' -import Backbone from './Backbone' +import DataModel from './DataModel' import Control from './Control' import Create from './Create' import Debug from './Debug' @@ -38,7 +38,7 @@ Metamaps.Account = Account Metamaps.Active = Active Metamaps.Admin = Admin Metamaps.AutoLayout = AutoLayout -Metamaps.Backbone = Backbone +Metamaps.DataModel = DataModel Metamaps.Control = Control Metamaps.Create = Create Metamaps.Debug = Debug