Extracting Photos form Conference edit form

close #384
This commit is contained in:
Chrisbr 2014-08-12 08:38:51 +02:00
parent a8b94c13f3
commit 22cc5e4f14
12 changed files with 190 additions and 13 deletions

View file

@ -27,6 +27,4 @@
= f.input :sponsor_description, hint: markdown_hint("This will appear in the sponsor segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
= f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers'
= f.input :lodging_description, hint: markdown_hint("This will appear in the lodging segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
= dynamic_association :photos, "Photos", f
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -1,10 +0,0 @@
<div class="nested-fields">
<%= f.inputs do %>
<%= image_tag(f.object.picture(:thumb)) unless f.object.picture.blank? %>
<%= f.input :picture, hint: 'This photo will appear in the gallery of the splash
so please give photos of banner sizes' %>
<%= f.input :description, :input_html => {:rows => 2 }, hint: 'This description will appear
at the bottom of each photo' %>
<%= remove_association_link :photo, f %>
<% end %>
</div>

View file

@ -0,0 +1,7 @@
= f.inputs do
- if !f.object.errors
= image_tag(f.object.picture(:thumb)) unless f.object.picture.blank?
= f.input :picture, hint: 'This photo will appear in the gallery of the splash so please give photos of banner sizes.'
= f.input :description, :input_html => {:rows => 2 }, hint: 'This description will appear at the bottom of each photo.'
.actions
= f.button 'Save Photo', :class => 'btn btn-primary'

View file

@ -0,0 +1,6 @@
%h1 Editing Photo
= semantic_form_for @photo, url: admin_conference_photo_path(conference_id: @conference.short_title, id: @photo.id) do |f|
= render 'form', f: f
= link_to 'Back', admin_conference_photos_path

View file

@ -0,0 +1,22 @@
%h1 Photos
%p.text-muted
Photo's will appear in the gallery of the conference splash page.
- @photos.each_slice(3) do |slice|
.row.row-flex.row-flex-wrap
- slice.each do |photo|
.col-md-4
.thumbnail.flex-col
%h3.text-center
= photo.picture_file_name
= image_tag(photo.picture(:large), class: 'img-responsive', title: photo.description)
.caption.flex-grow
.caption
= link_to edit_admin_conference_photo_path(@conference.short_title, photo.id), class: 'btn btn-primary' do
%i.fa.fa-pencil-square-o
Edit
= link_to admin_conference_photo_path(@conference.short_title, photo.id), method: :delete, class: 'btn btn-danger' do
%i.fa.fa-times-circle
Delete
.row{'style'=>'padding-top: 10px;'}
.col-md-12
= link_to 'New Photo', new_admin_conference_photo_path, class: 'btn btn-primary'

View file

@ -0,0 +1,6 @@
%h1 New Photo
= semantic_form_for @photo, url: admin_conference_photos_path(conference_id: @conference.short_title) do |f|
= render 'form', f: f
= link_to 'Back', admin_conference_photos_path