forked from saurabh/orbit4-5
99 lines
5.5 KiB
Plaintext
99 lines
5.5 KiB
Plaintext
<div class="btn-group" data-toggle="buttons-radio">
|
|
<label href="#none" class="btn btn-large <%= @subpart.nil? || @subpart.kind == "none" ? 'active' : '' rescue nil %>" data-toggle="tab">
|
|
<%= t("page_part_kinds.none") %>
|
|
<input type="radio" <%= @subpart.kind == "none" ? "checked" : "" rescue nil %> class="hide widget_type_class" value="none" name="page_part[sub_parts_attributes][<%= @select_number %>][kind]" />
|
|
</label>
|
|
<label href="#text" class="btn btn-large <%= @subpart.kind == "text" ? 'active' : '' rescue nil %>" data-toggle="tab">
|
|
<%= t("page_part_kinds.text") %>
|
|
<input type="radio" class="hide widget_type_class" <%= @subpart.kind == "text" ? "checked" : "" rescue nil %> value="text" name="page_part[sub_parts_attributes][<%= @select_number %>][kind]" />
|
|
</label>
|
|
<!-- <label href="#public_r_tag" class="btn btn-large" data-toggle="tab"> -->
|
|
<%#= t("page_part_kinds.public_r_tag") %>
|
|
<%#= sub.radio_button :kind, "public_r_tag", class: "hide" %>
|
|
<!-- </label> -->
|
|
<label href="#module_widget" class="btn btn-large <%= @subpart.kind == "module_widget" ? 'active' : '' rescue nil %>" data-toggle="tab">
|
|
<%= t("page_part_kinds.module_widget") %>
|
|
<input type="radio" class="hide widget_type_class" value="module_widget" <%= @subpart.kind == "module_widget" ? "checked" : "" rescue nil %> name="page_part[sub_parts_attributes][<%= @select_number %>][kind]" />
|
|
|
|
</label>
|
|
</div>
|
|
<fieldset>
|
|
<div class="input-area tab-content">
|
|
<div id="none" class="parts-none tab-pane fade in <%= @subpart.nil? || @subpart.kind == "none" ? 'active' : '' rescue nil %>"><%= t(:select_one_function) %></div>
|
|
<div id="text" class="tab-pane fade in <%= @subpart.kind == "text" ? 'active' : '' rescue nil %>">
|
|
<div class="nav-name">
|
|
<strong><%= t(:language) %></strong>
|
|
</div>
|
|
<ul class="nav nav-pills language-nav">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<li class="<%= 'active' if i == 0 %>">
|
|
<a href=".<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<div class="tab-content language-area">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<div class="tab-pane fade <%= locale %> <%= 'active in' if i == 0 %>">
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted"><%= t(:content) %></label>
|
|
<div class="controls">
|
|
<div class="textarea">
|
|
<textarea name="page_part[sub_parts_attributes][<%= @select_number %>][content_translations][<%= locale.to_s %>]" class="ckeditor input-block-level"><%= @subpart.content_translations[locale] rescue nil %></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="module_widget" class="tab-pane fade in <%= @subpart.kind == "module_widget" ? 'active' : '' rescue nil %>">
|
|
<% @site_in_use_locales.each do |locale| %>
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted">Widget <%= t(:name) %>(<%= t(locale.to_s) %>) :</label>
|
|
<div class="controls">
|
|
<input name="page_part[sub_parts_attributes][<%= @select_number %>][title_translations][<%= locale.to_s %>]" value="<%= @subpart.title_translations[locale.to_s] rescue nil %>" />
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<div class="control-group input-content">
|
|
<%= f.label :module_app_id, t(:module) + " :", class: "control-label muted" %>
|
|
<div class="controls">
|
|
<%= select_tag("page_part[sub_parts_attributes][#{@select_number}][module]", options_for_select(@modules.map{|m| [m.title,m.key]}, (@subpart.module rescue nil)),{:include_blank => true,"class" => "input-xlarge change module_name", data: {"fv-validation" => "custom_not_empty;", "fv-messages" => "Cannot be empty.;"}}) %>
|
|
</div>
|
|
</div>
|
|
<% if @child_page_count > 0 %>
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted">Apply to sub-pages :</label>
|
|
<div class="controls">
|
|
<input type="checkbox" name="apply_to_subpage" value="1" />
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<div id="widgets_selection_area">
|
|
<% if params[:action] == "edit_sub_part" && @kind == "module_widget"%>
|
|
<%= render :partial => "widget_form" %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-actions">
|
|
<%= f.submit t(:update_), class: "btn btn-primary" %>
|
|
<button type="button" class="btn" onclick="window.history.back()"><%= t(:cancel) %></button>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<script type="text/javascript">
|
|
$('*[data-toggle=buttons-radio] label').click(function(){
|
|
$('*[data-toggle=buttons-radio] input[type=radio]').removeAttr("checked");
|
|
$(this).find("input[type=radio]").prop("checked","checked");
|
|
})
|
|
|
|
var formValidator = new FormValidator($("form.page_part_form_validate"));
|
|
formValidator.validate_functions.custom_not_empty = function(value){
|
|
var widget_type = formValidator.form.find("input.widget_type_class:checked").val();
|
|
widget_type = (typeof widget_type === "undefined" ? "none" : widget_type);
|
|
return ((widget_type == "module_widget" && value == "") ? false : true);
|
|
}
|
|
|
|
</script> |