170 lines
8.3 KiB
Plaintext
170 lines
8.3 KiB
Plaintext
|
<% content_for :page_specific_css do %>
|
||
|
<%= stylesheet_link_tag "lib/main-forms" %><% end %>
|
||
|
<% content_for :page_specific_javascript do %>
|
||
|
<%= javascript_include_tag "lib/items/page_part" %>
|
||
|
<% end %>
|
||
|
<%= form_for @part, url: {action: "update"}, :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
|
||
|
<%= f.error_messages %>
|
||
|
<div class="btn-group" data-toggle="buttons-radio">
|
||
|
<label href="#none" class="btn btn-large" data-toggle="tab">
|
||
|
<%= t("page_part_kinds.none") %>
|
||
|
<%= f.radio_button :kind, "none", class: "hide" %>
|
||
|
</label>
|
||
|
<label href="#text" class="btn btn-large" data-toggle="tab">
|
||
|
<%= t("page_part_kinds.text") %>
|
||
|
<%= f.radio_button :kind, "text", class: "hide" %>
|
||
|
</label>
|
||
|
<label href="#public_r_tag" class="btn btn-large" data-toggle="tab">
|
||
|
<%= t("page_part_kinds.public_r_tag") %>
|
||
|
<%= f.radio_button :kind, "public_r_tag", class: "hide" %>
|
||
|
</label>
|
||
|
<label href="#module_widget" class="btn btn-large" data-toggle="tab">
|
||
|
<%= t("page_part_kinds.module_widget") %>
|
||
|
<%= f.radio_button :kind, "module_widget", class: "hide" %>
|
||
|
</label>
|
||
|
</div>
|
||
|
<fieldset>
|
||
|
<div class="input-area tab-content">
|
||
|
<div id="none" class="parts-none tab-pane fade in"><%= t(:select_one_function) %></div>
|
||
|
<div id="text" class="tab-pane fade in">
|
||
|
<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"><%= I18nVariable.from_locale(locale) %></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">
|
||
|
<%= f.fields_for :content_translations do |f| %>
|
||
|
<%= f.text_area locale, class: "ckeditor input-block-level", value: (@part.content_translations[locale] rescue nil) %>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="public_r_tag" class="tab-pane fade in">
|
||
|
<div class="control-group input-content">
|
||
|
<label class="control-label muted"><%= t("page_part_kinds.public_r_tag") %></label>
|
||
|
<div class="controls">
|
||
|
<span id='tag_list'>
|
||
|
<%= f.select :public_r_tag, LIST[:public_r_tags].collect{|tag| [t(tag), tag]}, {selected: @r_tag}, {rel: reload_r_tag_options_admin_page_part_path(@part), class: "input-xlarge"} %>
|
||
|
</span>
|
||
|
<span id='name_list'>
|
||
|
<% case @r_tag %>
|
||
|
<% when 'sub_menu' %>
|
||
|
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
|
||
|
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
|
||
|
<% when 'sitemap', 'terms_of_use', 'breadcrumb' %>
|
||
|
<% else %>
|
||
|
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, selected: @part.public_r_tag_object_id) %>
|
||
|
<% end %>
|
||
|
</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="module_widget" class="tab-pane fade in">
|
||
|
<%= f.fields_for :title_translations do |f| %>
|
||
|
<% @site_in_use_locales.each do |locale| %>
|
||
|
<div class="control-group input-content">
|
||
|
<%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}", class: "control-label muted" %>
|
||
|
<div class="controls">
|
||
|
<%= f.text_field locale, class: 'input-xlarge page_title', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", id: locale, :value => (@part.title_translations[locale] rescue nil) %>
|
||
|
</div>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
<div class="control-group input-content">
|
||
|
<%= f.label :module_app_id, t(:module), class: "control-label muted" %>
|
||
|
<div class="controls">
|
||
|
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, selected: (@part.module_app_id rescue nil)), {}, {include_blank: true, class: "input-xlarge change"} %>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="front_url" class="control-group input-content <%= 'hide' if @widget_paths.blank? %>">
|
||
|
<%= f.label :widget_path, t('front_page.display_mode'), class: "control-label muted" %>
|
||
|
<div class="controls">
|
||
|
<%= f.select :widget_path, @widget_paths, {}, selected: (@part.widget_path rescue nil), class: "input-xlarge change" %>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="control-group input-content checkbox-groups <%= 'hide' if @module_app_categories.blank? %>" id="page-category-groups" data-for="category">
|
||
|
<%= f.label :categories, t(:categories), class: "control-label muted" %>
|
||
|
<div class="controls">
|
||
|
<%= content_tag :label, class: "checkbox" do %>
|
||
|
<%= check_box_tag nil, nil, (@part.category.size == @module_app_categories.size ? true : false), class: "select_all" %> <%= t(:all) %>
|
||
|
<% end %>
|
||
|
<div class="groups" id="page-category">
|
||
|
<%= content_tag_for(:label, @module_app_categories, class: "checkbox inline") do |category|%>
|
||
|
<%= check_box_tag("page_part[category][]", category.id, (@part.category.include?(category.id.to_s) rescue false) ) %>
|
||
|
<%= category.title %>
|
||
|
<% end if @module_app_categories %>
|
||
|
<input type="hidden" value>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="control-group input-content checkbox-groups <%= 'hide' if @module_app_tags.blank? %>" id="page-tags-groups" data-for="tag">
|
||
|
<%= f.label :tags, t(:tags), class: "control-label muted" %>
|
||
|
<div class="controls">
|
||
|
<%= content_tag :label, class: "checkbox" do %>
|
||
|
<%= check_box_tag nil, nil, (@part.tag.size == @module_app_tags.size ? true : false), class: "select_all" %> <%= t(:all) %>
|
||
|
<% end %>
|
||
|
<div class="groups" id="page-tags">
|
||
|
<%= content_tag_for(:label, @module_app_tags, class: "checkbox inline") do |tag|%>
|
||
|
<%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id.to_s) rescue false) ) %>
|
||
|
<%= tag.name %>
|
||
|
<% end if @module_app_tags %>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="display-mode">
|
||
|
<%= render @partial if @partial %>
|
||
|
</div>
|
||
|
<div class="control-group input-content widget_count <%= 'hide' if @module_app.blank? || !@module_app.enable_widget_data_count %>">
|
||
|
<%= f.label :widget_data_count, t(:widget_data_count), class: "control-label muted" %>
|
||
|
<div class="controls">
|
||
|
<%= f.select :widget_data_count, options_for_select(@data_count, @part.widget_data_count), {}, class: "input-mini", id: "page_count" %>
|
||
|
</div>
|
||
|
</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>
|
||
|
<% end %>
|
||
|
|
||
|
<script>
|
||
|
$('.btn-group input[type="radio"]').each(function(index, el) {
|
||
|
if($(this).prop('checked')) {
|
||
|
$(this).closest('label').addClass('active');
|
||
|
$("#" + $(this).val()).addClass('active');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$('.btn-group').on(clickEvent, 'label', function(event) {
|
||
|
$(this).find('input').prop('checked', true);
|
||
|
event.preventDefault();
|
||
|
});
|
||
|
|
||
|
$("#public_r_tag").on("change", "#tag_list select", function() {
|
||
|
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" );
|
||
|
});
|
||
|
</script>
|
||
|
<script>
|
||
|
function toggleChecked(status) {
|
||
|
$(".checkbox").each( function() {
|
||
|
$(this).attr("checked",status);
|
||
|
})
|
||
|
}
|
||
|
</script>
|