diff --git a/app/controllers/admin/conference_controller.rb b/app/controllers/admin/conference_controller.rb index 6cdd4c49..232d0eec 100644 --- a/app/controllers/admin/conference_controller.rb +++ b/app/controllers/admin/conference_controller.rb @@ -180,7 +180,7 @@ module Admin params.require(:conference).permit(:title, :short_title, :description, :timezone, :start_date, :end_date, :rooms_attributes, :tracks_attributes, :tickets_attributes, :event_types_attributes, - :logo, :questions_attributes, + :picture, :picture_cache, :questions_attributes, :question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes, :use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers, :color, diff --git a/app/models/conference.rb b/app/models/conference.rb index 3fbd0a90..f0b73047 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -46,12 +46,7 @@ class Conference < ActiveRecord::Base accepts_nested_attributes_for :targets, allow_destroy: true accepts_nested_attributes_for :campaigns, allow_destroy: true - has_attached_file :logo, - styles: { thumb: '100x100>', large: '300x300>' } - - validates_attachment_content_type :logo, - content_type: [/jpg/, /jpeg/, /png/, /gif/], - size: { in: 0..500.kilobytes } + mount_uploader :picture, PictureUploader, mount_on: :logo_file_name validates_presence_of :title, :short_title, diff --git a/app/serializers/conference_serializer.rb b/app/serializers/conference_serializer.rb index aec0d76e..b2b80c28 100644 --- a/app/serializers/conference_serializer.rb +++ b/app/serializers/conference_serializer.rb @@ -1,5 +1,5 @@ class ConferenceSerializer < ActiveModel::Serializer - attributes :short_title, :title, :description, :start_date, :end_date, :logo, + attributes :short_title, :title, :description, :start_date, :end_date, :picture_url, :difficulty_levels, :event_types, :rooms, :tracks, :date_range, :revision diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index cbbfb3e7..dfc6d72a 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -11,9 +11,12 @@ = f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs" = f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"} - - if !@conference.logo.blank? - = image_tag @conference.logo(:thumb) - = f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page." + = f.label 'Conference Logo' + %br + - if @conference.picture? + = image_tag @conference.picture.thumb.url + = f.input :picture, :label => false, :hint => "This will be displayed on the front page." + = f.hidden_field :picture_cache = f.inputs :name => "Scheduling" do = f.input :timezone, :as => :time_zone, :hint => "The conference time zone" = f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" } diff --git a/app/views/conference/_conference_details.html.haml b/app/views/conference/_conference_details.html.haml index d3c07658..f8e17794 100644 --- a/app/views/conference/_conference_details.html.haml +++ b/app/views/conference/_conference_details.html.haml @@ -3,7 +3,7 @@ .well .row .col-md-4.text-center - = image_tag(conference.logo(:original), class: 'img-responsive') if conference.logo? + = image_tag(conference.picture_url, class: 'img-responsive') if conference.picture? .col-md-6 %h3 = conference.title diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 63920eb6..071f8f7a 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -9,7 +9,7 @@ .col-md-8.col-md-offset-2#header .row .col-md-4 - = image_tag(@conference.logo(:original), class: 'img-responsive img-center', id: 'splash-logo') if @conference.logo? + = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? .col-md-8 %h1 = @conference.title diff --git a/db/migrate/20160427104236_add_pictures.rb b/db/migrate/20160427104236_add_pictures.rb new file mode 100644 index 00000000..5a56da9c --- /dev/null +++ b/db/migrate/20160427104236_add_pictures.rb @@ -0,0 +1,8 @@ +class AddPictures < ActiveRecord::Migration + def change + add_column :conferences, :picture, :string + add_column :lodgings, :picture, :string + add_column :sponsors, :picture, :string + add_column :venues, :picture, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 3258f8e2..00e93609 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160427101444) do +ActiveRecord::Schema.define(version: 20160427104236) do create_table "ahoy_events", force: :cascade do |t| t.uuid "visit_id", limit: 16 @@ -101,6 +101,7 @@ ActiveRecord::Schema.define(version: 20160427101444) do t.text "events_per_week" t.text "description" t.integer "registration_limit", default: 0 + t.string "picture" end create_table "conferences_questions", id: false, force: :cascade do |t| @@ -246,6 +247,7 @@ ActiveRecord::Schema.define(version: 20160427101444) do t.datetime "updated_at" t.string "website_link" t.integer "conference_id" + t.string "picture" end create_table "openids", force: :cascade do |t| @@ -366,6 +368,7 @@ ActiveRecord::Schema.define(version: 20160427101444) do t.integer "conference_id" t.datetime "created_at" t.datetime "updated_at" + t.string "picture" end create_table "sponsorship_levels", force: :cascade do |t| @@ -498,6 +501,7 @@ ActiveRecord::Schema.define(version: 20160427101444) do t.string "latitude" t.string "longitude" t.integer "conference_id" + t.string "picture" end create_table "versions", force: :cascade do |t|