Add event terms acceptance requirement

This commit is contained in:
Petko Bordjukov 2014-09-04 00:39:54 +03:00
parent a85a80f7e0
commit 5a360475a2
11 changed files with 21 additions and 6 deletions

View File

@ -41,7 +41,7 @@ class LecturesController < ApplicationController
end end
def lecture_params def lecture_params
params.require(:lecture).permit [:title, :subtitle, :length, :language, :abstract, :description, :notes, :track_id] params.require(:lecture).permit [:title, :subtitle, :length, :language, :abstract, :description, :notes, :track_id, :agreement]
end end
def after_save_redirection def after_save_redirection

View File

@ -41,7 +41,7 @@ class WorkshopsController < ApplicationController
end end
def workshop_params def workshop_params
params.require(:workshop).permit [:title, :subtitle, :length, :language, :abstract, :description, :notes, :track_id] params.require(:workshop).permit [:title, :subtitle, :length, :language, :abstract, :description, :notes, :track_id, :agreement]
end end
def after_save_redirection def after_save_redirection

View File

@ -4,6 +4,7 @@ class Event < ActiveRecord::Base
validates :abstract, presence: true validates :abstract, presence: true
validates :description, presence: true validates :description, presence: true
validates :track, inclusion: { in: (Conference.current.try(:tracks) || []) } validates :track, inclusion: { in: (Conference.current.try(:tracks) || []) }
validates :agreement, acceptance: true
belongs_to :track belongs_to :track
has_one :conference, through: :track has_one :conference, through: :track

View File

@ -11,4 +11,5 @@
= form.input :abstract = form.input :abstract
= form.input :description = form.input :description
= form.input :notes = form.input :notes
= form.input :agreement, as: :boolean
= form.button :submit = form.button :submit

View File

@ -11,4 +11,5 @@
= form.input :abstract = form.input :abstract
= form.input :description = form.input :description
= form.input :notes = form.input :notes
= form.input :agreement, as: :boolean
= form.button :submit = form.button :submit

View File

@ -58,6 +58,7 @@ bg:
description: Описание description: Описание
notes: Забележки notes: Забележки
track: Поток от лекции track: Поток от лекции
agreement: Съгласен(на) съм
workshop: workshop:
title: Заглавие title: Заглавие
subtitle: Подзаглавие subtitle: Подзаглавие
@ -67,6 +68,7 @@ bg:
description: Описание description: Описание
notes: Забележки notes: Забележки
track: Поток от уъркшопи track: Поток от уъркшопи
agreement: Съгласен(на) съм
errors: errors:
models: models:
user: user:

View File

@ -58,6 +58,7 @@ en:
description: Description (3-4 paragraphs) description: Description (3-4 paragraphs)
notes: Notes notes: Notes
track: Track track: Track
agreement: I agree
workshop: workshop:
title: Title title: Title
subtitle: Sub-title subtitle: Sub-title
@ -67,6 +68,7 @@ en:
description: Description (3-4 paragraphs) description: Description (3-4 paragraphs)
notes: Notes notes: Notes
track: Track track: Track
agreement: I agree
errors: errors:
models: models:
user: user:

View File

@ -29,6 +29,7 @@ bg:
abstract: Резюме на лекцията, което да може да бъде прочетено от посетителите (1 абзац) abstract: Резюме на лекцията, което да може да бъде прочетено от посетителите (1 абзац)
description: Подробно описание на лекцията (няколко абзаца) description: Подробно описание на лекцията (няколко абзаца)
notes: Забележки, които искате да споделите с организаторския екип notes: Забележки, които искате да споделите с организаторския екип
agreement: Отбележете съгласни ли Сте с това лекцията Ви да бъде записана и публикувана под лиценз CC-BY-ND (Creative Commons Attribution No Derivatives)?
workshop: workshop:
title: Заглавието на уъркшопа Ви title: Заглавието на уъркшопа Ви
subtitle: Подзаглавието на уъркшопа Ви (ако има такова) subtitle: Подзаглавието на уъркшопа Ви (ако има такова)
@ -37,4 +38,5 @@ bg:
language: Език, на който ще бъде воден уъркшопа language: Език, на който ще бъде воден уъркшопа
abstract: Резюме на уъркшопа, което да може да бъде прочетено от посетителите (1 абзац) abstract: Резюме на уъркшопа, което да може да бъде прочетено от посетителите (1 абзац)
description: Подробно описание на уъркшопа (няколко абзаца) description: Подробно описание на уъркшопа (няколко абзаца)
notes: Забележки, които искате да споделите с организаторския екип notes: Забележки, които искате да споделите с организаторския екип
agreement: Отбележете дали Сте съгласни с това уъркшопът Ви да бъде записан и публикуван под лиценз CC-BY-ND (Creative Commons Attribution No Derivatives)?

View File

@ -29,6 +29,7 @@ en:
abstract: Abstract of the talk, for the visitors abstract: Abstract of the talk, for the visitors
description: Detailed description of the talk, visible to the visitors description: Detailed description of the talk, visible to the visitors
notes: Notes on your talk, visible only to the organizers notes: Notes on your talk, visible only to the organizers
agreement: Indicate if you accept your lecture to be recorded and published under the CC-BY-ND (Creative Commons Attribution No Derivatives) license?
workshop: workshop:
title: Title of your workshop title: Title of your workshop
subtitle: Sub-title of your workshop (if applicable) subtitle: Sub-title of your workshop (if applicable)
@ -38,6 +39,4 @@ en:
abstract: Abstract of the workshop, visible to the visitors abstract: Abstract of the workshop, visible to the visitors
description: Detailed description of the workshop, visible to the visitors description: Detailed description of the workshop, visible to the visitors
notes: Notes, visible only to the organizers notes: Notes, visible only to the organizers
labels: agreement: Indicate if you accept your workshop to be recorded and published under the CC-BY-ND (Creative Commons Attribution No Derivatives) license?
user:
a: b

View File

@ -9,6 +9,7 @@ FactoryGirl.define do
abstract "An Abstract" abstract "An Abstract"
description "A Description" description "A Description"
notes "Some Notes" notes "Some Notes"
agreement true
track track
user user
end end
@ -21,6 +22,7 @@ FactoryGirl.define do
abstract "An Abstract" abstract "An Abstract"
description "A Description" description "A Description"
notes "Some Notes" notes "Some Notes"
agreement true
track track
user user
end end

View File

@ -1,4 +1,9 @@
RSpec.shared_examples 'an event' do RSpec.shared_examples 'an event' do
it 'is invalid if the event agrement is not accepted' do
event.agreement = false
expect(event).to have_error_on :agreement
end
it 'is invalid without a title' do it 'is invalid without a title' do
event.title = '' event.title = ''
expect(event).to have_error_on :title expect(event).to have_error_on :title