2014-08-02 17:49:51 +00:00
|
|
|
<%#
|
|
|
|
# @file
|
2014-08-04 16:20:16 +00:00
|
|
|
# this code generates the list of icons in the filter box in the upper right menu area
|
2014-08-02 17:49:51 +00:00
|
|
|
#%>
|
|
|
|
|
|
|
|
<%
|
|
|
|
@mappers = []
|
|
|
|
@synapses = []
|
|
|
|
@metacodes = []
|
|
|
|
@metacodelist = ''
|
|
|
|
@mapperlist = ''
|
|
|
|
@synapselist = ''
|
2014-08-04 16:20:16 +00:00
|
|
|
# There are essentially three functions happening here one to fill data to
|
|
|
|
#@mappers with all people who have mapped on the selected map, which
|
|
|
|
#actually gets checked twice once for topics or within @metacodes and once
|
|
|
|
#for synapses on the map. @synapses get filled with all synapses on the map
|
|
|
|
#and metacodes is filled with all the metacodes that are being used on the map.
|
|
|
|
|
2014-08-10 17:06:58 +00:00
|
|
|
if @map
|
2014-11-11 07:23:39 +00:00
|
|
|
@alltopics.each_with_index do |topic, index|
|
2014-08-10 17:06:58 +00:00
|
|
|
if @metacodes.index(topic.metacode) == nil
|
|
|
|
@metacodes.push(topic.metacode)
|
|
|
|
end
|
|
|
|
end
|
2014-11-11 07:23:39 +00:00
|
|
|
@allsynapses.each_with_index do |synapse, index|
|
2014-08-10 17:06:58 +00:00
|
|
|
if @synapses.index{|s| s.desc == synapse.desc} == nil
|
|
|
|
@synapses.push(synapse)
|
2014-08-12 17:22:29 +00:00
|
|
|
end
|
|
|
|
end
|
2014-11-11 07:23:39 +00:00
|
|
|
@allmappings.each_with_index do |mapping, index|
|
2014-08-12 17:22:29 +00:00
|
|
|
if @mappers.index(mapping.user) == nil
|
|
|
|
@mappers.push(mapping.user)
|
2014-08-10 17:06:58 +00:00
|
|
|
end
|
2014-08-04 16:20:16 +00:00
|
|
|
end
|
2014-11-11 07:23:39 +00:00
|
|
|
elsif @topic
|
|
|
|
@alltopics.each_with_index do |topic, index|
|
|
|
|
if @metacodes.index(topic.metacode) == nil
|
|
|
|
@metacodes.push(topic.metacode)
|
|
|
|
end
|
|
|
|
if @mappers.index(topic.user) == nil
|
|
|
|
@mappers.push(topic.user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@allsynapses.each_with_index do |synapse, index|
|
|
|
|
if @synapses.index{|s| s.desc == synapse.desc} == nil
|
|
|
|
@synapses.push(synapse)
|
|
|
|
end
|
|
|
|
if @mappers.index(synapse.user) == nil
|
|
|
|
@mappers.push(synapse.user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-08-10 17:06:58 +00:00
|
|
|
|
2014-11-11 07:23:39 +00:00
|
|
|
if @map || @topic
|
2014-09-29 20:41:16 +00:00
|
|
|
@metacodes.sort! {|x,y|
|
|
|
|
n1 = x.name || ""
|
|
|
|
n2 = y.name || ""
|
|
|
|
n1 <=> n2
|
|
|
|
}
|
|
|
|
@synapses.sort! {|x,y|
|
|
|
|
d1 = x.desc || ""
|
|
|
|
d2 = y.desc || ""
|
|
|
|
d1 <=> d2
|
|
|
|
}
|
|
|
|
@mappers.sort! {|x,y|
|
|
|
|
n1 = x.name || ""
|
|
|
|
n2 = y.name || ""
|
|
|
|
n1 <=> n2
|
|
|
|
}
|
2014-08-10 17:06:58 +00:00
|
|
|
|
|
|
|
@metacodes.each_with_index do |metacode, index|
|
|
|
|
@metacodelist += '<li data-id="' + metacode.id.to_s + '">'
|
2015-10-25 08:50:07 +00:00
|
|
|
@metacodelist += '<img src="' + asset_path(metacode.icon) + '" data-id="' + metacode.id.to_s + '" alt="' + metacode.name + '" />'
|
2014-08-10 17:06:58 +00:00
|
|
|
@metacodelist += '<p>' + metacode.name.downcase + '</p></li>'
|
2014-08-02 17:49:51 +00:00
|
|
|
end
|
2014-08-10 17:06:58 +00:00
|
|
|
@synapses.each_with_index do |synapse, index|
|
2014-09-29 20:45:59 +00:00
|
|
|
d = synapse.desc || ""
|
|
|
|
@synapselist += '<li data-id="' + d + '">'
|
2015-09-22 14:27:34 +00:00
|
|
|
@synapselist += '<img src="' + asset_path('synapse16.png') + '" alt="synapse icon" /><p>' + d
|
2014-08-10 17:06:58 +00:00
|
|
|
@synapselist += '</p></li>'
|
2014-08-02 17:49:51 +00:00
|
|
|
end
|
2014-08-10 17:06:58 +00:00
|
|
|
@mappers.each_with_index do |mapper, index|
|
|
|
|
@mapperlist += '<li data-id="' + mapper.id.to_s + '">'
|
2014-11-25 20:06:30 +00:00
|
|
|
@mapperlist += '<img src="' + mapper.image.url(:sixtyfour) + '" data-id="' + mapper.id.to_s + '" alt="' + mapper.name + '" />'
|
2014-08-10 17:06:58 +00:00
|
|
|
@mapperlist += '<p>' + mapper.name + '</p></li>'
|
2014-08-04 16:20:16 +00:00
|
|
|
end
|
|
|
|
end
|
2014-08-02 17:49:51 +00:00
|
|
|
%>
|
2014-08-04 16:20:16 +00:00
|
|
|
<div class="filterBox">
|
2014-09-03 23:05:25 +00:00
|
|
|
<h2>FILTER BY</h2>
|
|
|
|
<div id="filter_by_mapper" class="filterBySection">
|
2014-11-11 07:23:39 +00:00
|
|
|
<h3><%= @map ? "MAPPERS" : @topic ? "CREATORS" : "" %></h3>
|
2014-09-03 23:05:25 +00:00
|
|
|
<span class="hideAll hideAllMappers">NONE</span>
|
2014-11-21 20:45:44 +00:00
|
|
|
<span class="active showAll showAllMappers">ALL</span>
|
2014-09-03 23:05:25 +00:00
|
|
|
<div class="clearfloat"></div>
|
2014-08-02 17:49:51 +00:00
|
|
|
<ul>
|
2014-09-03 23:05:25 +00:00
|
|
|
<%= @mapperlist.html_safe %>
|
2014-08-04 16:20:16 +00:00
|
|
|
</ul>
|
2014-08-02 17:49:51 +00:00
|
|
|
<div class="clearfloat"></div>
|
2014-08-04 16:20:16 +00:00
|
|
|
</div>
|
2014-09-03 23:05:25 +00:00
|
|
|
|
|
|
|
<div id="filter_by_metacode" class="filterBySection">
|
|
|
|
<h3>METACODES</h3>
|
|
|
|
<span class="hideAll hideAllMetacodes">NONE</span>
|
2014-11-21 20:45:44 +00:00
|
|
|
<span class="active showAll showAllMetacodes">ALL</span>
|
2014-09-03 23:05:25 +00:00
|
|
|
<div class="clearfloat"></div>
|
2014-08-02 17:49:51 +00:00
|
|
|
<ul>
|
2014-09-03 23:05:25 +00:00
|
|
|
<%= @metacodelist.html_safe %>
|
2014-08-04 16:20:16 +00:00
|
|
|
</ul>
|
2014-08-02 17:49:51 +00:00
|
|
|
<div class="clearfloat"></div>
|
|
|
|
</div>
|
2014-09-03 23:05:25 +00:00
|
|
|
|
|
|
|
<div id="filter_by_synapse" class="filterBySection">
|
|
|
|
<h3>SYNAPSES</h3>
|
|
|
|
<span class="hideAll hideAllSynapses">NONE</span>
|
2014-11-21 20:45:44 +00:00
|
|
|
<span class="active showAll showAllSynapses">ALL</span>
|
2014-09-03 23:05:25 +00:00
|
|
|
<div class="clearfloat"></div>
|
2014-08-04 16:20:16 +00:00
|
|
|
<ul>
|
2014-09-03 23:05:25 +00:00
|
|
|
<%= @synapselist.html_safe %>
|
2014-08-04 16:20:16 +00:00
|
|
|
</ul>
|
|
|
|
<div class="clearfloat"></div>
|
2014-08-02 17:49:51 +00:00
|
|
|
</div>
|
2014-08-04 16:20:16 +00:00
|
|
|
|
|
|
|
</div> <!-- end .filterBox -->
|
|
|
|
|