2018-03-04 02:25:42 +00:00
|
|
|
{#
|
2014-06-04 19:24:16 +00:00
|
|
|
# @file
|
|
|
|
# The inner HTML for switching your metacode set
|
2018-03-04 02:25:42 +00:00
|
|
|
#}
|
2014-06-04 19:24:16 +00:00
|
|
|
|
2018-03-04 02:25:42 +00:00
|
|
|
{ metacodes = current_user.settings.metacodes }
|
|
|
|
{ selectedSet = metacodes[0].include?("metacodeset") ? metacodes[0].sub("metacodeset-","") : "custom" }
|
|
|
|
{ allMetacodeSets = MetacodeSet.order("name").all.to_a }
|
|
|
|
{ if selectedSet == "custom"
|
2016-10-05 14:45:39 +00:00
|
|
|
index = allMetacodeSets.length + 2
|
|
|
|
elsif selectedSet == 'Recent'
|
|
|
|
index = 0
|
|
|
|
elsif selectedSet == 'Most'
|
|
|
|
index = 1
|
2014-06-04 19:24:16 +00:00
|
|
|
else
|
|
|
|
set = MetacodeSet.find(selectedSet.to_i)
|
2016-10-05 14:45:39 +00:00
|
|
|
index = allMetacodeSets.index(set) + 2
|
2018-03-04 02:25:42 +00:00
|
|
|
end }
|
2014-06-04 19:24:16 +00:00
|
|
|
<h3>Switch Metacode Set</h3>
|
2014-09-17 14:59:36 +00:00
|
|
|
|
|
|
|
<p>Use metacode sets to enter different modes of mapping.</p>
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
<div id="metacodeSwitchTabs">
|
|
|
|
<ul>
|
2016-10-05 14:45:39 +00:00
|
|
|
<li><a href="#metacodeSwitchTabsRecent" data-set-id="recent" id="metacodeSetRecent">RECENTLY USED</a></li>
|
|
|
|
<li><a href="#metacodeSwitchTabsMost" data-set-id="most" id="metacodeSetMost">MOST USED</a></li>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ allMetacodeSets.each do |m| }
|
|
|
|
<li><a href="#metacodeSwitchTabs{ m.id }" data-set-id="{ m.id }">{ m.name }</a></li>
|
|
|
|
{ end }
|
2016-08-16 14:25:07 +00:00
|
|
|
<li><a href="#metacodeSwitchTabsCustom" data-set-id="custom" id="metacodeSetCustom">CUSTOM SELECTION</a></li>
|
2014-06-04 19:24:16 +00:00
|
|
|
</ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ recent = user_recent_metacodes() }
|
2016-10-05 14:45:39 +00:00
|
|
|
<div id="metacodeSwitchTabsRecent"
|
2018-03-04 02:25:42 +00:00
|
|
|
data-metacodes="{ recent.map(&:id).join(',') }">
|
|
|
|
{ @list = '' }
|
|
|
|
{ recent.each_with_index do |m, index| }
|
|
|
|
{ @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' }
|
|
|
|
{ end }
|
2016-10-05 14:45:39 +00:00
|
|
|
<div class="metacodeSwitchTab">
|
|
|
|
<p class="setDesc">The 5 Metacodes you've used most recently.</p>
|
|
|
|
<div class="metacodeSetList">
|
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2016-10-05 14:45:39 +00:00
|
|
|
</ul>
|
|
|
|
<div class="clearfloat"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<button class="button" onclick="Metamaps.Create.updateMetacodeSet('Recent', 0, false);">
|
|
|
|
Switch Set
|
|
|
|
</button>
|
|
|
|
</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ most_used = user_most_used_metacodes() }
|
2016-10-05 14:45:39 +00:00
|
|
|
<div id="metacodeSwitchTabsMost"
|
2018-03-04 02:25:42 +00:00
|
|
|
data-metacodes="{ most_used.map(&:id).join(',') }">
|
|
|
|
{ @list = '' }
|
|
|
|
{ most_used.each_with_index do |m, index| }
|
|
|
|
{ @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' }
|
|
|
|
{ end }
|
2016-10-05 14:45:39 +00:00
|
|
|
<div class="metacodeSwitchTab">
|
|
|
|
<p class="setDesc">The 5 Metacodes you've used the most.</p>
|
|
|
|
<div class="metacodeSetList">
|
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2016-10-05 14:45:39 +00:00
|
|
|
</ul>
|
|
|
|
<div class="clearfloat"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<button class="button" onclick="Metamaps.Create.updateMetacodeSet('Most', 1, false);">
|
|
|
|
Switch Set
|
|
|
|
</button>
|
|
|
|
</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ allMetacodeSets.each_with_index do |m, localindex| }
|
|
|
|
<div id="metacodeSwitchTabs{ m.id }"
|
|
|
|
data-metacodes="{ m.metacodes.map(&:id).join(',') }">
|
|
|
|
{ @list = '' }
|
|
|
|
{ m.metacodes.sort{|x,y| x.name <=> y.name }.each_with_index do |m, index| }
|
|
|
|
{ @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' }
|
|
|
|
{ end }
|
2014-11-03 13:46:22 +00:00
|
|
|
<div class="metacodeSwitchTab">
|
2018-03-04 02:25:42 +00:00
|
|
|
<p class="setDesc">{ m.desc }</p>
|
2014-11-03 13:46:22 +00:00
|
|
|
<div class="metacodeSetList">
|
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2014-11-03 13:46:22 +00:00
|
|
|
</ul>
|
|
|
|
<div class="clearfloat"></div>
|
|
|
|
</div>
|
2014-06-04 19:24:16 +00:00
|
|
|
</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
<button class="button" onclick="Metamaps.Create.updateMetacodeSet({ m.id }, { localindex + 2 }, false);">
|
2014-09-17 14:59:36 +00:00
|
|
|
Switch Set
|
2014-07-29 17:34:10 +00:00
|
|
|
</button>
|
2014-06-04 19:24:16 +00:00
|
|
|
</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
2014-06-04 19:24:16 +00:00
|
|
|
<div id="metacodeSwitchTabsCustom">
|
2017-03-07 03:49:46 +00:00
|
|
|
<div class="setDesc">Choose Your Metacodes</div>
|
|
|
|
<div class="selectNone">NONE</div>
|
|
|
|
<div class="selectAll">ALL</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list = '' }
|
|
|
|
{ metacodesInUse = user_metacodes() }
|
|
|
|
{ Metacode.order("name").all.each_with_index do |m, index| }
|
|
|
|
{ mClass = metacodesInUse.index(m) == nil ? "toggledOff" : "" }
|
|
|
|
{ @list += '<li id="' + m.id.to_s + '" data-name="' + m.name + '" class="' + mClass + '"><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' }
|
|
|
|
{ end }
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
<div class="customMetacodeList">
|
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2014-06-04 19:24:16 +00:00
|
|
|
</ul>
|
|
|
|
<div class="clearfloat"></div>
|
|
|
|
</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
<button class="button" onclick="Metamaps.Create.updateMetacodeSet('custom', { allMetacodeSets.length + 2 }, true);">
|
2014-07-29 17:34:10 +00:00
|
|
|
Switch to Custom Set
|
|
|
|
</button>
|
2014-06-04 19:24:16 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="clearfloat"></div>
|
|
|
|
|
|
|
|
<script>
|
2018-03-04 02:25:42 +00:00
|
|
|
Metamaps.Create.selectedMetacodeSet = "metacodeset-{ selectedSet }"
|
|
|
|
Metamaps.Create.selectedMetacodeSetIndex = { index }
|
2017-03-07 03:49:46 +00:00
|
|
|
</script>
|