This commit is contained in:
Devin Howard 2016-10-02 18:21:56 +08:00
parent bfd23c6d32
commit 0778179ba7
4 changed files with 13 additions and 20 deletions

View file

@ -4,7 +4,7 @@ import outdent from 'outdent'
const Metacode = Backbone.Model.extend({
initialize: function () {
var image = new Image()
var image = new window.Image()
image.crossOrigin = 'Anonymous'
image.src = this.get('icon')
this.set('image', image)

View file

@ -11,7 +11,6 @@ import Realtime from '../Realtime'
import SynapseCard from '../SynapseCard'
import Visualize from '../Visualize'
/*
* Dependencies:
* - Metamaps.Mappings
@ -46,8 +45,7 @@ const Synapse = Backbone.Model.extend({
if (permBefore === 'private' && model.get('permission') !== 'private') {
model.trigger('noLongerPrivate')
}
else if (permBefore !== 'private' && model.get('permission') === 'private') {
} else if (permBefore !== 'private' && model.get('permission') === 'private') {
model.trigger('nowPrivate')
}
}
@ -104,8 +102,8 @@ const Synapse = Backbone.Model.extend({
return Metamaps.Topics.get(this.get('topic2_id'))
},
getDirection: function () {
var t1 = this.getTopic1(),
t2 = this.getTopic2()
var t1 = this.getTopic1()
var t2 = this.getTopic2()
return t1 && t2 ? [
t1.get('node').id,
@ -130,7 +128,7 @@ const Synapse = Backbone.Model.extend({
nodeTo: this.get('topic2_id'),
data: {
$synapses: [],
$synapseIDs: [synapseID],
$synapseIDs: [synapseID]
}
}
@ -167,7 +165,7 @@ const Synapse = Backbone.Model.extend({
var edge = this.get('edge')
// update synapse card, if this synapse is the one open there
if (onPageWithSynapseCard && edge == SynapseCard.openSynapseCard) {
if (onPageWithSynapseCard && edge === SynapseCard.openSynapseCard) {
SynapseCard.showCard(edge)
}
},

View file

@ -46,8 +46,7 @@ const Topic = Backbone.Model.extend({
if (permBefore === 'private' && model.get('permission') !== 'private') {
model.trigger('noLongerPrivate')
}
else if (permBefore !== 'private' && model.get('permission') === 'private') {
} else if (permBefore !== 'private' && model.get('permission') === 'private') {
model.trigger('nowPrivate')
}
}
@ -87,8 +86,8 @@ const Topic = Backbone.Model.extend({
authorizeToEdit: function (mapper) {
if (mapper &&
(this.get('user_id') === mapper.get('id') ||
this.get('calculated_permission') === 'commons' ||
this.get('collaborator_ids').includes(mapper.get('id')))) {
this.get('calculated_permission') === 'commons' ||
this.get('collaborator_ids').includes(mapper.get('id')))) {
return true
} else {
return false
@ -148,7 +147,7 @@ const Topic = Backbone.Model.extend({
var onPageWithTopicCard = Active.Map || Active.Topic
var node = this.get('node')
// update topic card, if this topic is the one open there
if (onPageWithTopicCard && this == TopicCard.openTopicCard) {
if (onPageWithTopicCard && this === TopicCard.openTopicCard) {
TopicCard.showCard(node)
}
@ -162,7 +161,7 @@ const Topic = Backbone.Model.extend({
var onPageWithTopicCard = Active.Map || Active.Topic
var node = this.get('node')
// update topic card, if this topic is the one open there
if (onPageWithTopicCard && this == TopicCard.openTopicCard) {
if (onPageWithTopicCard && this === TopicCard.openTopicCard) {
TopicCard.showCard(node)
}
},

View file

@ -49,7 +49,7 @@ const DataModel = {
Mapping: Mapping,
MappingCollection: MappingCollection,
init: function() {
init: function () {
var self = DataModel
Metamaps.Metacodes = Metamaps.Metacodes ? new self.MetacodeCollection(Metamaps.Metacodes) : new self.MetacodeCollection()
@ -93,10 +93,6 @@ const DataModel = {
}
}
export {
Map, MapCollection, Mapper, MapperCollection, Mapping, MappingCollection,
Message, MessageCollection, Metacode, MetacodeCollection,
Synapse, SynapseCollection, Topic, TopicCollection
}
export { Map, MapCollection, Mapper, MapperCollection, Mapping, MappingCollection, Message, MessageCollection, Metacode, MetacodeCollection, Synapse, SynapseCollection, Topic, TopicCollection }
export default DataModel