diff --git a/app/models/conference.rb b/app/models/conference.rb index 467ab3dd..400e9c64 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -10,7 +10,8 @@ class Conference < ActiveRecord::Base :difficulty_levels_attributes, :use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers, :media_id, :media_type, :color, :description, - :registration_description, :ticket_description + :registration_description, :ticket_description, + :photos_attributes has_paper_trail @@ -46,6 +47,7 @@ class Conference < ActiveRecord::Base accepts_nested_attributes_for :questions, :allow_destroy => true accepts_nested_attributes_for :vdays, :allow_destroy => true accepts_nested_attributes_for :vpositions, :allow_destroy => true + accepts_nested_attributes_for :photos, allow_destroy: true has_attached_file :logo, :styles => {:thumb => "100x100>", :large => "300x300>" } diff --git a/app/views/admin/conference/_photo_fields.html.erb b/app/views/admin/conference/_photo_fields.html.erb new file mode 100644 index 00000000..1f590179 --- /dev/null +++ b/app/views/admin/conference/_photo_fields.html.erb @@ -0,0 +1,7 @@ +
+ <%= f.inputs do %> + <%= f.input :picture %> + <%= f.input :description, :input_html => {:rows => 2 } %> + <%= remove_association_link :photo, f %> + <% end %> +
diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index d920ba1f..90e53ef3 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -17,6 +17,8 @@ = f.input :registration_description, hint: 'This description will appear in registration segment of the splash' = f.input :ticket_description, hint: 'This will appear in the Tickets segment of the splash' + = dynamic_association :photos, "Photos", f + = f.inputs :name => "Media" do - if !@conference.logo.blank? = image_tag @conference.logo(:thumb)