%
if @section.new_record?
@section.page_id = params[:page_id]
@section.enable_title = true
@section.enable_sub_title = true
@section.enable_button_one = true
@section.enable_button_two = true
@section.enable_short_description = true
@section.enable_long_description = true
end
%>
<%= form_for(@section,
:url => (@section.new_record? ? dhatu.sections_path : dhatu.section_path),
:method => (@section.new_record? ? :post : :put),
:remote => true,
:html => {:id=>"form_section", :class=>"mb-0 form-horizontal"}) do |f| %>
<%= hidden_field_tag :page_id, params[:page_id] %>
<% if @current_user.super_admin? %>
<%= theme_form_field(@section, :name, form_style: "top-bottom", html_options: { placeholder: "", id: "inp_section_name"}) %>
<% end %>
<% if @section.enable_title %>
<%= theme_form_field(@section, :title, form_style: "top-bottom", html_options: { placeholder: ""}) %>
<% end %>
<% if @section.enable_sub_title %>
<%= theme_form_field(@section, :sub_title, required: false, form_style: "top-bottom", html_options: { placeholder: "" }) %>
<% end %>
<% if @section.enable_button_one %>
<%= theme_form_field(@section, :button_one_text, required: false, form_style: "top-bottom", html_options: { placeholder: "" }) %>
<%= theme_form_field(@section, :button_one_link, required: false, form_style: "top-bottom", html_options: { placeholder: "" }) %>
<% end %>
<% if @section.enable_button_one %>
<%= theme_form_field(@section, :button_two_text, required: false, form_style: "top-bottom", html_options: { placeholder: "" }) %>
<%= theme_form_field(@section, :button_two_link, required: false, form_style: "top-bottom", html_options: { placeholder: "" }) %>
<% end %>
<% if @section.enable_short_description %>
<%#= theme_form_field(@section, :short_description, required: false, form_style: "top-bottom", html_options: { placeholder: "" }) %>
<%= theme_form_field(@section, :short_description, required: true, html_options: {type: :textarea, class: "form-control"}, form_style: "top-bottom") %>
<% end %>
<% if @section.enable_long_description %>
<%= theme_form_field(@section, :long_description, required: true, html_options: {type: :textarea, class: "form-control wysihtml5", "data-stylesheet-url": "assets/wysiwyg-color.css"}, form_style: "top-bottom") %>
<% end %>
<% if @current_user.super_admin? %>
<% options = {assoc_collection: Dhatu::Page.select("id, name").order("name ASC").all, editable: true, assoc_display_method: :name, include_blank: true} %>
<%= theme_form_assoc_group(@section, :page_id, label: "Page", form_style: "top-bottom", **options) %>
<% if @current_user.super_admin? %>
<%= theme_form_field(@section, :code, label: "Code", form_style: "top-bottom") %>
<% end %>
<%= theme_form_field(@section, :priority, required: false, form_style: "top-bottom") %>
<% end %>
<% if @current_user.super_admin? %>
<%= clear_tag(30) %>
<%= theme_form_field(@section, :enable_title, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<%= theme_form_field(@section, :enable_sub_title, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<%= theme_form_field(@section, :enable_short_description, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<%= theme_form_field(@section, :enable_long_description, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<%= theme_form_field(@section, :enable_button_one, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<%= theme_form_field(@section, :enable_button_two, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<%= theme_form_field(@section, :enable_cover_image, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<%= theme_form_field(@section, :enable_gallery_images, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
<% end %>
<%= clear_tag(50) %>