2010-08-28 00:00:05 +00:00
|
|
|
- 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) || t('admin.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
|
2011-08-25 16:27:43 +00:00
|
|
|
- elements.each do |el|
|
2010-08-28 00:00:05 +00:00
|
|
|
= f.fields_for 'editable_elements', el, :child_index => el._index do |g|
|
2010-08-31 21:53:30 +00:00
|
|
|
- case el
|
|
|
|
- when EditableLongText
|
|
|
|
= g.input :content, :label => el.slug.humanize, :hint => el.hint, :as => :text, :input_html => { :class => 'html' }
|
|
|
|
- when EditableShortText
|
|
|
|
= g.input :content, :label => el.slug.humanize, :hint => el.hint
|
|
|
|
- when 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('admin.pages.form.delete_file')
|
|
|
|
= g.check_box :remove_source
|