switched filter box to be by who added something to the map, not who created the topic or synapse
This commit is contained in:
parent
304c9f3b4b
commit
c989b321c1
2 changed files with 31 additions and 29 deletions
|
@ -2073,8 +2073,7 @@ Metamaps.Filter = {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
check('metacodes', 'Topics', 'metacode_id');
|
check('metacodes', 'Topics', 'metacode_id');
|
||||||
check('mappers', 'Topics', 'user_id');
|
check('mappers', 'Mappings', 'user_id');
|
||||||
check('mappers', 'Synapses', 'user_id');
|
|
||||||
check('synapses', 'Synapses', 'desc');
|
check('synapses', 'Synapses', 'desc');
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
|
@ -2115,26 +2114,19 @@ Metamaps.Filter = {
|
||||||
/*
|
/*
|
||||||
@param
|
@param
|
||||||
*/
|
*/
|
||||||
updateFilters: function (topicsSynapsesOrBoth, propertyToCheck, correlatedModel, filtersToUse, listToModify) {
|
updateFilters: function (collection, propertyToCheck, correlatedModel, filtersToUse, listToModify) {
|
||||||
var self = Metamaps.Filter;
|
var self = Metamaps.Filter;
|
||||||
|
|
||||||
var newList = [];
|
var newList = [];
|
||||||
var removed = [];
|
var removed = [];
|
||||||
var added = [];
|
var added = [];
|
||||||
|
|
||||||
var check = function (topicsOrSynapses) {
|
Metamaps[collection].each(function(model) {
|
||||||
Metamaps[topicsOrSynapses].each(function(model) {
|
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false;
|
||||||
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false;
|
if (prop && newList.indexOf(prop) === -1) {
|
||||||
if (prop && newList.indexOf(prop) === -1) {
|
newList.push(prop);
|
||||||
newList.push(prop);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
if (topicsSynapsesOrBoth === "both") {
|
|
||||||
check('Synapses');
|
|
||||||
check('Topics');
|
|
||||||
}
|
|
||||||
else check(topicsSynapsesOrBoth);
|
|
||||||
|
|
||||||
removed = _.difference(self.filters[filtersToUse], newList);
|
removed = _.difference(self.filters[filtersToUse], newList);
|
||||||
added = _.difference(newList, self.filters[filtersToUse]);
|
added = _.difference(newList, self.filters[filtersToUse]);
|
||||||
|
@ -2174,7 +2166,7 @@ Metamaps.Filter = {
|
||||||
},
|
},
|
||||||
checkMappers: function () {
|
checkMappers: function () {
|
||||||
var self = Metamaps.Filter;
|
var self = Metamaps.Filter;
|
||||||
self.updateFilters('both', 'user_id', 'Mappers', 'mappers', 'mapper');
|
self.updateFilters('Mappings', 'user_id', 'Mappers', 'mappers', 'mapper');
|
||||||
},
|
},
|
||||||
checkSynapses: function () {
|
checkSynapses: function () {
|
||||||
var self = Metamaps.Filter;
|
var self = Metamaps.Filter;
|
||||||
|
@ -2251,18 +2243,26 @@ Metamaps.Filter = {
|
||||||
var self = Metamaps.Filter;
|
var self = Metamaps.Filter;
|
||||||
var visible = self.visible;
|
var visible = self.visible;
|
||||||
|
|
||||||
var passesMetacode, passesMapper, passesSynapse;
|
var passesMetacode, passesMapper, passesSynapse;
|
||||||
|
var onMap;
|
||||||
|
|
||||||
|
if (Metamaps.Active.Map) {
|
||||||
|
onMap = true;
|
||||||
|
passesMapper = true;
|
||||||
|
}
|
||||||
|
|
||||||
Metamaps.Topics.each(function(topic) {
|
Metamaps.Topics.each(function(topic) {
|
||||||
var n = topic.get('node');
|
var n = topic.get('node');
|
||||||
var metacode_id = topic.get("metacode_id").toString();
|
var metacode_id = topic.get("metacode_id").toString();
|
||||||
var user_id = topic.get("user_id").toString();
|
|
||||||
|
|
||||||
if (visible.metacodes.indexOf(metacode_id) == -1) passesMetacode = false;
|
if (visible.metacodes.indexOf(metacode_id) == -1) passesMetacode = false;
|
||||||
else passesMetacode = true;
|
else passesMetacode = true;
|
||||||
|
|
||||||
if (visible.mappers.indexOf(user_id) == -1) passesMapper = false;
|
if (onMap) {
|
||||||
else passesMapper = true;
|
var user_id = topic.getMapping().get("user_id").toString();
|
||||||
|
if (visible.mappers.indexOf(user_id) == -1) passesMapper = false;
|
||||||
|
else passesMapper = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (passesMetacode && passesMapper) {
|
if (passesMetacode && passesMapper) {
|
||||||
n.setData('alpha', 1, 'end');
|
n.setData('alpha', 1, 'end');
|
||||||
|
@ -2279,8 +2279,11 @@ Metamaps.Filter = {
|
||||||
if (visible.synapses.indexOf(desc) == -1) passesSynapse = false;
|
if (visible.synapses.indexOf(desc) == -1) passesSynapse = false;
|
||||||
else passesSynapse = true;
|
else passesSynapse = true;
|
||||||
|
|
||||||
if (visible.mappers.indexOf(user_id) == -1) passesMapper = false;
|
if (onMap) {
|
||||||
else passesMapper = true;
|
var user_id = synapse.getMapping().get("user_id").toString();
|
||||||
|
if (visible.mappers.indexOf(user_id) == -1) passesMapper = false;
|
||||||
|
else passesMapper = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (passesSynapse && passesMapper) {
|
if (passesSynapse && passesMapper) {
|
||||||
e.setData('alpha', 1, 'end');
|
e.setData('alpha', 1, 'end');
|
||||||
|
|
|
@ -21,16 +21,15 @@
|
||||||
if @metacodes.index(topic.metacode) == nil
|
if @metacodes.index(topic.metacode) == nil
|
||||||
@metacodes.push(topic.metacode)
|
@metacodes.push(topic.metacode)
|
||||||
end
|
end
|
||||||
if @mappers.index(topic.user) == nil
|
|
||||||
@mappers.push(topic.user)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@map.synapses.each_with_index do |synapse, index|
|
@map.synapses.each_with_index do |synapse, index|
|
||||||
if @synapses.index{|s| s.desc == synapse.desc} == nil
|
if @synapses.index{|s| s.desc == synapse.desc} == nil
|
||||||
@synapses.push(synapse)
|
@synapses.push(synapse)
|
||||||
end
|
end
|
||||||
if @mappers.index(synapse.user) == nil
|
end
|
||||||
@mappers.push(synapse.user)
|
@map.mappings.each_with_index do |mapping, index|
|
||||||
|
if @mappers.index(mapping.user) == nil
|
||||||
|
@mappers.push(mapping.user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue