Commit f059bfb6 authored by Mario Manno's avatar Mario Manno

introduce conference default recording license and remove from cfp view #176

parent e77c7f63
......@@ -11,7 +11,7 @@ class Cfp::EventsController < ApplicationController
@events = current_user.person.events.all
unless @events.nil?
@events.map { |event| event.clean_event_attributes! }
@events.map { |event| event.clean_event_attributes! }
end
respond_to do |format|
......@@ -31,6 +31,7 @@ class Cfp::EventsController < ApplicationController
def new
authorize! :submit, Event
@event = Event.new(time_slots: @conference.default_timeslots)
@event.recording_license = @conference.default_recording_license
respond_to do |format|
format.html # new.html.erb
......@@ -48,7 +49,7 @@ class Cfp::EventsController < ApplicationController
# POST /cfp/events.xml
def create
authorize! :submit, Event
@event = Event.new(params[:event])
@event = Event.new(params[:event].merge(recording_license: @conference.default_recording_license))
@event.conference = @conference
@event.event_people << EventPerson.new(person: current_user.person, event_role: "submitter")
@event.event_people << EventPerson.new(person: current_user.person, event_role: "speaker")
......@@ -69,8 +70,10 @@ class Cfp::EventsController < ApplicationController
def update
authorize! :submit, Event
@event = current_user.person.events.find(params[:id], readonly: false)
# TODO strong params needed
params[:event].delete('recording_license')
@event.recording_license = @event.conference.default_recording_license unless @event.recording_license
if @event.accepted?
params[:event].delete('recording_license')
params[:event].delete('do_not_record')
end
......
......@@ -20,8 +20,8 @@ class Conference < ActiveRecord::Base
accepts_nested_attributes_for :tracks, reject_if: :all_blank, allow_destroy: true
accepts_nested_attributes_for :languages, reject_if: :all_blank, allow_destroy: true
accepts_nested_attributes_for :ticket_server
validates_presence_of :title,
:acronym,
validates_presence_of :title,
:acronym,
:default_timeslots,
:max_timeslots,
:timeslot_duration,
......@@ -33,7 +33,7 @@ class Conference < ActiveRecord::Base
after_update :update_timeslots
has_paper_trail
has_paper_trail
scope :has_submission, lambda { |person|
joins(events: [{event_people: :person}])
......@@ -43,11 +43,11 @@ class Conference < ActiveRecord::Base
scope :creation_order, order("conferences.created_at DESC")
scope :accessible_by_crew, lambda { |user|
scope :accessible_by_crew, lambda { |user|
joins(:conference_users).where(conference_users: {user_id: user})
}
scope :accessible_by_orga, lambda { |user|
scope :accessible_by_orga, lambda { |user|
joins(:conference_users).where(conference_users: {user_id: user, role: 'orga'})
}
......@@ -210,7 +210,7 @@ class Conference < ActiveRecord::Base
yesterday = days[0]
days[1..-1].each { |day|
if day.start_date < yesterday.end_date
self.errors.add(:days, "day #{day} overlaps with day before")
self.errors.add(:days, "day #{day} overlaps with day before")
end
}
end
......
......@@ -8,11 +8,11 @@
= f.input :language, :as => :bootstrap_language, :only => @conference.language_codes, :include_blank => ""
= f.input :logo
= f.inputs :name => t("cfp.detailed_description") do
= f.input :abstract, :input_html => {:rows => 4}, :hint => t("cfp.event_abstract_hint")
= f.input :description, :hint => t("cfp.event_description_hint")
= f.input :abstract, :input_html => {:rows => 4}, :hint => t("cfp.event_abstract_hint")
= f.input :description, :hint => t("cfp.event_description_hint")
= f.input :submission_note, :hint => "visible for admins and users, contains additional information."
= f.input :do_not_record, :as => :boolean, :hint => "If the conference records talks and there is an opt-out: do you want your talk recorded?", input_html: deny_accepted(@event)
= f.input :recording_license, hint: "If the conference allows speakers to choose the talks recordings license, which license should apply?", input_html: deny_accepted(@event)
= f.input :recording_license, hint: "Please contact the conference crew, if you want another license.", input_html: { readonly: true, disabled: true }
= dynamic_association :links, t("cfp.links"), f
= dynamic_association :event_attachments, t("cfp.uploaded_files"), f
= f.buttons do
......
class AddDefaultRecordingLicenseToConference < ActiveRecord::Migration
def change
add_column :conferences, :default_recording_license, :string, defaults: 'CC-BY-3.0-DE'
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment