Use PictureUploader on Venue
This commit is contained in:
parent
f1f5fc1cd4
commit
2a4de3e869
3 changed files with 6 additions and 10 deletions
|
|
@ -44,7 +44,7 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def venue_params
|
def venue_params
|
||||||
params.require(:venue).permit(:name, :street, :postalcode, :city, :country, :longitude, :latitude, :description, :website, :photo, :lodgings_attributes, :conference_id)
|
params.require(:venue).permit(:name, :street, :postalcode, :city, :country, :longitude, :latitude, :description, :website, :picture, :picture_cache, :lodgings_attributes, :conference_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,7 @@ class Venue < ActiveRecord::Base
|
||||||
validates :name, :street, :city, :country, presence: true
|
validates :name, :street, :city, :country, presence: true
|
||||||
validates :conference_id, presence: true, uniqueness: true
|
validates :conference_id, presence: true, uniqueness: true
|
||||||
|
|
||||||
has_attached_file :photo,
|
mount_uploader :picture, PictureUploader, mount_on: :photo_file_name
|
||||||
styles: { thumb: '100x100>', large: '300x300>' }
|
|
||||||
validates_attachment_content_type :photo,
|
|
||||||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
|
||||||
size: { in: 0..500.kilobytes }
|
|
||||||
|
|
||||||
before_save :send_mail_notification
|
before_save :send_mail_notification
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
= f.inputs :name, :website
|
= f.inputs :name, :website
|
||||||
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
||||||
= f.inputs :street, :postalcode, :city, :country, :latitude, :longitude
|
= f.inputs :street, :postalcode, :city, :country, :latitude, :longitude
|
||||||
- unless @venue.photo.blank?
|
- if @venue.picture?
|
||||||
= image_tag @venue.photo(:thumb)
|
= image_tag @venue.picture.thumb.url
|
||||||
= f.input :photo
|
= f.input :picture
|
||||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||||
|
|
||||||
#commercials-content.tab-pane
|
#commercials-content.tab-pane
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue