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

99 lines
4.2 KiB
Plaintext
Raw Normal View History

2015-11-13 13:10:00 +00:00
<% 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>
2015-11-13 13:10:00 +00:00
<% 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>
2015-11-13 13:10:00 +00:00
<% else %>
<h4 class="draggable"><i class="icons-list-2"></i> ColumnXX</h4>
2015-11-13 13:10:00 +00:00
<% end %>
</div>
<div class="attributes-body">
<div class="control-group">
<label class="control-label muted" for="key_0">Key</label>
<div class="controls">
2022-02-24 09:31:45 +00:00
<%= f.text_field :key, :autocomplete => "off", :'data-type' => 'key' %>
2015-11-13 13:10:00 +00:00
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="">Title</label>
2022-02-24 09:31:45 +00:00
<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>
2015-11-13 13:10:00 +00:00
</div>
</div>
2022-02-24 09:31:45 +00:00
</div>
2015-11-13 13:10:00 +00:00
2022-02-24 09:31:45 +00:00
<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]} %>
2015-11-13 13:10:00 +00:00
</div>
2022-02-24 09:31:45 +00:00
</div>
</div>
2015-11-13 13:10:00 +00:00
<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" ? "" : "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%>
2015-11-13 13:10:00 +00:00
</label>
</div>
</div>
<% if defined?(i) %>
<% if column.order.nil? %>
<%= f.hidden_field :order, :value => i, :class => "order-hidden-field" %>
2015-11-13 13:10:00 +00:00
<% else %>
<%= f.hidden_field :order, :class => "order-hidden-field" %>
2015-11-13 13:10:00 +00:00
<% end %>
<% else %>
<%= f.hidden_field :order, :value=> "XXX", :class => "order-hidden-field" %>
2015-11-13 13:10:00 +00:00
<% end %>
</div>
<% if !defined?(i) %>
</div>
2015-11-13 13:10:00 +00:00
<% end %>