engine/app/views/locomotive/pages/_editable_elements.html.haml

77 lines
3.6 KiB
Plaintext
Raw Normal View History

%script{ :type => 'text/html', :id => 'editable_elements_edit' }
.nav
{{#each blocks}}
= link_to '{{name}}', '#block-{{index}}', :class => '{{#unless index}}on{{/unless}}'
{{/each}}
.clear
.wrapper
%ul
{{#each blocks}}
%li{ :id => 'block-{{index}}', :class => 'block', :style => 'display: {{#if index}}none{{else}}block{{/if}}' }
%fieldset.inputs
%ol
{{/each}}
%script{ :type => 'text/html', :id => 'editable_text_input' }
%label{ :for => 'page_editable_elements_attributes_{{index}}_content' } {{label}}
= text_area_tag 'page[editable_elements_attributes][{{index}}][content]', '{{content}}', :id => 'page_editable_elements_attributes_{{index}}_content'
{{#if hint}}
%p.inline-hints {{hint}}
{{/if}}
= hidden_field_tag 'page[editable_elements_attributes][{{index}}][id]', '{{id}}', :id => 'page_editable_elements_attributes_{{index}}_id'
%script{ :type => 'text/html', :id => 'editable_file_input' }
%label{ :for => 'page_editable_elements_attributes_{{index}}_content' } {{label}}
= file_field_tag 'page[editable_elements_attributes][{{index}}][source]', :id => 'page_editable_elements_attributes_{{index}}_source'
{{#if hint}}
%p.inline-hints {{hint}}
{{/if}}
= hidden_field_tag 'page[editable_elements_attributes][{{index}}][id]', '{{id}}', :id => 'page_editable_elements_attributes_{{index}}_id'
/ - 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 (name.try(:humanize) || t('locomotive.pages.form.default_block')).gsub('\'', ''), "#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.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