metamaps--metamaps/app/views/metacode_sets/_form.html.erb

89 lines
3.3 KiB
Text
Raw Permalink Normal View History

<%= form_for(@metacode_set) do |f| %>
<% if @metacode_set.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@metacode_set.errors.count, "error") %> prohibited this metacode set from being saved:</h2>
<ul>
<% @metacode_set.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
<div class="clearfloat"></div>
</div>
<div class="field">
<%= f.label :desc, "Description" %>
<%= f.text_area :desc, :cols => "40", :rows => "4" %>
<div class="clearfloat"></div>
</div>
<br />
<p>Choose Metacodes</p>
2014-09-16 01:57:34 +00:00
<div class="allMetacodes">
<span id="showAll" onclick="Metamaps.Admin.selectAll();">Select All</span>
<span id="hideAll" onclick="Metamaps.Admin.deselectAll();">Unselect All</span>
</div>
<div class="clearfloat"></div>
<div class="editMetacodes">
<ul id="filters-one">
<% $i = 0 %>
<% @m = Metacode.order("name").all %>
<% while $i < (Metacode.all.length / 4) do %>
2014-09-16 01:57:34 +00:00
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
onclick="Metamaps.Admin.liClickHandler.call(this);">
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-two">
<% while $i < (Metacode.all.length / 4 * 2) do %>
2014-09-16 01:57:34 +00:00
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
onclick="Metamaps.Admin.liClickHandler.call(this);">
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-three">
<% while $i < (Metacode.all.length / 4 * 3) do %>
2014-09-16 01:57:34 +00:00
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
onclick="Metamaps.Admin.liClickHandler.call(this);">
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-four">
<% while $i < Metacode.all.length do %>
2014-09-16 01:57:34 +00:00
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
onclick="Metamaps.Admin.liClickHandler.call(this);">
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
</div>
<%= hidden_field(:metacodes, :value, {:value => 0}) %>
<div class="clearfloat"></div>
<div class="actions">
2014-09-16 01:57:34 +00:00
<%= link_to 'Cancel', metacode_sets_path,
{ :class => 'button', 'data-bypass' => 'true' } %>
<%= f.submit :class => 'add', :onclick => "return Metamaps.Admin.validate();" %>
</div>
<% end %>