35 lines
2.0 KiB
Plaintext
35 lines
2.0 KiB
Plaintext
- grouped_editable_elements = @page.editable_elements_grouped_by_blocks
|
|
|
|
= semantic_fields_for(@page) do |f|
|
|
- unless grouped_editable_elements.empty?
|
|
#editable-elements
|
|
.nav
|
|
- grouped_editable_elements.keys.each_with_index do |name, index|
|
|
= link_to content_tag(:span, name.try(:humanize).gsub('\'', '') || t('locomotive.pages.form.default_block')), "#block-#{index}", :id => "block-nav-#{index}", :class => "#{'on' if index == 0}"
|
|
.clear
|
|
|
|
.wrapper
|
|
%ul{ :id => "blocks" }
|
|
- grouped_editable_elements.keys.each_with_index do |name, index|
|
|
- elements = grouped_editable_elements[name]
|
|
%li{ :id => "block-#{index}", :class => 'block', :style => "display: #{index == 0 ? 'block' : 'none' }" }
|
|
%fieldset.inputs
|
|
%ol
|
|
- elements.each do |el|
|
|
= f.fields_for 'editable_elements', el, :child_index => el._index do |g|
|
|
- case el
|
|
- when ::Locomotive::EditableLongText
|
|
= g.input :content, :label => el.slug.humanize, :hint => el.hint, :as => :text, :input_html => { :class => 'html' }
|
|
- when ::Locomotive::EditableShortText
|
|
= g.input :content, :label => el.slug.humanize, :hint => el.hint
|
|
- when ::Locomotive::EditableFile
|
|
= g.custom_input :source, :label => el.slug.humanize, :hint => el.hint, :css => 'file' do
|
|
= g.file_field :source
|
|
- if el.source?
|
|
%p.remove
|
|
%strong
|
|
= link_to File.basename(el.source.url), el.source.url
|
|
%span
|
|
/
|
|
!= t('locomotive.pages.form.delete_file')
|
|
= g.check_box :remove_source |