Orbit/app/views/shared/attribute_field/_attribute_field.html.erb

125 lines
8.1 KiB
Plaintext
Raw Normal View History

<div class="form-horizontal">
2012-12-05 12:32:28 +00:00
<%
attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter
%>
2013-01-14 10:19:14 +00:00
<%= @af_counter + 1 %>
2012-12-05 12:32:28 +00:00
<%#= attribute_field_counter %>
<legend>
<button class="onoff pull-right <%= attribute_field.disabled ? 'disabled' : ''%>">ON</button>
2012-12-05 12:32:28 +00:00
<%= hidden_field "info[attribute_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"attribute_field_disabled"%>
<%= hidden_field "info[attribute_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%>
2013-01-14 10:19:14 +00:00
<a class="btn btn-small pull-right btn-danger remove_attribute"><i class="icon-trash icon-large"></i> <%= t(:delete_)%></a>
<div class="clear">
2013-02-20 03:12:08 +00:00
<div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:key) %></label>
<div class="multipleInput">
<div class="controls">
<%= text_field "info[attribute_fields][#{@af_counter}]","key",:value=>attribute_field.key%>
</div>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"info[attribute_fields][#{@af_counter}][title_translations]"}%>
2013-01-14 10:19:14 +00:00
<div class="control-group">
<label class="control-label" for="key"><%= t(:to_search) %></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("info[attribute_fields][#{@af_counter}]", "to_search", "true",:checked => (attribute_field.to_search == true ? true : false)) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("info[attribute_fields][#{@af_counter}]", "to_search", "false",:checked => (attribute_field.to_search == false ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
2013-02-20 03:12:08 +00:00
<div class="control-group pull-left">
2012-11-27 03:15:15 +00:00
<label class="control-label" for=""><%= t(:type)%></label>
<div class="controls">
2012-12-05 12:32:28 +00:00
<%#= select_tag "info[attribute_fields][#{@af_counter}][markup]" do %>
<select class="dataType" name=<%= "info[attribute_fields][#{@af_counter}][markup]"%>>
<%LIST[:markups].each do |key,val|%>
<option value="<%= key %>" <%= attribute_field.markup == key ? 'selected="selected"' : '' %> ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
<% end %>
</select>
</div>
</div>
</div>
</legend>
<div class="<%= attribute_field.disabled ? 'hide' : ''%>">
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeA") do%>
<div class="control-group">
2013-02-20 03:12:08 +00:00
<label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
2012-12-05 12:32:28 +00:00
<%= check_box_tag("info[attribute_fields][#{@af_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"]) %>
2012-11-27 03:15:15 +00:00
<%= t(:cross_lang)%>
</label>
<label class="checkbox inline">
2012-12-05 12:32:28 +00:00
<%= check_box_tag("info[attribute_fields][#{@af_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"]) %>
2012-11-27 03:15:15 +00:00
<%= t(:add_more)%>
</label>
</div>
</div>
2012-12-05 12:32:28 +00:00
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"info[attribute_fields][#{@af_counter}][typeA][placeholder]"}%>
<% end %>
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeB") do %>
2012-12-05 12:32:28 +00:00
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{@af_counter}][typeB][initial]"}%>
2012-11-08 10:59:19 +00:00
<% if attribute_field.self_defined_markup_options?%>
2012-12-05 12:32:28 +00:00
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{@af_counter}][attribute][role][statuses]"} %>
2012-11-08 10:59:19 +00:00
<%else #normal list%>
2012-12-05 12:32:28 +00:00
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{@af_counter}][typeB][option_list]"} %>
2012-11-08 10:59:19 +00:00
<% end #of self_defined_markup_options?%>
<% end %>
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeC") do %>
<div class="control-group">
2012-11-27 03:15:15 +00:00
<label class="control-label"><%= t("date.format")%></label>
<div class="controls">
2012-12-05 12:32:28 +00:00
<%= select "info[attribute_fields][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_field["typeC"]["format"] %>
</div>
</div>
<div class="control-group">
2012-11-27 03:15:15 +00:00
<label class="control-label"><%= t("date.range")%></label>
<div class="controls">
<label class="radio inline">
2012-12-05 12:32:28 +00:00
<%= radio_button("info[attribute_fields][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
</label>
<label class="radio inline">
2012-12-05 12:32:28 +00:00
<%= radio_button("info[attribute_fields][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
<div class="control-group">
2012-11-27 03:15:15 +00:00
<label class="control-label"><%= t("date.calendar")%></label>
<div class="controls">
<label class="radio inline">
2012-12-05 12:32:28 +00:00
<%= radio_button("info[attribute_fields][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
</label>
<label class="radio inline">
2012-12-05 12:32:28 +00:00
<%= radio_button("info[attribute_fields][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label>
</div>
</div>
<% end %>
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeD") do%>
<div class="control-group">
2013-02-20 03:12:08 +00:00
<label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
2012-12-05 12:32:28 +00:00
<%= check_box_tag("info[attribute_fields][#{@af_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %>
2012-11-27 03:15:15 +00:00
<%= t(:cross_lang)%>
</label>
</div>
</div>
2012-12-05 12:32:28 +00:00
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"info[attribute_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %>
<% end %>
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeE") do%>
2012-12-05 12:32:28 +00:00
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"info[attribute_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["option_list"]}%>
<% end %>
</div>
2012-12-05 12:32:28 +00:00
<%= hidden_field "info[attribute_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
</div>