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
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
def after_save_redirection

View File

@ -41,7 +41,7 @@ class WorkshopsController < ApplicationController
end
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
def after_save_redirection

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,6 +29,7 @@ bg:
abstract: Резюме на лекцията, което да може да бъде прочетено от посетителите (1 абзац)
description: Подробно описание на лекцията (няколко абзаца)
notes: Забележки, които искате да споделите с организаторския екип
agreement: Отбележете съгласни ли Сте с това лекцията Ви да бъде записана и публикувана под лиценз CC-BY-ND (Creative Commons Attribution No Derivatives)?
workshop:
title: Заглавието на уъркшопа Ви
subtitle: Подзаглавието на уъркшопа Ви (ако има такова)
@ -37,4 +38,5 @@ bg:
language: Език, на който ще бъде воден уъркшопа
abstract: Резюме на уъркшопа, което да може да бъде прочетено от посетителите (1 абзац)
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
description: Detailed description of the talk, visible to the visitors
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:
title: Title of your workshop
subtitle: Sub-title of your workshop (if applicable)
@ -38,6 +39,4 @@ en:
abstract: Abstract of the workshop, visible to the visitors
description: Detailed description of the workshop, visible to the visitors
notes: Notes, visible only to the organizers
labels:
user:
a: b
agreement: Indicate if you accept your workshop to be recorded and published under the CC-BY-ND (Creative Commons Attribution No Derivatives) license?

View File

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

View File

@ -1,4 +1,9 @@
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
event.title = ''
expect(event).to have_error_on :title