mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Use PictureUploader on Conference
This commit is contained in:
parent
cea9081347
commit
40023044af
8 changed files with 24 additions and 14 deletions
|
|
@ -180,7 +180,7 @@ module Admin
|
||||||
params.require(:conference).permit(:title, :short_title, :description, :timezone,
|
params.require(:conference).permit(:title, :short_title, :description, :timezone,
|
||||||
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
|
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
|
||||||
:tickets_attributes, :event_types_attributes,
|
:tickets_attributes, :event_types_attributes,
|
||||||
:logo, :questions_attributes,
|
:picture, :picture_cache, :questions_attributes,
|
||||||
:question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes,
|
:question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes,
|
||||||
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
||||||
:vpositions_attributes, :use_volunteers, :color,
|
:vpositions_attributes, :use_volunteers, :color,
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,7 @@ class Conference < ActiveRecord::Base
|
||||||
accepts_nested_attributes_for :targets, allow_destroy: true
|
accepts_nested_attributes_for :targets, allow_destroy: true
|
||||||
accepts_nested_attributes_for :campaigns, allow_destroy: true
|
accepts_nested_attributes_for :campaigns, allow_destroy: true
|
||||||
|
|
||||||
has_attached_file :logo,
|
mount_uploader :picture, PictureUploader, mount_on: :logo_file_name
|
||||||
styles: { thumb: '100x100>', large: '300x300>' }
|
|
||||||
|
|
||||||
validates_attachment_content_type :logo,
|
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
|
|
||||||
validates_presence_of :title,
|
validates_presence_of :title,
|
||||||
:short_title,
|
:short_title,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
class ConferenceSerializer < ActiveModel::Serializer
|
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,
|
:difficulty_levels, :event_types, :rooms, :tracks,
|
||||||
:date_range, :revision
|
:date_range, :revision
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,12 @@
|
||||||
= f.input :short_title, :hint => "A short title, e.g. 'oSC14', to be used in URLs"
|
= 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 :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"}
|
= f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"}
|
||||||
- if !@conference.logo.blank?
|
= f.label 'Conference Logo'
|
||||||
= image_tag @conference.logo(:thumb)
|
%br
|
||||||
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
|
- 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.inputs :name => "Scheduling" do
|
||||||
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
|
= 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" }
|
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
.well
|
.well
|
||||||
.row
|
.row
|
||||||
.col-md-4.text-center
|
.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
|
.col-md-6
|
||||||
%h3
|
%h3
|
||||||
= conference.title
|
= conference.title
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
.col-md-8.col-md-offset-2#header
|
.col-md-8.col-md-offset-2#header
|
||||||
.row
|
.row
|
||||||
.col-md-4
|
.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
|
.col-md-8
|
||||||
%h1
|
%h1
|
||||||
= @conference.title
|
= @conference.title
|
||||||
|
|
|
||||||
8
db/migrate/20160427104236_add_pictures.rb
Normal file
8
db/migrate/20160427104236_add_pictures.rb
Normal file
|
|
@ -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
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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|
|
create_table "ahoy_events", force: :cascade do |t|
|
||||||
t.uuid "visit_id", limit: 16
|
t.uuid "visit_id", limit: 16
|
||||||
|
|
@ -101,6 +101,7 @@ ActiveRecord::Schema.define(version: 20160427101444) do
|
||||||
t.text "events_per_week"
|
t.text "events_per_week"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "registration_limit", default: 0
|
t.integer "registration_limit", default: 0
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "conferences_questions", id: false, force: :cascade do |t|
|
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.datetime "updated_at"
|
||||||
t.string "website_link"
|
t.string "website_link"
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "openids", force: :cascade do |t|
|
create_table "openids", force: :cascade do |t|
|
||||||
|
|
@ -366,6 +368,7 @@ ActiveRecord::Schema.define(version: 20160427101444) do
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "sponsorship_levels", force: :cascade do |t|
|
create_table "sponsorship_levels", force: :cascade do |t|
|
||||||
|
|
@ -498,6 +501,7 @@ ActiveRecord::Schema.define(version: 20160427101444) do
|
||||||
t.string "latitude"
|
t.string "latitude"
|
||||||
t.string "longitude"
|
t.string "longitude"
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
|
t.string "picture"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "versions", force: :cascade do |t|
|
create_table "versions", force: :cascade do |t|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue