diff options
| author | Xinhui | 2017-05-23 11:54:05 +0200 |
|---|---|---|
| committer | Xinhui | 2017-05-23 11:54:11 +0200 |
| commit | f47654ea82d1e418f99df107ed899664c3c6ba2e (patch) | |
| tree | 019a718a20cdd5201b3ffeb12682a3ea5ef03622 | |
| parent | 7eb6dab3d9a1fcbc374b522d840f8a6829f83051 (diff) | |
| download | chouette-core-f47654ea82d1e418f99df107ed899664c3c6ba2e.tar.bz2 | |
Fix create time_table with calendar association
Refs #2347
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 2 | ||||
| -rw-r--r-- | app/views/time_tables/_form.html.slim | 2 | ||||
| -rw-r--r-- | spec/features/time_tables_spec.rb | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index dcf8f3e5e..5c4552afb 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -43,7 +43,7 @@ class TimeTablesController < ChouetteController if calendar calendar.dates.each_with_index do |date, i| - @time_table.dates << Chouette::TimeTableDate.new(date: date, position: i) + @time_table.dates << Chouette::TimeTableDate.new(date: date, position: i, in_out: true) end calendar.date_ranges.each_with_index do |date_range, i| @time_table.periods << Chouette::TimeTablePeriod.new(period_start: date_range.begin, period_end: date_range.end, position: i) diff --git a/app/views/time_tables/_form.html.slim b/app/views/time_tables/_form.html.slim index 196682823..d4e1d838e 100644 --- a/app/views/time_tables/_form.html.slim +++ b/app/views/time_tables/_form.html.slim @@ -5,7 +5,7 @@ = form.input :comment, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.time_table.comment")} - if @time_table.new_record? && !@time_table.created_from - = form.input :calendar, as: :select, collection: current_organisation.calendars + = form.input :calendar_id, as: :select, collection: current_organisation.calendars - if @time_table.created_from = form.input :created_from, disabled: true, input_html: { value: @time_table.created_from.comment } diff --git a/spec/features/time_tables_spec.rb b/spec/features/time_tables_spec.rb index 06ae9bac3..58a1dc98f 100644 --- a/spec/features/time_tables_spec.rb +++ b/spec/features/time_tables_spec.rb @@ -67,6 +67,10 @@ describe "TimeTables", :type => :feature do expect(page).to have_content(time_tables.first.comment) end + it 'should not show actualize link on time_tabl without calendar' do + expect(page).not_to have_content(I18n.t('time_tables.actions.actualize')) + end + # context 'user has permission to create time tables' do # it 'shows a create link for time tables' do # expect(page).to have_content(I18n.t('time_tables.actions.new')) |
