fix a few more mappable/topic/synapse things in JS
This commit is contained in:
parent
3e8c971155
commit
ae16f8f08d
2 changed files with 7 additions and 5 deletions
|
@ -194,7 +194,8 @@ Metamaps.Backbone.init = function () {
|
|||
|
||||
return Metamaps.Mappings.findWhere({
|
||||
map_id: Metamaps.Active.Map.id,
|
||||
topic_id: this.isNew() ? this.cid : this.id
|
||||
mappable_type: "Topic",
|
||||
mappable_id: this.isNew() ? this.cid : this.id
|
||||
});
|
||||
},
|
||||
createNode: function () {
|
||||
|
@ -370,7 +371,8 @@ Metamaps.Backbone.init = function () {
|
|||
|
||||
return Metamaps.Mappings.findWhere({
|
||||
map_id: Metamaps.Active.Map.id,
|
||||
synapse_id: this.isNew() ? this.cid : this.id
|
||||
mappable_type: "Synapse",
|
||||
mappable_id: this.isNew() ? this.cid : this.id
|
||||
});
|
||||
},
|
||||
createEdge: function () {
|
||||
|
|
|
@ -189,12 +189,12 @@ class MainController < ApplicationController
|
|||
topic2id = params[:topic2id]
|
||||
|
||||
if term && !term.empty?
|
||||
@synapses = Synapse.select('DISTINCT "desc"').where('LOWER("desc") like ?', '%' + term.downcase + '%').order('"desc"')
|
||||
@synapses = Synapse.where('LOWER("desc") like ?', '%' + term.downcase + '%').order('"desc"')
|
||||
|
||||
# remove any duplicate synapse types that just differ by
|
||||
# leading or trailing whitespaces
|
||||
collectedDesc = []
|
||||
@synapses.to_a.delete_if {|s|
|
||||
@synapses.to_a.uniq(&:desc).delete_if {|s|
|
||||
desc = s.desc == nil || s.desc == "" ? "" : s.desc.strip
|
||||
if collectedDesc.index(desc) == nil
|
||||
collectedDesc.push(desc)
|
||||
|
|
Loading…
Reference in a new issue