Sha256: 1ec794024d520e566ab1c97386de6826c2902958648ace99abb54f2d0786c688

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

- content_for :site_settings_content do
  = simple_form_for @page_module, url: admin_edit_page_module_subject_path(@page_module) do |f|
    - if @page_module.name == "Tag Focus"
      = hidden_field_tag 'page_module[subject_type]', 'Tag'
      = f.input :subject_id, as: :select, collection: Tag.order(name: :asc)
    - else
      = f.input :subject_headline, as: :string, input_html: {id: 'page-module-subject-select'}
      = hidden_field_tag 'page_module[subject_type]', 'Post'
      = f.hidden_field :subject_id

    - if @page_module.can_set_posts?
      .form-group
        %label.control-label Posts
        .controls
          - # multiselect widget orders selections based on position in the select dropdown, wtf...
          - first = f.object.page_module_posts.by_position.map(&:post)

          - rest = Post.where.not(id: f.object.page_module_posts.by_position.map(&:post_id)).order(headline: :asc).to_a

          = select_tag 'post_ids[]', options_for_select((first + rest).map{|p| [truncate(p.headline, length: 50), p.id] }, f.object.page_module_posts.by_position.map(&:post_id)), multiple: true, class: 'js-post-multiselect page-module-post-ids'

    .clear

    - if @page_module.name == "Tag Focus"
      = f.input :image, label: "Background image"
      - if @page_module.image.present?
        .form-group
          %label
            Image preview

          = link_to @page_module.image.url, class: 'image-preview-wrap page-module-image-preview' do
            = image_tag @page_module.image.url, class: 'image-preview'

    .clear

    = f.button :submit, "Save Settings", class: 'btn btn-primary'
    = link_to "#", class: "pull-right clear-select js-clear-page-module-subject clear-link" do
      %i.fa.fa-times
      Clear Selection

  :coffee
    $ ->
      new PageModuleEditSubjectForm

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
virgo-0.1.7 app/views/virgo/admin/page_modules/edit_subject.haml
virgo-0.1.6 app/views/virgo/admin/page_modules/edit_subject.haml
virgo-0.1.5 app/views/virgo/admin/page_modules/edit_subject.haml
virgo-0.1.4 app/views/virgo/admin/page_modules/edit_subject.haml
virgo-0.1.3 app/views/virgo/admin/page_modules/edit_subject.haml
virgo-0.1.2 app/views/virgo/admin/page_modules/edit_subject.haml
virgo-0.1.1 app/views/virgo/admin/page_modules/edit_subject.haml
virgo-0.1 app/views/virgo/admin/page_modules/edit_subject.haml