parent
850beb72e1
commit
2a731e8350
31 changed files with 491 additions and 57 deletions
|
|
@ -82,12 +82,8 @@ $(function () {
|
||||||
5)
|
5)
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#event_media_type").change(function () {
|
|
||||||
$(".media-type").hide();
|
|
||||||
$('#' + $(this).val().toLowerCase() + '-help').show();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#conference_media_type").change(function () {
|
$("#commercial_commercial_type").change(function () {
|
||||||
$(".media-type").hide();
|
$(".media-type").hide();
|
||||||
$('#' + $(this).val().toLowerCase() + '-help').show();
|
$('#' + $(this).val().toLowerCase() + '-help').show();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
57
app/controllers/admin/commercials_controller.rb
Normal file
57
app/controllers/admin/commercials_controller.rb
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
class Admin::CommercialsController < ApplicationController
|
||||||
|
before_action :set_conference
|
||||||
|
before_action :set_commercial, only: [:edit, :update, :destroy]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@commercials = @conference.commercials
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@commercial = @conference.commercials.build
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@commercial = @conference.commercials.build(commercial_params)
|
||||||
|
|
||||||
|
if @commercial.save
|
||||||
|
redirect_to admin_conference_commercials_path,
|
||||||
|
notice: 'Commercial was successfully created.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @commercial.update(commercial_params)
|
||||||
|
redirect_to admin_conference_commercials_path,
|
||||||
|
notice: 'Commercial was successfully updated.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||||
|
render :edit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@commercial.destroy
|
||||||
|
redirect_to admin_conference_commercials_path, notice: 'Commercial was successfully destroyed.'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_commercial
|
||||||
|
@commercial = @conference.commercials.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_conference
|
||||||
|
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def commercial_params
|
||||||
|
#params.require(:commercial).permit(:commercial_id, :commercial_type)
|
||||||
|
params[:commercial]
|
||||||
|
end
|
||||||
|
end
|
||||||
59
app/controllers/commercials_controller.rb
Normal file
59
app/controllers/commercials_controller.rb
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
class CommercialsController < ApplicationController
|
||||||
|
before_action :set_conference
|
||||||
|
before_action :set_event
|
||||||
|
before_action :set_commercial, only: [:edit, :update, :destroy]
|
||||||
|
|
||||||
|
def new
|
||||||
|
@commercial = @event.commercials.build
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@commercial = @event.commercials.build(commercial_params)
|
||||||
|
|
||||||
|
if @commercial.save
|
||||||
|
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id),
|
||||||
|
notice: 'Commercial was successfully created.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @commercial.update(commercial_params)
|
||||||
|
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id),
|
||||||
|
notice: 'Commercial was successfully updated.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||||
|
render :edit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@commercial.destroy
|
||||||
|
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id),
|
||||||
|
notice: 'Commercial was successfully destroyed.'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_commercial
|
||||||
|
@commercial = @event.commercials.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_conference
|
||||||
|
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_event
|
||||||
|
@event = @conference.events.find(params[:proposal_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def commercial_params
|
||||||
|
#params.require(:commercial).permit(:commercial_id, :commercial_type)
|
||||||
|
params[:commercial]
|
||||||
|
end
|
||||||
|
end
|
||||||
9
app/models/commercial.rb
Normal file
9
app/models/commercial.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
class Commercial < ActiveRecord::Base
|
||||||
|
belongs_to :commercialable, polymorphic: true
|
||||||
|
|
||||||
|
attr_accessible :commercial_id, :commercial_type
|
||||||
|
|
||||||
|
validates :commercial_id, :commercial_type, presence: true
|
||||||
|
|
||||||
|
validates :commercial_type, inclusion: { in: CONFIG['commercial_types'].values }, allow_blank: true
|
||||||
|
end
|
||||||
|
|
@ -12,7 +12,7 @@ class Conference < ActiveRecord::Base
|
||||||
:registration_start_date, :registration_end_date, :logo, :questions_attributes,
|
:registration_start_date, :registration_end_date, :logo, :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, :media_id, :media_type, :color,
|
:vpositions_attributes, :use_volunteers, :color,
|
||||||
:description, :registration_description, :ticket_description,
|
:description, :registration_description, :ticket_description,
|
||||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||||
:sponsor_description, :sponsor_email, :lodging_description,
|
:sponsor_description, :sponsor_email, :lodging_description,
|
||||||
|
|
@ -48,6 +48,7 @@ class Conference < ActiveRecord::Base
|
||||||
has_many :photos, dependent: :destroy
|
has_many :photos, dependent: :destroy
|
||||||
has_many :targets, dependent: :destroy
|
has_many :targets, dependent: :destroy
|
||||||
has_many :campaigns, dependent: :destroy
|
has_many :campaigns, dependent: :destroy
|
||||||
|
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||||
belongs_to :venue
|
belongs_to :venue
|
||||||
|
|
||||||
accepts_nested_attributes_for :rooms, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
|
accepts_nested_attributes_for :rooms, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
|
||||||
|
|
@ -94,12 +95,6 @@ class Conference < ActiveRecord::Base
|
||||||
before_create :create_email_settings
|
before_create :create_email_settings
|
||||||
before_create :add_color
|
before_create :add_color
|
||||||
|
|
||||||
def self.media_types
|
|
||||||
media_types = { youtube: 'YouTube', slideshare: 'SlideShare', flickr: 'Flickr', vimeo: 'Vimeo',
|
|
||||||
speakerdeck: 'Speakerdeck', instagram: 'Instagram' }
|
|
||||||
return media_types
|
|
||||||
end
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Checks if the user is registered to the conference
|
# Checks if the user is registered to the conference
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Event < ActiveRecord::Base
|
||||||
include ActiveRecord::Transitions
|
include ActiveRecord::Transitions
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
attr_accessible :title, :subtitle, :abstract, :description, :event_type_id, :users_attributes,
|
attr_accessible :title, :subtitle, :abstract, :description, :event_type_id, :users_attributes,
|
||||||
:user, :proposal_additional_speakers, :track_id, :media_id, :media_type,
|
:user, :proposal_additional_speakers, :track_id,
|
||||||
:require_registration, :difficulty_level_id
|
:require_registration, :difficulty_level_id
|
||||||
|
|
||||||
acts_as_commentable
|
acts_as_commentable
|
||||||
|
|
@ -15,6 +15,7 @@ class Event < ActiveRecord::Base
|
||||||
has_many :speakers, through: :event_users, source: :user
|
has_many :speakers, through: :event_users, source: :user
|
||||||
has_many :votes
|
has_many :votes
|
||||||
has_many :voters, through: :votes, source: :user
|
has_many :voters, through: :votes, source: :user
|
||||||
|
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||||
belongs_to :event_type
|
belongs_to :event_type
|
||||||
|
|
||||||
has_and_belongs_to_many :registrations
|
has_and_belongs_to_many :registrations
|
||||||
|
|
@ -36,7 +37,6 @@ class Event < ActiveRecord::Base
|
||||||
validates :abstract, presence: true
|
validates :abstract, presence: true
|
||||||
validates :event_type, presence: true
|
validates :event_type, presence: true
|
||||||
validates :conference, presence: true
|
validates :conference, presence: true
|
||||||
validates :media_type, inclusion: { in: Conference.media_types.values }, allow_blank: true
|
|
||||||
|
|
||||||
scope :confirmed, -> { where(state: 'confirmed') }
|
scope :confirmed, -> { where(state: 'confirmed') }
|
||||||
|
|
||||||
|
|
|
||||||
9
app/views/admin/commercials/_form.html.haml
Normal file
9
app/views/admin/commercials/_form.html.haml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
= 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_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
|
||||||
|
%p{ class: 'help-block media-type', id: 'flickr-help', style: 'display:none' } Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
|
||||||
|
%p{ class: 'help-block media-type', id: 'vimeo-help', style: 'display:none' } Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
|
||||||
|
%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' }
|
||||||
8
app/views/admin/commercials/edit.html.haml
Normal file
8
app/views/admin/commercials/edit.html.haml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
%h1 Editing Commercial
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-8
|
||||||
|
= semantic_form_for @commercial, url: admin_conference_commercial_path(conference_id: @conference.short_title, id: @commercial.id) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', admin_conference_commercials_path
|
||||||
21
app/views/admin/commercials/index.html.haml
Normal file
21
app/views/admin/commercials/index.html.haml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
%h1 Commercials
|
||||||
|
|
||||||
|
%p.text-muted
|
||||||
|
You can add commercials for your conference. These commercials will be displayed on the event detail site if
|
||||||
|
the event submitter doesn't add a commercial. Currently supported commercial types are YouTube, Vimeo, Instagram
|
||||||
|
Flickr, Speakerdeck and SlideShare.
|
||||||
|
|
||||||
|
- @commercials.each_slice(3) do |slice|
|
||||||
|
.row
|
||||||
|
- slice.each do |commercial|
|
||||||
|
.col-md-4
|
||||||
|
.thumbnail
|
||||||
|
%h3.text-center
|
||||||
|
= commercial.commercial_type
|
||||||
|
.flexvideo
|
||||||
|
= render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id }
|
||||||
|
= link_to 'Edit', edit_admin_conference_commercial_path(@conference.short_title, commercial.id), class: 'btn btn-primary'
|
||||||
|
= link_to 'Delete', admin_conference_commercial_path(@conference.short_title, commercial.id),
|
||||||
|
method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger'
|
||||||
|
%br
|
||||||
|
= link_to 'New Commercial', new_admin_conference_commercial_path, class: 'btn btn-primary'
|
||||||
7
app/views/admin/commercials/new.html.haml
Normal file
7
app/views/admin/commercials/new.html.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
%h1 New Commercial
|
||||||
|
.row
|
||||||
|
.col-md-8
|
||||||
|
= semantic_form_for @commercial, url: admin_conference_commercials_path(conference_id: @conference.short_title) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', admin_conference_commercials_path
|
||||||
|
|
@ -32,12 +32,4 @@
|
||||||
- if !@conference.logo.blank?
|
- if !@conference.logo.blank?
|
||||||
= image_tag @conference.logo(:thumb)
|
= image_tag @conference.logo(:thumb)
|
||||||
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
|
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
|
||||||
= f.input :media_type, :as => :select, :label => "Conference Promo Media Type", :class=>"form-control", :collection => Conference.media_types.values, :include_blank => false, :hint => "This media-item will be used to represent this conference at various places in OSEM."
|
|
||||||
= f.input :media_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
|
|
||||||
%p{:class => "help-block media-type", :id => "flickr-help", :style => "display:none"} Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
|
|
||||||
%p{:class => "help-block media-type", :id => "vimeo-help", :style => "display:none"} Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
|
|
||||||
%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"}
|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||||
|
|
|
||||||
9
app/views/commercials/_form.html.haml
Normal file
9
app/views/commercials/_form.html.haml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
= 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_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
|
||||||
|
%p{ class: 'help-block media-type', id: 'flickr-help', style: 'display:none' } Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
|
||||||
|
%p{ class: 'help-block media-type', id: 'vimeo-help', style: 'display:none' } Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
|
||||||
|
%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' }
|
||||||
8
app/views/commercials/edit.html.haml
Normal file
8
app/views/commercials/edit.html.haml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
%h1 Editing Commercial
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-8
|
||||||
|
= semantic_form_for @commercial, url: conference_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event.id, id: @commercial.id) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id)
|
||||||
7
app/views/commercials/new.html.haml
Normal file
7
app/views/commercials/new.html.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
%h1 New Commercial
|
||||||
|
.row
|
||||||
|
.col-md-8
|
||||||
|
= semantic_form_for @commercial, url: conference_proposal_commercials_path(conference_id: @conference.short_title, proposal_id: @event.id) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id)
|
||||||
|
|
@ -19,6 +19,11 @@
|
||||||
= link_to(new_admin_conference_path) do
|
= link_to(new_admin_conference_path) do
|
||||||
%span.glyphicon.glyphicon-plus
|
%span.glyphicon.glyphicon-plus
|
||||||
New Conference
|
New Conference
|
||||||
|
%hr
|
||||||
|
%li{:class=> active_nav_li(admin_conference_commercials_path(@conference.short_title))}
|
||||||
|
= link_to(admin_conference_commercials_path(@conference.short_title)) do
|
||||||
|
%span.fa.fa-picture-o
|
||||||
|
Commercials
|
||||||
%hr
|
%hr
|
||||||
%li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"}
|
%li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"}
|
||||||
= link_to(admin_conference_path(@conference.short_title)) do
|
= link_to(admin_conference_path(@conference.short_title)) do
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,34 @@
|
||||||
%ul.nav.nav-tabs
|
%ul.nav.nav-tabs
|
||||||
%li.active
|
%li.active
|
||||||
= link_to "Proposal", "#proposal-content", "data-toggle"=>"tab"
|
= link_to "Proposal", "#proposal-content", "data-toggle"=>"tab"
|
||||||
|
%li
|
||||||
|
= link_to 'Commercials', '#commercials-content', 'data-toggle'=>'tab'
|
||||||
%li
|
%li
|
||||||
= link_to "Attachments", "#attachment-content", "data-toggle"=>"tab"
|
= link_to "Attachments", "#attachment-content", "data-toggle"=>"tab"
|
||||||
.tab-content
|
.tab-content
|
||||||
#proposal-content.tab-pane.active
|
#proposal-content.tab-pane.active
|
||||||
= render 'proposal/proposal_form'
|
= render 'proposal/proposal_form'
|
||||||
|
#commercials-content.tab-pane
|
||||||
|
%p.text-muted
|
||||||
|
You can add commercials for your event. These commercials will be displayed on the event detail site.
|
||||||
|
If you don't add a commercial, the conference commercial will be displayed!
|
||||||
|
We currently support the following commercial types: YouTube, Vimeo, Instagram, Flickr, Speakerdeck and SlideShare.
|
||||||
|
|
||||||
|
- @event.commercials.each_slice(3) do |slice|
|
||||||
|
.row
|
||||||
|
- slice.each do |commercial|
|
||||||
|
.col-md-4
|
||||||
|
.thumbnail
|
||||||
|
%h3.text-center
|
||||||
|
= commercial.commercial_type
|
||||||
|
.flexvideo
|
||||||
|
= render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id }
|
||||||
|
= link_to 'Edit', edit_conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id), class: 'btn btn-primary'
|
||||||
|
= link_to 'Delete', conference_proposal_commercial_path(@conference.short_title, @event.id, commercial.id),
|
||||||
|
:method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'
|
||||||
|
%hr
|
||||||
|
= link_to 'Add Commercial', new_conference_proposal_commercial_path(@conference.short_title, @event.id), class: 'btn btn-primary'
|
||||||
|
|
||||||
#attachment-content.tab-pane
|
#attachment-content.tab-pane
|
||||||
= form_for EventAttachment.new, :url => conference_proposal_event_attachment_index_path(@conference.short_title, @event), :html => { :multipart => true, :id => "fileupload" } do |f|
|
= form_for EventAttachment.new, :url => conference_proposal_event_attachment_index_path(@conference.short_title, @event), :html => { :multipart => true, :id => "fileupload" } do |f|
|
||||||
%table.table.table-striped
|
%table.table.table-striped
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,6 @@
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
= f.input :description, :input_html => {:rows => 5, :class=> "span11"}, :hint => "This will only be shown to organizers, not to attendees."
|
= f.input :description, :input_html => {:rows => 5, :class=> "span11"}, :hint => "This will only be shown to organizers, not to attendees."
|
||||||
= f.input :media_type, :as => :select, :label => "Media Type", :collection => Conference.media_types.values, :include_blank => false
|
|
||||||
%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
|
|
||||||
%p{:class => "help-block media-type", :id => "flickr-help", :style => "display:none"} Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
|
|
||||||
%p{:class => "help-block media-type", :id => "vimeo-help", :style => "display:none"} Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
|
|
||||||
%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.input :media_id, :label => "Media ID", :as => :string
|
|
||||||
|
|
||||||
%section#information
|
%section#information
|
||||||
- if current_user.name.blank? || current_user.biography.blank?
|
- if current_user.name.blank? || current_user.biography.blank?
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,16 @@
|
||||||
.col-md-9
|
.col-md-9
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
- if @event.media_id.blank?
|
- if @event.commercials.empty?
|
||||||
%h5.text-warning
|
%h5.text-warning
|
||||||
No video of the event yet, sorry!
|
No video of the event yet, sorry!
|
||||||
- unless @conference.media_id.blank?
|
- unless @conference.commercials.empty?
|
||||||
Meanwhile...
|
Meanwhile...
|
||||||
- unless @conference.media_id.blank?
|
- unless @conference.commercials.empty?
|
||||||
.flexvideo
|
= render partial: 'shared/media_items', locals: { commercials: @conference.commercials }
|
||||||
= render partial: "shared/media_item", locals: {media_type: @conference.media_type, media_id: @conference.media_id}
|
|
||||||
- else
|
- else
|
||||||
.flexvideo
|
%p
|
||||||
= render partial: "shared/media_item", locals: {media_type: @event.media_type, media_id: @event.media_id}
|
= render partial: 'shared/media_items', locals: { commercials: @event.commercials }
|
||||||
.row
|
.row
|
||||||
.speakerinfo
|
.speakerinfo
|
||||||
.col-md-8
|
.col-md-8
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
-if media_type == Conference.media_types[:slideshare]
|
-if commercial_type == CONFIG['commercial_types']['slideshare']
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.slideshare.net/slideshow/embed_code/#{media_id}"}
|
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.slideshare.net/slideshow/embed_code/#{commercial_id}"}
|
||||||
-elsif media_type == Conference.media_types[:flickr]
|
-elsif commercial_type == CONFIG['commercial_types']['flickr']
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "flic.kr/p/#{media_id}/player/268a054da2"}
|
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "flic.kr/p/#{commercial_id}/player/268a054da2"}
|
||||||
-elsif media_type == Conference.media_types[:vimeo]
|
-elsif commercial_type == CONFIG['commercial_types']['vimeo']
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//player.vimeo.com/video/#{media_id}"}
|
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//player.vimeo.com/video/#{commercial_id}"}
|
||||||
-elsif media_type == Conference.media_types[:speakerdeck]
|
-elsif commercial_type == CONFIG['commercial_types']['speakerdeck']
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//speakerdeck.com/player/#{media_id}?"}
|
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//speakerdeck.com/player/#{commercial_id}?"}
|
||||||
-elsif media_type == Conference.media_types[:instagram]
|
-elsif commercial_type == CONFIG['commercial_types']['instagram']
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :scrolling =>"no", :allowtransparency=>"true", :src=> "//instagram.com/p/#{media_id}/embed/"}
|
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :scrolling =>"no", :allowtransparency=>"true", :src=> "//instagram.com/p/#{commercial_id}/embed/"}
|
||||||
-else
|
-else
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.youtube.com/embed/#{media_id}?rel=0"}
|
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.youtube.com/embed/#{commercial_id}?rel=0"}
|
||||||
25
app/views/shared/_media_items.html.haml
Normal file
25
app/views/shared/_media_items.html.haml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
- unless commercials.empty?
|
||||||
|
- if commercials.length == 1
|
||||||
|
.flexvideo
|
||||||
|
= render partial: 'shared/media_item', locals: { commercial_type: commercials.first.commercial_type, commercial_id: commercials.first.commercial_id }
|
||||||
|
- else
|
||||||
|
%ul.nav.nav-tabs{ 'role'=>'tablist' }
|
||||||
|
- commercials.each_with_index do |commercial, index|
|
||||||
|
- if index == 0
|
||||||
|
%li.active
|
||||||
|
%a{ 'href'=>"##{index}", 'role'=>'tab', 'data-toggle'=>'tab' }
|
||||||
|
= commercial.commercial_type
|
||||||
|
- else
|
||||||
|
%li
|
||||||
|
%a{ 'href'=>"##{index}",' "role"'=>'tab', 'data-toggle'=>'tab' }
|
||||||
|
= commercial.commercial_type
|
||||||
|
.tab-content
|
||||||
|
- commercials.each_with_index do |commercial, index|
|
||||||
|
- if index == 0
|
||||||
|
%div.tab-pane.active{'id'=>"#{index}"}
|
||||||
|
.flexvideo
|
||||||
|
= render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id }
|
||||||
|
- else
|
||||||
|
%div.tab-pane{'id'=>"#{index}"}
|
||||||
|
.flexvideo
|
||||||
|
= render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id }
|
||||||
|
|
@ -8,6 +8,13 @@ defaults: &defaults
|
||||||
# errbit configuration, get your own instance: https://github.com/errbit/errbit
|
# errbit configuration, get your own instance: https://github.com/errbit/errbit
|
||||||
#errbit_key: See config/secrets.yml
|
#errbit_key: See config/secrets.yml
|
||||||
#errbit_host: errbit.exmaple.com
|
#errbit_host: errbit.exmaple.com
|
||||||
|
# These are the currently supported commercial types for conference and events
|
||||||
|
commercial_types: { youtube: 'YouTube',
|
||||||
|
slideshare: 'SlideShare',
|
||||||
|
flickr: 'Flickr',
|
||||||
|
vimeo: 'Vimeo',
|
||||||
|
speakerdeck: 'Speakerdeck',
|
||||||
|
instagram: 'Instagram' }
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ Osem::Application.routes.draw do
|
||||||
resources :conference do
|
resources :conference do
|
||||||
resource :contact, except: [:index, :new, :create]
|
resource :contact, except: [:index, :new, :create]
|
||||||
resource :schedule, only: [:show, :update]
|
resource :schedule, only: [:show, :update]
|
||||||
|
resources :commercials, except: [:show]
|
||||||
get '/stats' => 'stats#index'
|
get '/stats' => 'stats#index'
|
||||||
get '/venue' => 'venue#show', as: 'venue_info'
|
get '/venue' => 'venue#show', as: 'venue_info'
|
||||||
patch '/venue' => 'venue#update', as: 'venue_update'
|
patch '/venue' => 'venue#update', as: 'venue_update'
|
||||||
|
|
@ -80,6 +81,7 @@ Osem::Application.routes.draw do
|
||||||
|
|
||||||
resources :conference, only: [:show] do
|
resources :conference, only: [:show] do
|
||||||
resources :proposal do
|
resources :proposal do
|
||||||
|
resources :commercials, except: [:show, :index]
|
||||||
resources :event_attachment, controller: "event_attachments"
|
resources :event_attachment, controller: "event_attachments"
|
||||||
member do
|
member do
|
||||||
patch '/confirm' => 'proposal#confirm'
|
patch '/confirm' => 'proposal#confirm'
|
||||||
|
|
|
||||||
10
db/migrate/20140801103645_create_commercials.rb
Normal file
10
db/migrate/20140801103645_create_commercials.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateCommercials < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :commercials do |t|
|
||||||
|
t.string :commercial_id
|
||||||
|
t.string :commercial_type
|
||||||
|
t.references :commercialable, polymorphic: true
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
class MoveConferenceMediaToCommercial < ActiveRecord::Migration
|
||||||
|
class TempConference < ActiveRecord::Base
|
||||||
|
self.table_name = 'conferences'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempCommercial < ActiveRecord::Base
|
||||||
|
self.table_name = 'commercials'
|
||||||
|
attr_accessible :commercial_id, :commercial_type, :commercialable_id, :commercialable_type
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
# Move all the settings to the new object
|
||||||
|
TempConference.all.each do |conference|
|
||||||
|
unless TempCommercial.exists?(commercialable_id: conference.id, commercialable_id: 'Conference')
|
||||||
|
unless conference.media_id.blank? || conference.media_type.blank?
|
||||||
|
TempCommercial.create(commercial_id: conference.media_id,
|
||||||
|
commercial_type: conference.media_type,
|
||||||
|
commercialable_id: conference.id,
|
||||||
|
commercialable_type: 'Conference')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Then remove all the columns
|
||||||
|
remove_column :conferences, :media_id
|
||||||
|
remove_column :conferences, :media_type
|
||||||
|
end
|
||||||
|
end
|
||||||
28
db/migrate/20140801170430_move_event_media_to_commercial.rb
Normal file
28
db/migrate/20140801170430_move_event_media_to_commercial.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
class MoveEventMediaToCommercial < ActiveRecord::Migration
|
||||||
|
class TempEvent < ActiveRecord::Base
|
||||||
|
self.table_name = 'events'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempCommercial < ActiveRecord::Base
|
||||||
|
self.table_name = 'commercials'
|
||||||
|
attr_accessible :commercial_id, :commercial_type, :commercialable_id, :commercialable_type
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
# Move all the settings to the new object
|
||||||
|
TempEvent.all.each do |event|
|
||||||
|
unless TempCommercial.exists?(commercialable_id: event.id, commercialable_id: 'Conference')
|
||||||
|
unless event.media_id.blank? || event.media_type.blank?
|
||||||
|
TempCommercial.create(commercial_id: event.media_id,
|
||||||
|
commercial_type: event.media_type,
|
||||||
|
commercialable_id: event.id,
|
||||||
|
commercialable_type: 'Event')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Then remove all the columns
|
||||||
|
remove_column :events, :media_id
|
||||||
|
remove_column :events, :media_type
|
||||||
|
end
|
||||||
|
end
|
||||||
15
db/schema.rb
15
db/schema.rb
|
|
@ -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: 20140731165107) do
|
ActiveRecord::Schema.define(version: 20140801170430) do
|
||||||
|
|
||||||
create_table "ahoy_events", force: true do |t|
|
create_table "ahoy_events", force: true do |t|
|
||||||
t.uuid "visit_id"
|
t.uuid "visit_id"
|
||||||
|
|
@ -74,6 +74,15 @@ ActiveRecord::Schema.define(version: 20140731165107) do
|
||||||
add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type"
|
add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type"
|
||||||
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
|
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
|
||||||
|
|
||||||
|
create_table "commercials", force: true do |t|
|
||||||
|
t.string "commercial_id"
|
||||||
|
t.string "commercial_type"
|
||||||
|
t.integer "commercialable_id"
|
||||||
|
t.string "commercialable_type"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "conferences", force: true do |t|
|
create_table "conferences", force: true do |t|
|
||||||
t.string "guid", null: false
|
t.string "guid", null: false
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
|
|
@ -98,8 +107,6 @@ ActiveRecord::Schema.define(version: 20140731165107) do
|
||||||
t.boolean "use_vdays", default: false
|
t.boolean "use_vdays", default: false
|
||||||
t.boolean "use_difficulty_levels", default: false
|
t.boolean "use_difficulty_levels", default: false
|
||||||
t.boolean "use_volunteers"
|
t.boolean "use_volunteers"
|
||||||
t.string "media_id"
|
|
||||||
t.string "media_type"
|
|
||||||
t.string "color"
|
t.string "color"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.text "registration_description"
|
t.text "registration_description"
|
||||||
|
|
@ -257,8 +264,6 @@ ActiveRecord::Schema.define(version: 20140731165107) do
|
||||||
t.integer "room_id"
|
t.integer "room_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "media_id"
|
|
||||||
t.string "media_type"
|
|
||||||
t.boolean "require_registration"
|
t.boolean "require_registration"
|
||||||
t.integer "difficulty_level_id"
|
t.integer "difficulty_level_id"
|
||||||
t.integer "week"
|
t.integer "week"
|
||||||
|
|
|
||||||
71
spec/features/commercials_spec.rb
Normal file
71
spec/features/commercials_spec.rb
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
feature Commercial do
|
||||||
|
# It is necessary to use bang version of let to build roles before user
|
||||||
|
let!(:organizer_role) { create(:organizer_role) }
|
||||||
|
let!(:participant_role) { create(:participant_role) }
|
||||||
|
let!(:admin_role) { create(:admin_role) }
|
||||||
|
|
||||||
|
shared_examples 'adds and updates a commercial' do |user|
|
||||||
|
scenario 'of a conference',
|
||||||
|
feature: true, js: true do
|
||||||
|
|
||||||
|
conference = create(:conference)
|
||||||
|
expected_count = conference.commercials.count + 1
|
||||||
|
|
||||||
|
sign_in create(user)
|
||||||
|
|
||||||
|
visit admin_conference_commercials_path(conference.short_title)
|
||||||
|
|
||||||
|
click_link 'New Commercial'
|
||||||
|
|
||||||
|
# Create without an commercial id
|
||||||
|
select('SlideShare', from: 'commercial_commercial_type')
|
||||||
|
|
||||||
|
click_button 'Create Commercial'
|
||||||
|
expect(flash).to eq("A error prohibited this Commercial from being saved: Commercial can't be blank.")
|
||||||
|
expect(conference.commercials.count).to eq(expected_count - 1)
|
||||||
|
|
||||||
|
# Create valid commercial
|
||||||
|
select('SlideShare', from: 'commercial_commercial_type')
|
||||||
|
fill_in 'commercial_commercial_id', with: '12345'
|
||||||
|
|
||||||
|
click_button 'Create Commercial'
|
||||||
|
expect(flash).to eq('Commercial was successfully created.')
|
||||||
|
expect(conference.commercials.count).to eq(expected_count)
|
||||||
|
expect(page.has_content?('SlideShare')).to be true
|
||||||
|
|
||||||
|
click_link 'Edit'
|
||||||
|
|
||||||
|
# Update without an commercial id
|
||||||
|
select('YouTube', from: 'commercial_commercial_type')
|
||||||
|
fill_in 'commercial_commercial_id', with: ''
|
||||||
|
|
||||||
|
click_button 'Update Commercial'
|
||||||
|
expect(flash).to eq("A error prohibited this Commercial from being saved: Commercial can't be blank.")
|
||||||
|
expect(conference.commercials.count).to eq(expected_count)
|
||||||
|
|
||||||
|
# Update valid commercial
|
||||||
|
select('YouTube', from: 'commercial_commercial_type')
|
||||||
|
fill_in 'commercial_commercial_id', with: '678910'
|
||||||
|
|
||||||
|
click_button 'Update Commercial'
|
||||||
|
expect(flash).to eq('Commercial was successfully updated.')
|
||||||
|
expect(conference.commercials.count).to eq(expected_count)
|
||||||
|
|
||||||
|
# Delete commercial
|
||||||
|
click_link 'Delete'
|
||||||
|
|
||||||
|
expect(flash).to eq('Commercial was successfully destroyed.')
|
||||||
|
expect(conference.commercials.count).to eq(expected_count - 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'admin' do
|
||||||
|
it_behaves_like 'adds and updates a commercial', :admin
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'organizer' do
|
||||||
|
it_behaves_like 'adds and updates a commercial', :organizer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
feature Event do
|
feature EmailSettings do
|
||||||
# It is necessary to use bang version of let to build roles before user
|
# It is necessary to use bang version of let to build roles before user
|
||||||
let!(:organizer_role) { create(:organizer_role) }
|
let!(:organizer_role) { create(:organizer_role) }
|
||||||
let!(:participant_role) { create(:participant_role) }
|
let!(:participant_role) { create(:participant_role) }
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,11 @@ feature Event do
|
||||||
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
||||||
fill_in 'event_description', with: 'Lorem ipsum description'
|
fill_in 'event_description', with: 'Lorem ipsum description'
|
||||||
|
|
||||||
select('YouTube', from: 'event[media_type]')
|
|
||||||
fill_in 'event_media_id', with: '123456'
|
|
||||||
|
|
||||||
fill_in 'user_biography', with: 'Lorem ipsum biography'
|
fill_in 'user_biography', with: 'Lorem ipsum biography'
|
||||||
|
|
||||||
click_button 'Create Event'
|
click_button 'Create Event'
|
||||||
|
expect(flash).to eq('Event was successfully submitted. You should register for the conference now.')
|
||||||
|
|
||||||
expect(current_path).to eq(register_conference_path(conference.short_title))
|
expect(current_path).to eq(register_conference_path(conference.short_title))
|
||||||
|
|
||||||
expect(Event.count).to eq(expected_count)
|
expect(Event.count).to eq(expected_count)
|
||||||
|
|
@ -48,6 +47,57 @@ feature Event do
|
||||||
visit conference_proposal_index_path(conference.short_title)
|
visit conference_proposal_index_path(conference.short_title)
|
||||||
expect(page.has_content?('Example Proposal')).to be true
|
expect(page.has_content?('Example Proposal')).to be true
|
||||||
|
|
||||||
|
expected_count_commercial = Commercial.count + 1
|
||||||
|
# Add a invalid commercial
|
||||||
|
visit edit_conference_proposal_path(conference.short_title, event.id)
|
||||||
|
|
||||||
|
click_link 'Commercials'
|
||||||
|
click_link 'Add Commercial'
|
||||||
|
|
||||||
|
select('SlideShare', from: 'commercial_commercial_type')
|
||||||
|
|
||||||
|
click_button 'Create Commercial'
|
||||||
|
expect(flash).to eq("A error prohibited this Commercial from being saved: Commercial can't be blank.")
|
||||||
|
expect(event.commercials.count).to eq(expected_count_commercial - 1)
|
||||||
|
|
||||||
|
# Add a valid commercial
|
||||||
|
visit edit_conference_proposal_path(conference.short_title, event.id)
|
||||||
|
|
||||||
|
click_link 'Commercials'
|
||||||
|
click_link 'Add Commercial'
|
||||||
|
|
||||||
|
select('SlideShare', from: 'commercial_commercial_type')
|
||||||
|
fill_in 'commercial_commercial_id', with: '12345'
|
||||||
|
|
||||||
|
click_button 'Create Commercial'
|
||||||
|
expect(flash).to eq('Commercial was successfully created.')
|
||||||
|
expect(event.commercials.count).to eq(expected_count_commercial)
|
||||||
|
|
||||||
|
# Edit an invalid commercial
|
||||||
|
click_link 'Commercials'
|
||||||
|
click_link 'Edit'
|
||||||
|
|
||||||
|
select('SlideShare', from: 'commercial_commercial_type')
|
||||||
|
fill_in 'commercial_commercial_id', with: ''
|
||||||
|
|
||||||
|
click_button 'Update Commercial'
|
||||||
|
expect(flash).to eq("A error prohibited this Commercial from being saved: Commercial can't be blank.")
|
||||||
|
expect(event.commercials.count).to eq(expected_count_commercial)
|
||||||
|
|
||||||
|
# Edit a valid commercial
|
||||||
|
select('SlideShare', from: 'commercial_commercial_type')
|
||||||
|
fill_in 'commercial_commercial_id', with: '56789'
|
||||||
|
|
||||||
|
click_button 'Update Commercial'
|
||||||
|
expect(flash).to eq('Commercial was successfully updated.')
|
||||||
|
expect(event.commercials.count).to eq(expected_count_commercial)
|
||||||
|
|
||||||
|
# Delete a commercial
|
||||||
|
click_link 'Commercials'
|
||||||
|
click_link 'Delete'
|
||||||
|
expect(flash).to eq('Commercial was successfully destroyed.')
|
||||||
|
expect(event.commercials.count).to eq(expected_count_commercial - 1)
|
||||||
|
|
||||||
sign_out
|
sign_out
|
||||||
sign_in admin
|
sign_in admin
|
||||||
|
|
||||||
|
|
|
||||||
8
spec/models/commercial_spec.rb
Normal file
8
spec/models/commercial_spec.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Commercial do
|
||||||
|
|
||||||
|
it { should validate_presence_of(:commercial_id) }
|
||||||
|
it { should validate_presence_of(:commercial_type) }
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -64,6 +64,10 @@ RSpec.configure do |config|
|
||||||
# poltergeist as a underlying mech for Capybara
|
# poltergeist as a underlying mech for Capybara
|
||||||
Capybara.javascript_driver = :poltergeist
|
Capybara.javascript_driver = :poltergeist
|
||||||
|
|
||||||
|
Capybara.register_driver :poltergeist do |app|
|
||||||
|
Capybara::Poltergeist::Driver.new(app, js_errors: false)
|
||||||
|
end
|
||||||
|
|
||||||
# Includes helpers and connect them to specific types of tests
|
# Includes helpers and connect them to specific types of tests
|
||||||
config.include FactoryGirl::Syntax::Methods
|
config.include FactoryGirl::Syntax::Methods
|
||||||
config.include OmniauthMacros
|
config.include OmniauthMacros
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue