mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
Add a picture format for conference tickets
This commit is contained in:
parent
364be55412
commit
e01d849374
4 changed files with 23 additions and 1 deletions
|
|
@ -80,6 +80,11 @@ class PictureUploader < CarrierWave::Uploader::Base
|
|||
process resize_and_pad: [320, 120, 'white']
|
||||
end
|
||||
|
||||
version :ticket, if: :conference?
|
||||
version :ticket do
|
||||
process resize_and_pad: [120, 70]
|
||||
end
|
||||
|
||||
# Add a white list of extensions which are allowed to be uploaded.
|
||||
# For images you might use something like this:
|
||||
def extension_white_list
|
||||
|
|
@ -95,4 +100,8 @@ class PictureUploader < CarrierWave::Uploader::Base
|
|||
def sponsor?(_picture)
|
||||
object_class_name == 'sponsors'
|
||||
end
|
||||
|
||||
def conference?(_picture)
|
||||
object_class_name == 'conferences'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
9
db/migrate/20171130172334_rebuild_conference_pictures.rb
Normal file
9
db/migrate/20171130172334_rebuild_conference_pictures.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class RebuildConferencePictures < ActiveRecord::Migration
|
||||
def up
|
||||
Conference.all.each do |conference|
|
||||
conference.picture.recreate_versions!
|
||||
end
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20171118113113) do
|
||||
ActiveRecord::Schema.define(version: 20171130172334) do
|
||||
|
||||
create_table "ahoy_events", force: :cascade do |t|
|
||||
t.integer "visit_id"
|
||||
|
|
|
|||
|
|
@ -1704,4 +1704,8 @@ describe Conference do
|
|||
|
||||
it { is_expected.to eq [past_conference1, past_conference2] }
|
||||
end
|
||||
|
||||
it 'should have a picture format for tickets' do
|
||||
expect(create(:conference).picture.ticket.url)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue