app/views/admin/pages/_form.html.haml in activeadmin-selleo-cms-0.0.11 vs app/views/admin/pages/_form.html.haml in activeadmin-selleo-cms-0.0.12

- old
+ new

@@ -11,24 +11,10 @@ = 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 :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.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 "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.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 @@ -45,23 +31,38 @@ = form.semantic_fields_for :translations do |translated_form| - additional_locale = ActiveadminSelleoCms::Locale.find_by_code(translated_form.object.locale) %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 } + = 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 "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 :javascript function is_link_url(){ if($('input#page_is_link_url').is(':checked')){ - $('div.language-tabs').hide(); + $('.link-url-hide, textarea').closest('li').hide(); $('li#page_link_url_input').show(); }else{ $('li#page_link_url_input').hide(); - $('div.language-tabs').show(); + $('.link-url-hide, textarea').closest('li').show(); } } $(function() { $(".language-tabs").tabs();