app/views/admin/pages/_form.html.haml in activeadmin-selleo-cms-0.0.14 vs app/views/admin/pages/_form.html.haml in activeadmin-selleo-cms-0.0.16

- old
+ new

@@ -5,16 +5,20 @@ - current_locale = ActiveadminSelleoCms::Locale.find_by_code(I18n.locale) - @page.initialize_missing_sections - @section_forms = [] = form.inputs "General options" do - = form.input :layout, collection: ActiveadminSelleoCms::Layout.all, include_blank: false, hint: "The form will reload on change" + = form.input :layout_name, collection: ActiveadminSelleoCms::Layout.all.sort, include_blank: false, hint: "The form will reload on change" = form.input :parent_id, as: :select, collection: nested_set_options(ActiveadminSelleoCms::Page, @page) {|i| "#{'-' * i.level} #{i.title}" } = form.input :is_published, as: :boolean, input_html: { checked: @page.published_at.present? } + = form.input :redirect_to_first_sub_page, as: :boolean = form.input :is_link_url, as: :boolean, input_html: { checked: @page.link_url.present? } = form.input :link_url, hint: "Enter remote URL including the http part at the beginning" + - form.object.settings.keys.each do |key| + = form.input key.to_sym, as: determine_field_type(form.object.send(key)) + = form.semantic_fields_for :sections do |section_form| - if @page.section_names.include? section_form.object.name - @section_forms << section_form = section_form.input :name, as: :hidden, label: false - else @@ -35,25 +39,17 @@ %div{id: "lang-#{additional_locale.code}", style: "#{'display:none;' if additional_locale.code == current_locale.code}"} = render partial: 'translated_fields', locals: { locale: additional_locale, form: translated_form } - else = "" - = form.inputs "Page icon", for: [:icon, form.object.icon || ActiveadminSelleoCms::Icon.new] do |icon_form| - = icon_form.input :data, label: "Icon", hint: (form.object.icon ? icon_form.template.image_tag(form.object.icon_url) : "No icon uploaded yet" ) + - unless @page.new_record? + = form.inputs "Page icon", for: [:icon, form.object.icon || ActiveadminSelleoCms::Icon.new] do |icon_form| + = icon_form.input :data, label: "Icon", hint: (form.object.icon ? icon_form.template.image_tag(form.object.icon_url) : "No icon uploaded yet" ) - = form.inputs "Header image", for: [:header_image, form.object.header_image || ActiveadminSelleoCms::HeaderImage.new] do |header_image_form| - = header_image_form.input :data, label: "Header image", hint: (form.object.header_image ? header_image_form.template.image_tag(form.object.header_image_url) : "No header image uploaded yet" ) + = form.inputs "Header image", for: [:header_image, form.object.header_image || ActiveadminSelleoCms::HeaderImage.new] do |header_image_form| + = header_image_form.input :data, label: "Header image", hint: (form.object.header_image ? header_image_form.template.image_tag(form.object.header_image_url) : "No header image uploaded yet" ) - = form.inputs "Attachments", for: [:attachments, ActiveadminSelleoCms::Attachment.new] do |attachment_form| - = attachment_form.input :data, label: "Attachment", input_html: { multiple: true, name: "page[attachments_attributes][][data]" } - - form.object.attachments.each do |attachment| - %li{"data-attachment-id" => attachment.id} - %label File - = attachment.data_file_name - = link_to_function "Delete", "delete_asset(#{@page.id}, #{attachment.id})" - - = form.actions do = form.action :submit %li.cancel = link_to I18n.t('active_admin.cancel'), admin_pages_path @@ -87,10 +83,10 @@ $('input#page_is_link_url').change(function(){ is_link_url(); }); - $('select#page_layout').change(function(){ + $('select#page_layout_name').change(function(){ $(this).closest('form').find('input[name="_change_layout"]').attr('value','1'); $(this).closest('form').submit(); }); });