Add a planned cfp end date to conferences
This commit is contained in:
parent
8878e328a7
commit
b86deb5b8a
|
@ -52,7 +52,7 @@ module Management
|
||||||
|
|
||||||
def conference_params
|
def conference_params
|
||||||
params.require(:conference).permit(
|
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,
|
event_types_attributes: [:id, :name, :description, :maximum_length,
|
||||||
:minimum_length, :_destroy],
|
:minimum_length, :_destroy],
|
||||||
tracks_attributes: [:id, :name, :color, :css_class, :description,
|
tracks_attributes: [:id, :name, :color, :css_class, :description,
|
||||||
|
|
|
@ -2,9 +2,11 @@ class Conference < ActiveRecord::Base
|
||||||
validates :title, presence: true, uniqueness: true
|
validates :title, presence: true, uniqueness: true
|
||||||
validates :email, presence: true, format: {with: /\A[^@]+@[^@]+\z/}
|
validates :email, presence: true, format: {with: /\A[^@]+@[^@]+\z/}
|
||||||
validates :description, presence: true
|
validates :description, presence: true
|
||||||
|
validates :planned_cfp_end_date, presence: true
|
||||||
validates :start_date, presence: true
|
validates :start_date, presence: true
|
||||||
validates :end_date, presence: true
|
validates :end_date, presence: true
|
||||||
validate :start_date_is_before_end_date
|
validate :start_date_is_before_end_date
|
||||||
|
validate :planned_cfp_end_date_is_before_start_date
|
||||||
|
|
||||||
translates :title, :description
|
translates :title, :description
|
||||||
|
|
||||||
|
@ -39,6 +41,12 @@ class Conference < ActiveRecord::Base
|
||||||
|
|
||||||
private
|
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
|
def start_date_is_before_end_date
|
||||||
if start_date.present? and end_date.present? and start_date > end_date
|
if start_date.present? and end_date.present? and start_date > end_date
|
||||||
errors.add(:end_date, :cannot_be_before_start_date)
|
errors.add(:end_date, :cannot_be_before_start_date)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
= f.input :title
|
= f.input :title
|
||||||
= f.input :email
|
= f.input :email
|
||||||
= f.input :host_name
|
= f.input :host_name
|
||||||
|
= f.input :planned_cfp_end_date
|
||||||
= f.input :start_date, as: :date
|
= f.input :start_date, as: :date
|
||||||
= f.input :end_date, as: :date
|
= f.input :end_date, as: :date
|
||||||
= f.input :description
|
= f.input :description
|
||||||
|
|
|
@ -39,6 +39,7 @@ bg:
|
||||||
end_date: "Крайна дата"
|
end_date: "Крайна дата"
|
||||||
host_name: "Домейн"
|
host_name: "Домейн"
|
||||||
start_date: "Начална дата"
|
start_date: "Начална дата"
|
||||||
|
planned_cfp_end_date: "Планиран край на зова за лектори"
|
||||||
title: "Заглавие"
|
title: "Заглавие"
|
||||||
event:
|
event:
|
||||||
abstract: "Резюме"
|
abstract: "Резюме"
|
||||||
|
@ -286,6 +287,7 @@ bg:
|
||||||
email: Email на организаторския екип
|
email: Email на организаторския екип
|
||||||
end_date: "Денят, в който конференцията приключва"
|
end_date: "Денят, в който конференцията приключва"
|
||||||
start_date: "Денят, в който конференцията започва"
|
start_date: "Денят, в който конференцията започва"
|
||||||
|
planned_cfp_end_date: "Денят, преди който, всички желаещи трябва да са изпратили предложенията си. Това поле е от информативен характер."
|
||||||
title: "Заглавието на конференцията"
|
title: "Заглавието на конференцията"
|
||||||
tracks:
|
tracks:
|
||||||
color: "Цвят"
|
color: "Цвят"
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddPlannedCfpEndDateToConferences < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :conferences, :planned_cfp_end_date, :date
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue