Merge 36097f6b8b into 5485fe0e7f
This commit is contained in:
commit
54bc613df1
4 changed files with 13 additions and 3 deletions
|
|
@ -9,6 +9,10 @@ module Admin
|
|||
|
||||
def new
|
||||
@commercial = @conference.commercials.build
|
||||
@commercial_types = (CONFIG['commercial_types'].nil? ? [nil] : CONFIG['commercial_types'].values)
|
||||
if @commercial_types.first.nil?
|
||||
flash[:alert] = "You have to include 'commercial_types' in config.yml, look at config.yml.example for example"
|
||||
end
|
||||
authorize! :create, @conference.commercials.new
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -5,5 +5,9 @@ class Commercial < ActiveRecord::Base
|
|||
|
||||
validates :commercial_id, :commercial_type, presence: true
|
||||
|
||||
validates :commercial_type, inclusion: { in: CONFIG['commercial_types'].values }, allow_blank: true
|
||||
validates :commercial_type, inclusion: { in: :get_types_enum }, allow_blank: true
|
||||
|
||||
def get_types_enum
|
||||
CONFIG['commercial_types'].nil? ? nil : CONFIG['commercial_types'].values
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
= f.input :commercial_type, as: :select, label: 'Conference Promo Media Type', class: 'form-control', collection: CONFIG['commercial_types'].values, include_blank: false, hint: 'This media-item will be used to represent this conference at various places in OSEM.'
|
||||
= f.input :commercial_type, as: :select, label: 'Conference Promo Media Type', class: 'form-control', collection: @commercial_types, include_blank: false, hint: 'This media-item will be used to represent this conference at various places in OSEM.'
|
||||
= f.input :commercial_id, label: 'Conference Promo Media ID', as: :string
|
||||
%p{ class: 'help-block media-type', id: 'youtube-help' } Go to your YouTube video, click on "share" and copy everything behind http://youtu.be/"
|
||||
%p{ class: 'help-block media-type', id: 'slideshare-help', style: 'display:none' } Go to your SlideShare, click on "share" -> "embed" and copy the id
|
||||
|
|
@ -7,3 +7,4 @@
|
|||
%p{ class: 'help-block media-type', id: 'speakerdeck-help', style: 'display:none' } Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id
|
||||
%p{ class: 'help-block media-type', id: 'instagram-help', style: 'display:none' } Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol)
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for @commercial, url: admin_conference_commercials_path(conference_id: @conference.short_title) do |f|
|
||||
= render 'form', f: f
|
||||
- if @commercial_types.first
|
||||
= render 'form', f: f
|
||||
|
||||
= link_to 'Back', admin_conference_commercials_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue