Add a planned cfp end date to conferences

This commit is contained in:
Petko Bordjukov 2016-07-05 18:35:11 +03:00
parent 8878e328a7
commit b86deb5b8a
5 changed files with 17 additions and 1 deletions

View File

@ -52,7 +52,7 @@ module Management
def conference_params
params.require(:conference).permit(
:title, :email, :start_date, :end_date, :description, :host_name,
:title, :email, :start_date, :end_date, :description, :host_name, :planned_cfp_end_date,
event_types_attributes: [:id, :name, :description, :maximum_length,
:minimum_length, :_destroy],
tracks_attributes: [:id, :name, :color, :css_class, :description,

View File

@ -2,9 +2,11 @@ class Conference < ActiveRecord::Base
validates :title, presence: true, uniqueness: true
validates :email, presence: true, format: {with: /\A[^@]+@[^@]+\z/}
validates :description, presence: true
validates :planned_cfp_end_date, presence: true
validates :start_date, presence: true
validates :end_date, presence: true
validate :start_date_is_before_end_date
validate :planned_cfp_end_date_is_before_start_date
translates :title, :description
@ -39,6 +41,12 @@ class Conference < ActiveRecord::Base
private
def planned_cfp_end_date_is_before_start_date
if planned_cfp_end_date.present? and start_date.present? and planned_cfp_end_date > start_date
errors.add(:planned_cfp_end_date, :cannot_be_after_start_date)
end
end
def start_date_is_before_end_date
if start_date.present? and end_date.present? and start_date > end_date
errors.add(:end_date, :cannot_be_before_start_date)

View File

@ -8,6 +8,7 @@
= f.input :title
= f.input :email
= f.input :host_name
= f.input :planned_cfp_end_date
= f.input :start_date, as: :date
= f.input :end_date, as: :date
= f.input :description

View File

@ -39,6 +39,7 @@ bg:
end_date: "Крайна дата"
host_name: "Домейн"
start_date: "Начална дата"
planned_cfp_end_date: "Планиран край на зова за лектори"
title: "Заглавие"
event:
abstract: "Резюме"
@ -286,6 +287,7 @@ bg:
email: Email на организаторския екип
end_date: "Денят, в който конференцията приключва"
start_date: "Денят, в който конференцията започва"
planned_cfp_end_date: "Денят, преди който, всички желаещи трябва да са изпратили предложенията си. Това поле е от информативен характер."
title: "Заглавието на конференцията"
tracks:
color: "Цвят"

View File

@ -0,0 +1,5 @@
class AddPlannedCfpEndDateToConferences < ActiveRecord::Migration
def change
add_column :conferences, :planned_cfp_end_date, :date
end
end