universal_table/app/views/admin/universal_tables/_column.html.erb

99 lines
4.2 KiB
Plaintext

<% if !defined?(i) %>
<div class="attributes">
<% end %>
<div class="attributes-header clearfix">
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> Delete</a>
<% if defined?(i) %>
<%= f.hidden_field :_destroy, :value => "false", :class => "attribute_field_to_delete" %>
<h4 class="draggable"><i class="icons-list-2"></i> <%= column.title %></h4>
<% else %>
<h4 class="draggable"><i class="icons-list-2"></i> ColumnXX</h4>
<% end %>
</div>
<div class="attributes-body">
<div class="control-group">
<label class="control-label muted" for="key_0">Key</label>
<div class="controls">
<%= f.text_field :key, :autocomplete => "off", :'data-type' => 'key' %>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="">Title</label>
<div class="controls">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active in" : "") %>
<% id = (defined?(i) ? "table_column_#{i}_title_translations_#{locale.to_s}" : "table_column_XXX_title_translations_#{locale.to_s}") %>
<div class="tab-pane fade in <%= active %>" id="<%= id %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :value => column.title_translations[locale] %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<% id = (defined?(i) ? "table_column_#{i}_title_translations_#{locale.to_s}" : "table_column_XXX_title_translations_#{locale.to_s}") %>
<%= link_to t(locale).to_s,"##{id}",:class=>"btn #{active}",:data=>{:toggle=>"tab"}%>
<% end %>
</div>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="">Display in index</label>
<div class="controls">
<label class="radio inline">
<%= f.radio_button :display_in_index, "true" %>Yes
</label>
<label class="radio inline">
<%= f.radio_button :display_in_index, "false" %>No
</label>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for=""><%= t('universal_table.default_ordered_field') %></label>
<div class="controls">
<div>
<%= f.check_box :default_ordered_field, class: 'default_ordered_field' %>
</div>
<div class="order_direction<%= ' hidden' if !f.object.default_ordered_field %>">
<%= f.select :order_direction,['desc','asc'].map{|v| [t("universal_table.#{v}"),v]} %>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="">Type</label>
<div class="controls">
<% select_values = UTable::FIELD_TYPES.collect{|ft| [ft.capitalize,ft]} %>
<%= f.select :type, select_values, {}, {class: "type-selector"} %>
<span class="link_to_show <%= (!defined?(i) || column.type == "text" || column.type == "integer") ? "" : "hide" %>">
<label class="checkbox inline attributes-checkbox ">
<%= f.check_box :is_link_to_show %> Link to show
</label>
<label class="checkbox inline attributes-checkbox">
<%= f.check_box :make_categorizable %> Categorizable
</label>
</span>
<% select_values = UTable::DATE_FORMATS.collect{|ft| [ft.upcase,ft]} %>
<label class="checkbox date_format inline attributes-checkbox <%= column.type == "date" || column.type == "period" ? "" : "hide" %>">
Date Format <%= f.select :date_format, select_values%>
</label>
</div>
</div>
<% if defined?(i) %>
<% if column.order.nil? %>
<%= f.hidden_field :order, :value => i, :class => "order-hidden-field" %>
<% else %>
<%= f.hidden_field :order, :class => "order-hidden-field" %>
<% end %>
<% else %>
<%= f.hidden_field :order, :value=> "XXX", :class => "order-hidden-field" %>
<% end %>
</div>
<% if !defined?(i) %>
</div>
<% end %>