Commit a522623b367acc6249e28412987635514c17b234
1 parent
9a1c00d4
Exists in
staging
and in
4 other branches
Adds support to time (HH:MM) in Events
Showing
3 changed files
with
43 additions
and
3 deletions
Show diff stats
app/models/event.rb
| @@ -3,13 +3,14 @@ require 'builder' | @@ -3,13 +3,14 @@ require 'builder' | ||
| 3 | 3 | ||
| 4 | class Event < Article | 4 | class Event < Article |
| 5 | 5 | ||
| 6 | - attr_accessible :start_date, :end_date, :link, :address | 6 | + attr_accessible :start_date, :end_date, :link, :address, :start_hour, :start_minute, :presenter |
| 7 | 7 | ||
| 8 | def self.type_name | 8 | def self.type_name |
| 9 | _('Event') | 9 | _('Event') |
| 10 | end | 10 | end |
| 11 | 11 | ||
| 12 | settings_items :address, :type => :string | 12 | settings_items :address, :type => :string |
| 13 | + settings_items :presenter, :type => :string | ||
| 13 | 14 | ||
| 14 | def link=(value) | 15 | def link=(value) |
| 15 | self.setting[:link] = maybe_add_http(value) | 16 | self.setting[:link] = maybe_add_http(value) |
app/views/cms/_event.html.erb
| @@ -8,9 +8,11 @@ | @@ -8,9 +8,11 @@ | ||
| 8 | <%= render :partial => 'general_fields' %> | 8 | <%= render :partial => 'general_fields' %> |
| 9 | <%= render :partial => 'translatable' %> | 9 | <%= render :partial => 'translatable' %> |
| 10 | 10 | ||
| 11 | -<%= labelled_form_field(_('Start date'), pick_date(:article, :start_date)) %> | 11 | +<%= labelled_form_field(_('Start date and time'), datetime_select(:article, :start_date)) %> |
| 12 | 12 | ||
| 13 | -<%= labelled_form_field(_('End date'), pick_date(:article, :end_date)) %> | 13 | +<%= labelled_form_field(_('End date and time'), datetime_select(:article, :end_date)) %> |
| 14 | + | ||
| 15 | +<%= labelled_form_field(_('Presenter:'), text_field(:article, :presenter)) %> | ||
| 14 | 16 | ||
| 15 | <%= labelled_form_field(_('Event website:'), text_field(:article, :link)) %> | 17 | <%= labelled_form_field(_('Event website:'), text_field(:article, :link)) %> |
| 16 | 18 |
db/migrate/20150617222204_event_period_with_support_to_datetime.rb
0 → 100644
| @@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
| 1 | +class EventPeriodWithSupportToDatetime < ActiveRecord::Migration | ||
| 2 | + def up | ||
| 3 | + change_table :articles do |t| | ||
| 4 | + t.change :start_date, :datetime | ||
| 5 | + end | ||
| 6 | + | ||
| 7 | + change_table :articles do |t| | ||
| 8 | + t.change :end_date, :datetime | ||
| 9 | + end | ||
| 10 | + | ||
| 11 | + change_table :article_versions do |t| | ||
| 12 | + t.change :start_date, :datetime | ||
| 13 | + end | ||
| 14 | + | ||
| 15 | + change_table :article_versions do |t| | ||
| 16 | + t.change :end_date, :datetime | ||
| 17 | + end | ||
| 18 | + end | ||
| 19 | + | ||
| 20 | + def down | ||
| 21 | + change_table :articles do |t| | ||
| 22 | + t.change :start_date, :date | ||
| 23 | + end | ||
| 24 | + | ||
| 25 | + change_table :articles do |t| | ||
| 26 | + t.change :end_date, :date | ||
| 27 | + end | ||
| 28 | + | ||
| 29 | + change_table :article_versions do |t| | ||
| 30 | + t.change :start_date, :date | ||
| 31 | + end | ||
| 32 | + | ||
| 33 | + change_table :article_versions do |t| | ||
| 34 | + t.change :end_date, :date | ||
| 35 | + end | ||
| 36 | + end | ||
| 37 | +end | ||
| 0 | \ No newline at end of file | 38 | \ No newline at end of file |