2018-03-05 17:45:36 +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| }
|
2018-03-05 17:33:16 +00:00
|
|
|
{ @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div className="clearfloat"></div></li>' }
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="metacodeSwitchTab">
|
|
|
|
<p className="setDesc">The 5 Metacodes you've used most recently.</p>
|
|
|
|
<div className="metacodeSetList">
|
2016-10-05 14:45:39 +00:00
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2016-10-05 14:45:39 +00:00
|
|
|
</ul>
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="clearfloat"></div>
|
2016-10-05 14:45:39 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-05 17:33:16 +00:00
|
|
|
<button className="button" onclick="Metamaps.Create.updateMetacodeSet('Recent', 0, false);">
|
2016-10-05 14:45:39 +00:00
|
|
|
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| }
|
2018-03-05 17:33:16 +00:00
|
|
|
{ @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div className="clearfloat"></div></li>' }
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="metacodeSwitchTab">
|
|
|
|
<p className="setDesc">The 5 Metacodes you've used the most.</p>
|
|
|
|
<div className="metacodeSetList">
|
2016-10-05 14:45:39 +00:00
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2016-10-05 14:45:39 +00:00
|
|
|
</ul>
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="clearfloat"></div>
|
2016-10-05 14:45:39 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-05 17:33:16 +00:00
|
|
|
<button className="button" onclick="Metamaps.Create.updateMetacodeSet('Most', 1, false);">
|
2016-10-05 14:45:39 +00:00
|
|
|
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| }
|
2018-03-05 17:33:16 +00:00
|
|
|
{ @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div className="clearfloat"></div></li>' }
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="metacodeSwitchTab">
|
|
|
|
<p className="setDesc">{ m.desc }</p>
|
|
|
|
<div className="metacodeSetList">
|
2014-11-03 13:46:22 +00:00
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2014-11-03 13:46:22 +00:00
|
|
|
</ul>
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="clearfloat"></div>
|
2014-11-03 13:46:22 +00:00
|
|
|
</div>
|
2014-06-04 19:24:16 +00:00
|
|
|
</div>
|
2018-03-05 17:33:16 +00:00
|
|
|
<button className="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">
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="setDesc">Choose Your Metacodes</div>
|
|
|
|
<div className="selectNone">NONE</div>
|
|
|
|
<div className="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" : "" }
|
2018-03-05 17:33:16 +00:00
|
|
|
{ @list += '<li id="' + m.id.to_s + '" data-name="' + m.name + '" className="' + mClass + '"><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div className="clearfloat"></div></li>' }
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
2014-06-04 19:24:16 +00:00
|
|
|
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="customMetacodeList">
|
2014-06-04 19:24:16 +00:00
|
|
|
<ul>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ @list.html_safe }
|
2014-06-04 19:24:16 +00:00
|
|
|
</ul>
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="clearfloat"></div>
|
2014-06-04 19:24:16 +00:00
|
|
|
</div>
|
2018-03-05 17:33:16 +00:00
|
|
|
<button className="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>
|
|
|
|
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="clearfloat"></div>
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
<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>
|