From 3e97200a29413732323eb76ad62a4b7cbdb025aa Mon Sep 17 00:00:00 2001 From: nasia Date: Tue, 27 Jun 2017 17:23:37 +0300 Subject: [PATCH] Add logo for booths --- app/controllers/admin/booths_controller.rb | 2 +- app/controllers/admin/call_for_booths_controller.rb | 1 - app/models/booth.rb | 2 ++ app/views/admin/booths/_form.html.haml | 5 +++-- app/views/admin/booths/show.html.haml | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/booths_controller.rb b/app/controllers/admin/booths_controller.rb index 86562ba8..9ecab953 100644 --- a/app/controllers/admin/booths_controller.rb +++ b/app/controllers/admin/booths_controller.rb @@ -84,7 +84,7 @@ module Admin end def booth_params - params.require(:booth).permit(:title, :description, :reasoning, :state, :logo_link, :conference_id) + params.require(:booth).permit(:title, :description, :reasoning, :state, :picture, :conference_id) end end end diff --git a/app/controllers/admin/call_for_booths_controller.rb b/app/controllers/admin/call_for_booths_controller.rb index de537742..27ed8c2a 100644 --- a/app/controllers/admin/call_for_booths_controller.rb +++ b/app/controllers/admin/call_for_booths_controller.rb @@ -6,7 +6,6 @@ module Admin def show end - def new @call_for_booths = CallForBooth.new(conference: @conference) end diff --git a/app/models/booth.rb b/app/models/booth.rb index fe11b1a6..a2b72395 100644 --- a/app/models/booth.rb +++ b/app/models/booth.rb @@ -23,6 +23,8 @@ class Booth < ActiveRecord::Base presence: true + mount_uploader :picture, PictureUploader, mount_on: :logo_link + state_machine initial: :submitted do state :submitted state :withdrawn diff --git a/app/views/admin/booths/_form.html.haml b/app/views/admin/booths/_form.html.haml index 9aa0f74a..e8ed896f 100644 --- a/app/views/admin/booths/_form.html.haml +++ b/app/views/admin/booths/_form.html.haml @@ -9,8 +9,9 @@ = f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true = f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true = responsibles_selector_input f - = f.input :logo_link, as: :string, required: true - + = image_tag f.object.picture.thumb.url if f.object.picture? + = f.input :picture + %p.text-right - if @booth.new_record? = f.submit 'Create Booth Request', class: 'btn btn-success' diff --git a/app/views/admin/booths/show.html.haml b/app/views/admin/booths/show.html.haml index e4b305b3..8f87660e 100644 --- a/app/views/admin/booths/show.html.haml +++ b/app/views/admin/booths/show.html.haml @@ -1,7 +1,7 @@ .row .col-md-12 %h3 - = image_tag(@booth.gravatar_url(size: '48')) + = image_tag(@booth.picture.thumb.url, size: '20%', alt: '') = @booth.title .btn-group.pull-right = link_to 'Edit', edit_admin_conference_booth_path(@conference.short_title, @booth), class: 'btn btn-mini btn-primary'