Sha256: 9cdf5b867c07ba44cb27fca7e48db90f9d81576efea838c97ae2c922e888ee79

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

h1
  = @page.title
  .right= link_to "Live preview", @page.url, class:"btn", target: '_blank', 'data-skip-pjax' => true

= simple_form_for @page, html: {:multipart => true} do |f|
  = f.error_notification
  = f.input :title

  = render "url_field", f: f

  = f.input :in_menu, label: false, inline_label: "Display in main menu?"

  = field_set_tag "SEO" do
    .nested-fields
      = f.simple_fields_for :meta_seo, OpenStruct.new(@page.seo) do |seo|
        = seo.input :title, label: "Browser titlebar", required: false
        = seo.input :description, as: :text, required: false
        - for key in  seo.object.methods(nil).grep(/[^=]$/) - [:title, :description]
          = seo.input key, required: false


  
  - for part in @page.parts.sort_by(&:position) 
    = f.simple_fields_for :parts, part do |g|

      = field_set_tag part.identifier.titleize do
        = g.error :base, class: "alert-error"

        / sort puts nil at the end, in the case of new parts
        - for subpart in part.subparts.sort{|a,b| a.position && b.position ? a.position <=> b.position : a.position ? -1 : 1 }
          = g.simple_fields_for :subparts, subpart do |y|

            = render "subpart_fields", f: y, subpart: subpart
        
        - if part.repeatable?
          .links
            / the "links" class is important for the cocoon gem
            = link_to_add_association "Add another #{part.identifier.singularize.titleize}", g, :subparts, :render_options => {:locals => {:subpart => part.new_subpart }}, class: "btn btn-block"

  .form-actions
    = f.button :submit, "Save", class:"btn-primary"
    = link_to "Cancel", dashboard_path, class:"btn"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cardboard_cms-0.1.8 app/views/cardboard/pages/edit.html.slim
cardboard_cms-0.1.6 app/views/cardboard/pages/edit.html.slim
cardboard_cms-0.1.4 app/views/cardboard/pages/edit.html.slim