aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/time_table_combinations_controller.rb28
-rw-r--r--app/views/time_table_combinations/_combine.html.slim12
-rw-r--r--app/views/time_table_combinations/_combine_form.html.slim11
-rw-r--r--app/views/time_table_combinations/_form.html.slim8
-rw-r--r--app/views/time_table_combinations/create_failure.js.slim3
-rw-r--r--app/views/time_table_combinations/create_success.js.slim6
-rw-r--r--app/views/time_table_combinations/new.html.slim2
-rw-r--r--app/views/time_table_combinations/new.js.slim2
-rw-r--r--app/views/time_tables/show.html.slim5
9 files changed, 14 insertions, 63 deletions
diff --git a/app/controllers/time_table_combinations_controller.rb b/app/controllers/time_table_combinations_controller.rb
index ebae9f225..db3025921 100644
--- a/app/controllers/time_table_combinations_controller.rb
+++ b/app/controllers/time_table_combinations_controller.rb
@@ -2,45 +2,25 @@ class TimeTableCombinationsController < ChouetteController
respond_to :js, :only => [:new,:create]
belongs_to :referential do
- belongs_to :time_table, :parent_class => Chouette::TimeTable
- end
- after_filter :clean_flash
-
- def clean_flash
- # only run this in case it's an Ajax request.
- return unless request.xhr?
- flash.discard
+ belongs_to :time_table, :parent_class => Chouette::TimeTable
end
def new
@time_table_combination = TimeTableCombination.new(:source_id => parent.id)
- render :action => :new
end
-
def create
- Rails.logger.warn( params.inspect)
@time_table_combination = TimeTableCombination.new( params[:time_table_combination].merge( :source_id => parent.id))
- Rails.logger.warn( @time_table_combination.inspect)
- @year = params[:year] ? params[:year].to_i : Date.today.cwyear
if @time_table_combination.valid?
begin
@time_table = @time_table_combination.combine
flash[:notice] = t('time_table_combinations.success')
- render "create_success"
rescue => e
- Rails.logger.error( "TimeTableCombination error, @time_table_combination=#{@time_table_combination.inspect}")
- Rails.logger.error( e.inspect)
flash[:error] = t('time_table_combinations.failure')
- render "create_failure"
+ render :new
end
- else
- render "create_failure"
+ else
+ render :new
end
-
end
- protected
-
- alias_method :time_table_combination, :resource
-
end
diff --git a/app/views/time_table_combinations/_combine.html.slim b/app/views/time_table_combinations/_combine.html.slim
deleted file mode 100644
index a2e9a9c6e..000000000
--- a/app/views/time_table_combinations/_combine.html.slim
+++ /dev/null
@@ -1,12 +0,0 @@
-#modal_combine.modal.fade tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
- .modal-dialog
- .modal-content
- .modal-header
- button.close type="button" data-dismiss="modal"
- span aria-hidden="true" &times;
- span.sr-only Close
-
- h4.modal-title id="myModalLabel"
- = t('time_tables.show.combine_form')
-
- == render "time_table_combinations/combine_form" \ No newline at end of file
diff --git a/app/views/time_table_combinations/_combine_form.html.slim b/app/views/time_table_combinations/_combine_form.html.slim
deleted file mode 100644
index 2367cd4af..000000000
--- a/app/views/time_table_combinations/_combine_form.html.slim
+++ /dev/null
@@ -1,11 +0,0 @@
-= semantic_form_for [@referential, @time_table, @time_table_combination], :remote => true do |form|
- .modal-body
- == render "shared/flash_messages"
-
- = form.inputs do
- = form.input :operation, as: :radio, :collection => Hash[TimeTableCombination.operations.map {|b| [t( b, :scope => "time_table_combinations.operations"),b]}]
- = form.input :combined_id, :label => t('.time_tables'), as: :search_time_table, :json => referential_autocomplete_time_tables_path(@referential, :format => :json), :hint_text => t('search_hint'), :no_result_text => t('no_result_text'), :searching_text => t('searching_term'), :tokenLimit => 1
-
- .modal-footer
- = form.actions do
- = form.action :submit, as: :button , :label => t('time_tables.show.combine') \ No newline at end of file
diff --git a/app/views/time_table_combinations/_form.html.slim b/app/views/time_table_combinations/_form.html.slim
new file mode 100644
index 000000000..e61ceee44
--- /dev/null
+++ b/app/views/time_table_combinations/_form.html.slim
@@ -0,0 +1,8 @@
+= simple_form_for [@referential, @time_table, @time_table_combination], html: {class: 'form-horizontal'}, wrapper: :horizontal_form do |form|
+ .row
+ .col-lg-12
+ = form.input :operation, as: :select, :collection => Hash[TimeTableCombination.operations.map {|b| [t( b, :scope => "time_table_combinations.operations"),b]}]
+
+ / = form.input :combined_id, :label => t('.time_tables'), as: :search_time_table, :json => referential_autocomplete_time_tables_path(@referential, :format => :json), hint_text: t('search_hint'), no_result_text: t('no_result_text'), :searching_text => t('searching_term'), :tokenLimit => 1
+
+ = form.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr'
diff --git a/app/views/time_table_combinations/create_failure.js.slim b/app/views/time_table_combinations/create_failure.js.slim
deleted file mode 100644
index c5b544483..000000000
--- a/app/views/time_table_combinations/create_failure.js.slim
+++ /dev/null
@@ -1,3 +0,0 @@
-| var combine_form_partial = "#{j render 'time_table_combinations/combine_form'}";
-
-| $('#new_time_table_combination').replaceWith(combine_form_partial); \ No newline at end of file
diff --git a/app/views/time_table_combinations/create_success.js.slim b/app/views/time_table_combinations/create_success.js.slim
deleted file mode 100644
index f18eea4bc..000000000
--- a/app/views/time_table_combinations/create_success.js.slim
+++ /dev/null
@@ -1,6 +0,0 @@
-| var combine_form_partial = "#{j render 'time_table_combinations/combine_form'}";
-
-| $('#new_time_table_combination').replaceWith(combine_form_partial);
-
-| var time_table_partial = "#{j render 'time_tables/show_time_table'}";
-| $('#time_table_show').replaceWith(time_table_partial); \ No newline at end of file
diff --git a/app/views/time_table_combinations/new.html.slim b/app/views/time_table_combinations/new.html.slim
new file mode 100644
index 000000000..9bed24730
--- /dev/null
+++ b/app/views/time_table_combinations/new.html.slim
@@ -0,0 +1,2 @@
+= t('time_tables.show.combine_form')
+= render 'form'
diff --git a/app/views/time_table_combinations/new.js.slim b/app/views/time_table_combinations/new.js.slim
deleted file mode 100644
index 749ec04f6..000000000
--- a/app/views/time_table_combinations/new.js.slim
+++ /dev/null
@@ -1,2 +0,0 @@
-| var combine_form_partial = "#{j render 'time_table_combinations/combine_form'}";
-| $('#new_time_table_combination').replaceWith(combine_form_partial); \ No newline at end of file
diff --git a/app/views/time_tables/show.html.slim b/app/views/time_tables/show.html.slim
index 220ac3995..9c40a13a2 100644
--- a/app/views/time_tables/show.html.slim
+++ b/app/views/time_tables/show.html.slim
@@ -44,8 +44,3 @@
= link_to '', referential_time_table_path(@referential, @time_table, year: (@year + 1)), class: 'next_page'
= render 'show_time_table'
-
- .row
- .col-lg-12
- / WTF ??!
- = render 'time_table_combinations/combine'