From ab1ce49c299700e3479d83108d064a455c52452d Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 7 Sep 2014 00:02:00 +0300 Subject: [PATCH] UX tweaks --- app/models/event.rb | 2 +- app/views/lectures/_form.html.slim | 2 +- app/views/workshops/_form.html.slim | 2 +- config/locales/bg.yml | 4 ++-- config/locales/simple_form.bg.yml | 4 ++-- config/locales/simple_form.en.yml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/event.rb b/app/models/event.rb index b206a8a..80460aa 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -3,7 +3,7 @@ class Event < ActiveRecord::Base validates :length, presence: true, numericality: {only_integer: true, greater_than: 0} validates :abstract, presence: true validates :description, presence: true - validates :track, inclusion: { in: (Conference.current.try(:tracks) || []) } + validates :track_id, inclusion: { in: (Conference.current.try(:tracks) || []).map(&:id) } validates :agreement, acceptance: true belongs_to :track diff --git a/app/views/lectures/_form.html.slim b/app/views/lectures/_form.html.slim index 7a254f6..dbb2e0a 100644 --- a/app/views/lectures/_form.html.slim +++ b/app/views/lectures/_form.html.slim @@ -5,7 +5,7 @@ .form-inputs = form.input :title, autofocus: true = form.input :subtitle - = form.association :track + = form.input :track_id, collection: Conference.current.tracks.map { |track| [track.name, track.id, {title: track.description}] }, required: true = form.input :length = form.input :language, collection: I18n.available_locales, include_blank: false, default: I18n.locale = form.input :abstract diff --git a/app/views/workshops/_form.html.slim b/app/views/workshops/_form.html.slim index d54d8df..2077413 100644 --- a/app/views/workshops/_form.html.slim +++ b/app/views/workshops/_form.html.slim @@ -5,7 +5,7 @@ .form-inputs = form.input :title, autofocus: true = form.input :subtitle - = form.association :track + = form.input :track_id, collection: Conference.current.tracks.map { |track| [track.name, track.id, {title: track.description}] }, required: true = form.input :length, input_html: {value: 60} = form.input :language, collection: I18n.available_locales, include_blank: false, default: I18n.locale = form.input :abstract diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 3fd3c45..58f9c63 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -57,7 +57,7 @@ bg: abstract: Резюме description: Описание notes: Забележки - track: Поток от лекции + track_id: Поток от лекции agreement: Съгласен(на) съм workshop: title: Заглавие @@ -67,7 +67,7 @@ bg: abstract: Резюме description: Описание notes: Забележки - track: Поток от уъркшопи + track_id: Поток от уъркшопи agreement: Съгласен(на) съм errors: models: diff --git a/config/locales/simple_form.bg.yml b/config/locales/simple_form.bg.yml index 7f45fca..0fb11d6 100644 --- a/config/locales/simple_form.bg.yml +++ b/config/locales/simple_form.bg.yml @@ -23,7 +23,7 @@ bg: lecture: title: Заглавието на лекцията Ви subtitle: Подзаглавието на лекцията Ви (ако има такова) - track: Потокът от лекции, в който искате да попадне лекцията Ви + track_id: Потокът от лекции, в който искате да попадне лекцията Ви length: Продължителността на лекция може да бъде от 40 до 45 минути language: Език, на който ще бъде водена лекцията abstract: Резюме на лекцията, което да може да бъде прочетено от посетителите (1 абзац) @@ -33,7 +33,7 @@ bg: workshop: title: Заглавието на уъркшопа Ви subtitle: Подзаглавието на уъркшопа Ви (ако има такова) - track: Потокът от уъркшопи, в който искате да попадне уъркшопа Ви + track_id: Потокът от уъркшопи, в който искате да попадне уъркшопа Ви length: Продължителността на всеки уъркшоп може да бъде от 30 до 120 минути language: Език, на който ще бъде воден уъркшопа abstract: Резюме на уъркшопа, което да може да бъде прочетено от посетителите (1 абзац) diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index eeb5b1a..227fe0c 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -23,7 +23,7 @@ en: lecture: title: Title of your talk subtitle: Sub-title of your talk (if applicable) - track: Track for your talk + track_id: Track for your talk length: The length of your talk can be from 40 to 45 minutes language: Language in which the talk will be presented abstract: Abstract of the talk, for the visitors @@ -33,7 +33,7 @@ en: workshop: title: Title of your workshop subtitle: Sub-title of your workshop (if applicable) - track: Track for your workshop + track_id: Track for your workshop length: The length of the workshop can be from 30 to 120 minutes language: Language in which the workshop will be conducted abstract: Abstract of the workshop, visible to the visitors