aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLuc Donnet2018-02-07 10:03:36 +0100
committerGitHub2018-02-07 10:03:36 +0100
commitde6ef9294f7a1890d6f9de479e965d571233a96e (patch)
tree02b7cec8fe79473955e48731f78d6bcd1dcb0366 /app
parent4f58c4eaca46dc975aa907840cdbe067f6225d5e (diff)
parent7d24256844e33bcb7875076a4bcfae22dd308009 (diff)
downloadchouette-core-de6ef9294f7a1890d6f9de479e965d571233a96e.tar.bz2
Merge pull request #281 from af83/5817-referential-vehicle-journeys-index--fix-StopArea-kind-a
5817 referential vehicle journeys index fix stop area kind a
Diffstat (limited to 'app')
-rw-r--r--app/models/chouette/stop_area.rb4
-rw-r--r--app/views/referential_vehicle_journeys/_filters.html.slim2
-rw-r--r--app/views/stop_areas/_form.html.slim11
3 files changed, 10 insertions, 7 deletions
diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb
index cf2afbc73..bb8747faa 100644
--- a/app/models/chouette/stop_area.rb
+++ b/app/models/chouette/stop_area.rb
@@ -47,10 +47,6 @@ module Chouette
validate :parent_area_type_must_be_greater
validate :area_type_of_right_kind
- after_initialize do
- self.kind ||= :commercial
- end
-
def self.nullable_attributes
[:registration_number, :street_name, :country_code, :fare_code,
:nearest_topic_name, :comment, :long_lat_type, :zip_code, :city_name, :url, :time_zone]
diff --git a/app/views/referential_vehicle_journeys/_filters.html.slim b/app/views/referential_vehicle_journeys/_filters.html.slim
index bd8245e39..3104e3a71 100644
--- a/app/views/referential_vehicle_journeys/_filters.html.slim
+++ b/app/views/referential_vehicle_journeys/_filters.html.slim
@@ -42,7 +42,7 @@
= f.input :published_journey_name_lteq, label: false, wrapper_html: { class: 'w45'}
.form-group.togglable class=filter_item_class(params[:q], :stop_area_ids)
= f.label Chouette::StopArea.model_name.human.pluralize, required: false, class: 'control-label'
- = f.input :stop_area_ids, collection: @all_stop_areas.select(:id, :name, :kind).order(name: :asc), checked: params[:q] && params[:q][:stop_area_ids], as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}, multiple: true
+ = f.input :stop_area_ids, collection: @all_stop_areas.select(:id, :name).order(name: :asc), checked: params[:q] && params[:q][:stop_area_ids], as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}, multiple: true
.form-group.togglable class=filter_item_class(params[:q], :purchase_window)
= f.label Chouette::VehicleJourney.human_attribute_name(:purchase_window), class: 'control-label'
.filter_menu
diff --git a/app/views/stop_areas/_form.html.slim b/app/views/stop_areas/_form.html.slim
index 9897a27ac..bb1fbe1e9 100644
--- a/app/views/stop_areas/_form.html.slim
+++ b/app/views/stop_areas/_form.html.slim
@@ -12,8 +12,15 @@
.col-sm-9.col-xs-7
- f.object.localized_names.each do |k, v|
.col-md-6= f.input "localized_names[#{k}]", input_html: {value: v}, label: label_for_country(k)
-
- = f.input :kind, as: :radio_buttons, checked: @stop_area.kind, :input_html => {:disabled => !@stop_area.new_record?}, :include_blank => false, item_wrapper_class: 'radio-inline', wrapper: :horizontal_form, disabled: !@stop_area.new_record?
+
+ = f.input :kind,
+ as: :radio_buttons,
+ checked: @stop_area.new_record? ? :commercial : @stop_area.kind,
+ input_html: { disabled: !@stop_area.new_record? },
+ include_blank: false,
+ item_wrapper_class: 'radio-inline',
+ wrapper: :horizontal_form,
+ disabled: !@stop_area.new_record?
.slave data-master="[name='stop_area[kind]']" data-value="commercial"
= f.input :parent_id, as: :select, :collection => [f.object.parent_id], input_html: { data: { select2_ajax: 'true', url: autocomplete_stop_area_referential_stop_areas_path(@stop_area_referential), initvalue: {id: f.object.parent_id, text: f.object.parent.try(:full_name)}}}
- %i(non_commercial commercial).each do |kind|