diff options
| author | jpl | 2017-04-27 15:20:33 +0200 |
|---|---|---|
| committer | jpl | 2017-04-27 15:20:40 +0200 |
| commit | d5f329904c74d09c86c77b0ebbe037a6b738ac41 (patch) | |
| tree | 254eeb7c3b4f2ba3c8fb51a6d45499ffd1098604 | |
| parent | 5cf914aec14e39507a3d7c05834fbd945340be92 (diff) | |
| download | chouette-core-d5f329904c74d09c86c77b0ebbe037a6b738ac41.tar.bz2 | |
Refs #3185: refacto/upd tt#create
| -rw-r--r-- | app/assets/stylesheets/components/_forms.sass | 8 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 6 | ||||
| -rw-r--r-- | app/views/time_tables/_form.html.slim | 10 | ||||
| -rw-r--r-- | app/views/time_tables/new.html.slim | 9 |
4 files changed, 26 insertions, 7 deletions
diff --git a/app/assets/stylesheets/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass index 8419c2345..96adb56cf 100644 --- a/app/assets/stylesheets/components/_forms.sass +++ b/app/assets/stylesheets/components/_forms.sass @@ -16,6 +16,10 @@ input color: rgba($grey, 0.65) font-style: italic + + .help-block.small + margin-bottom: 0 + font-style: italic + .control-label.required abbr[title], abbr[data-original-title] border: none @@ -95,6 +99,10 @@ input + [class*='col-sm-'] float: right + &.string + top: 17px + + // Colors dropdown .dropdown.color_selector .btn.btn-default diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index ea53df35f..3b8e390b6 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -46,7 +46,11 @@ class TimeTablesController < ChouetteController @time_table.periods << Chouette::TimeTablePeriod.new(period_start: date_range.begin, period_end: date_range.end, position: i) end end - create! + + create! do |success, failure| + success.html { redirect_to edit_referential_time_table_path(@referential, @time_table) } + failure.html { render :new } + end end def edit diff --git a/app/views/time_tables/_form.html.slim b/app/views/time_tables/_form.html.slim new file mode 100644 index 000000000..8152e7f94 --- /dev/null +++ b/app/views/time_tables/_form.html.slim @@ -0,0 +1,10 @@ += simple_form_for [@referential, @time_table], html: {class: 'form-horizontal', id: 'timetable_form'}, wrapper: :horizontal_form do |form| + + .row + .col-lg-12 + = form.input :comment, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.time_table.comment")} + + - if @time_table.new_record? + = form.input :calendar, as: :select, collection: current_organisation.calendars + + = form.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'timetable_form' diff --git a/app/views/time_tables/new.html.slim b/app/views/time_tables/new.html.slim index 6a0faade8..8d72f49b6 100644 --- a/app/views/time_tables/new.html.slim +++ b/app/views/time_tables/new.html.slim @@ -7,9 +7,6 @@ / PageContent .page_content .container-fluid - #periods - -= javascript_tag do - | window.actionType = "#{params[:action]}" - -= javascript_include_tag 'es6_browserified/time_tables/index.js' + .row + .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 + = render 'form' |
