forked from saurabh/orbit4-5
92 lines
4.1 KiB
Plaintext
92 lines
4.1 KiB
Plaintext
<div class="control-group input-content">
|
|
<label class="control-label muted"><%= t('default_widget.select_widget_style') %></label>
|
|
<div class="controls">
|
|
<% if @widget_types.first.kind_of?(Hash) %>
|
|
<select name="page_part[sub_parts_attributes][<%= @select_number %>][widget_type]" id="page_layout" class="select2">
|
|
<% @widget_types.each do |lt| %>
|
|
<option value="<%= lt["filename"] %>" <%= ((lt["filename"] == @subpart.widget_type ? "selected=selected" : "") rescue nil) %> data-image="<%= lt["thumbnail"] %>"><%= (lt["name"].kind_of?(Hash) ? lt["name"][I18n.locale.to_s] : lt["name"]) %></option>
|
|
<% end %>
|
|
</select>
|
|
<script type="text/javascript">
|
|
$("select.select2").select2({
|
|
formatResult: function(el){
|
|
var $element = $(el.element),
|
|
image = $element.data("image");
|
|
return "<img class='thumbnail' src='" + image + "'/><span class='thumbnail-text'>" + el.text + "</span>";
|
|
},
|
|
minimumResultsForSearch: -1,
|
|
width : 250
|
|
});
|
|
</script>
|
|
<% else %>
|
|
<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][widget_type]",options_for_select(@widget_types, (@subpart.widget_type rescue nil))) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted">Select Widget Method :</label>
|
|
<div class="controls">
|
|
<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][widget_method]",options_for_select(@widget_methods, (@subpart.widget_method rescue nil))) %>
|
|
</div>
|
|
</div>
|
|
<% if @widget_settings['override_category_with'].nil? %>
|
|
<% if !@categories.blank? %>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:categories) %></label>
|
|
<div class="controls">
|
|
<% @categories.each do |category| %>
|
|
<label class="checkbox">
|
|
<input type="checkbox" <%= @subpart.categories.include?(category.id.to_s) ? "checked='checked'" : "" rescue nil %> value="<%= category.id.to_s %>" name="page_part[sub_parts_attributes][<%= @select_number %>][categories][]">
|
|
<%= category.title %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% if !@tags.blank? %>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:tags) %></label>
|
|
<div class="controls">
|
|
<label class="checkbox">
|
|
<input type="checkbox" <%= @subpart.tags.include?("all") ? "checked='checked'" : "" rescue false %> value="all" name="page_part[sub_parts_attributes][<%= @select_number %>][tags][]">
|
|
<%= t(:all) %>
|
|
</label>
|
|
<% @tags.each do |tag| %>
|
|
<label class="checkbox">
|
|
<input type="checkbox" <%= @subpart.tags.include?(tag.id.to_s) ? "checked='checked'" : "" rescue nil %> value="<%= tag.id.to_s %>" name="page_part[sub_parts_attributes][<%= @select_number %>][tags][]">
|
|
<%= tag.name %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<% if @multiselect %>
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= @widget_settings['override_category_with'].classify %> List :</label>
|
|
<div class="controls">
|
|
<% @custom.each do |c| %>
|
|
<label class="checkbox">
|
|
<input type="checkbox" <%= @subpart.custom_array_field.include?(c.id.to_s) ? "checked='checked'" : "" rescue nil %> value="<%= c.id.to_s %>" name="page_part[sub_parts_attributes][<%= @select_number %>][custom_array_field][]">
|
|
<%= c["#{@display_field}"] %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% else %>
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted">Select <%= @widget_settings['override_category_with'].classify %> :</label>
|
|
<div class="controls">
|
|
<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][custom_string_field]",options_for_select(@custom.map{|c| [c["#{@display_field}"],c.id]}, (@subpart.custom_string_field rescue nil))) %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% if !@data_count.nil? %>
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted">Data count:</label>
|
|
<div class="controls">
|
|
<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][data_count]",options_for_select(1..@data_count,(@subpart.data_count rescue nil))) %>
|
|
</div>
|
|
</div>
|
|
<% end %> |