orbit-basic/app/views/admin/attributes/index.html.erb

35 lines
1.9 KiB
Plaintext

<% content_for :secondary do %>
<%= render 'admin/users/side_bar' %>
<% end %>
<div class="main_list">
<div id="add_new" class="buttom clear">
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path") %>
</div>
<ul>
<li class="list_head clear">
<span class="<%= @attribute_type %>s"><%= t("admin.#{@attribute_type}") %></span>
<span class="action"><%= t('admin.action') %></span>
</li>
<% @attributes.each do |attribute| %>
<li id="attribute_<%= attribute.id %>" class="list_item <%= "#{attribute.is_disabled? ? 'disable' : ''}" %> clear">
<span class="<%= @attribute_type %>s <%= attribute.i18n_variable[:key].downcase %>"><%= attribute.i18n_variable[I18n.locale] %></span>
<span class="action">
<%= link_to t(:edit), eval("edit_admin_#{@attribute_type}_path(attribute)"), :class => 'edit' %>
<% if attribute.is_built_in? %>
<%= link_to t(:enable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' %>
<%= link_to t(:disable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' %>
<% else %>
<%= link_to t(:delete), eval("admin_#{@attribute_type}_path(attribute)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
<% end %>
</span>
</li>
<% end %>
</ul>
<div id="add_new" class="buttom clear">
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path") %>
</div>
</div>