aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-05-29 14:33:28 +0200
committerRobert2017-05-29 14:33:28 +0200
commit54bf18da9a74295c327e39c659ef3a28719a2631 (patch)
tree1af40cc9c3187bdd1024422553e881e4b0d5cc45
parentb0e6bc3ffd02146fd999f12975f269dac94a0994 (diff)
parent62b283e8dfece7337254d0b23b89e36a81254e3b (diff)
downloadchouette-core-54bf18da9a74295c327e39c659ef3a28719a2631.tar.bz2
Merge branch 'master' of github.com:af83/stif-boiv
-rw-r--r--app/controllers/autocomplete_calendars_controller.rb2
-rw-r--r--app/controllers/time_table_combinations_controller.rb1
-rw-r--r--app/models/time_table_combination.rb3
-rw-r--r--app/views/time_table_combinations/_form.html.slim2
4 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/autocomplete_calendars_controller.rb b/app/controllers/autocomplete_calendars_controller.rb
index dbdd1a9fc..f85f529fc 100644
--- a/app/controllers/autocomplete_calendars_controller.rb
+++ b/app/controllers/autocomplete_calendars_controller.rb
@@ -2,6 +2,6 @@ class AutocompleteCalendarsController < ApplicationController
respond_to :json, :only => [:autocomplete]
def autocomplete
- @calendars = Calendar.search(params[:q]).result.paginate(page: params[:page])
+ @calendars = current_organisation.referentials.search(params[:q]).result.paginate(page: params[:page])
end
end
diff --git a/app/controllers/time_table_combinations_controller.rb b/app/controllers/time_table_combinations_controller.rb
index bbb262247..32f1818b0 100644
--- a/app/controllers/time_table_combinations_controller.rb
+++ b/app/controllers/time_table_combinations_controller.rb
@@ -5,6 +5,7 @@ class TimeTableCombinationsController < ChouetteController
def new
@combination = TimeTableCombination.new(source_id: parent.id)
+ @combination.combined_type = 'time_table'
end
def create
diff --git a/app/models/time_table_combination.rb b/app/models/time_table_combination.rb
index 9b5111014..0ca9e9253 100644
--- a/app/models/time_table_combination.rb
+++ b/app/models/time_table_combination.rb
@@ -31,7 +31,6 @@ class TimeTableCombination
attributes.each do |name, value|
send("#{name}=", value)
end
- self.combined_type = "time_table"
end
def persisted?
@@ -40,7 +39,7 @@ class TimeTableCombination
def target
id = self.send("#{combined_type}_id")
- klass = combined_type == 'calendar' ? Calendar : Chouette::TimeTable
+ klass = combined_type == "calendar" ? Calendar : Chouette::TimeTable
target = klass.find id
target = target.convert_to_time_table unless target.is_a? Chouette::TimeTable
target
diff --git a/app/views/time_table_combinations/_form.html.slim b/app/views/time_table_combinations/_form.html.slim
index 3716f6713..d8bebf0c4 100644
--- a/app/views/time_table_combinations/_form.html.slim
+++ b/app/views/time_table_combinations/_form.html.slim
@@ -8,7 +8,7 @@
= f.input :combined_type, as: :boolean, checked_value: 'time_table', unchecked_value: 'calendar', required: false, label: content_tag(:span, t("time_table_combinations.combined_type.#{@combination.combined_type}"), class: 'switch-label', data: { checkedValue: 'Calendriers', uncheckedValue: 'Modèles de calendriers' }), wrapper_html: { class: 'col-sm-8' }
= f.input :time_table_id, as: :select, input_html: {class: 'tt_combination_target', style: "width: 100%", data: { 'select2-ajax': 'true', term: 'comment_or_objectid_cont', url: referential_autocomplete_time_tables_path(@referential, format: :json)}}, wrapper_html: {class: @combination.combined_type != 'time_table' ? 'hidden' : ''}
-
+
= f.input :calendar_id, as: :select, input_html: { class: 'tt_combination_target', style: "width: 100%", data: { 'select2-ajax': 'true', term: 'name_cont', url: autocomplete_calendars_path}}, wrapper_html: {class: @combination.combined_type != 'calendar' ? 'hidden' : ''}
.separator