metamaps--metamaps/app/views/shared/_filterBox.html.erb

87 lines
2.9 KiB
Plaintext
Raw Normal View History

2014-08-02 17:49:51 +00:00
<%#
# @file
# 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 = ''
# 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
@map.topics.each_with_index do |topic, index|
if @metacodes.index(topic.metacode) == nil
@metacodes.push(topic.metacode)
end
end
@map.synapses.each_with_index do |synapse, index|
if @synapses.index{|s| s.desc == synapse.desc} == nil
@synapses.push(synapse)
end
end
@map.mappings.each_with_index do |mapping, index|
if @mappers.index(mapping.user) == nil
@mappers.push(mapping.user)
2014-08-10 17:06:58 +00:00
end
end
2014-08-10 17:06:58 +00:00
@metacodes.sort! {|x,y| x.name <=> y.name }
@synapses.sort! {|x,y| x.desc <=> y.desc }
@mappers.sort! {|x,y| x.name <=> y.name }
@metacodes.each_with_index do |metacode, index|
@metacodelist += '<li data-id="' + metacode.id.to_s + '">'
@metacodelist += '<img src="' + metacode.icon + '" data-id="' + metacode.id.to_s + '" alt="' + metacode.name + '" />'
@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|
@synapselist += '<li data-id="' + synapse.desc + '">'
@synapselist += '<img src="/assets/synapsevisualize.png" alt="synapse icon" /><p>' + synapse.desc
@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 + '">'
@mapperlist += '<img src="/assets/icons/person.png" data-id="' + mapper.id.to_s + '" alt="' + mapper.name + '" />'
@mapperlist += '<p>' + mapper.name + '</p></li>'
end
end
2014-08-02 17:49:51 +00:00
%>
<div class="filterBox">
2014-08-02 17:49:51 +00:00
<div class="clearfloat"></div>
2014-08-02 17:49:51 +00:00
<div id="filter_by_metacode">
<h3>metacodes</h3><span class="showAll showAllMetacodes">all</span> <span class="hideAll hideAllMetacodes">none</span>
<br>
2014-08-02 17:49:51 +00:00
<ul>
<%= @metacodelist.html_safe %>
</ul>
2014-08-02 17:49:51 +00:00
<div class="clearfloat"></div>
</div>
<div id="filter_by_synapse">
<h3>synapses</h3> <span class="showAll showAllSynapses">all</span> <span class="hideAll hideAllSynapses">none</span>
<br>
2014-08-02 17:49:51 +00:00
<ul>
<%= @synapselist.html_safe %>
</ul>
2014-08-02 17:49:51 +00:00
<div class="clearfloat"></div>
</div>
<div id="filter_by_mapper">
<h3>mappers</h3><span class="showAll showAllMappers">all</span> <span class="hideAll hideAllMappers">none</span>
<br>
<ul>
<%= @mapperlist.html_safe %>
</ul>
<div class="clearfloat"></div>
2014-08-02 17:49:51 +00:00
</div>
</div> <!-- end .filterBox -->