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

79 lines
3.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>
<% if defined?(i) %>
<%= f.hidden_field :_destroy, :value => "false", :class => "attribute_field_to_delete" %>
<h4><%= column.title %></h4>
<% else %>
<h4>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 %>
</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="">Type</label>
<div class="controls">
<% select_values = UTable::FIELD_TYPES.collect{|ft| [ft.capitalize,ft]} %>
<%= f.select :type, select_values, {}, {class: "type-selector"} %>
<label class="checkbox inline attributes-checkbox <%= !defined?(i) || column.type == "text" ? "" : "hide" %>">
<%= f.check_box :is_link_to_show %> Link to show
</label>
</div>
</div>
<% if defined?(i) %>
<% if column.order.nil? %>
<%= f.hidden_field :order, :value => i %>
<% else %>
<%= f.hidden_field :order %>
<% end %>
<% else %>
<%= f.hidden_field :order, :value=> "XXX" %>
<% end %>
</div>
<% if !defined?(i) %>
<div class="attributes">
<% end %>