aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinhui Xu2016-12-15 11:47:02 +0100
committerGitHub2016-12-15 11:47:02 +0100
commited25e709fc16e5dee5c326eda0479d492f137e35 (patch)
tree37417385e14b5e9bd6d876f9da9412cb1d072902
parentd70478af0ac8606723b313b86beaa611631646a2 (diff)
parent15d8febd4e796937b9b08f39e8541e0075035be2 (diff)
downloadchouette-core-ed25e709fc16e5dee5c326eda0479d492f137e35.tar.bz2
Merge branch 'staging' into enum_stop_area_area_type
-rw-r--r--app/assets/javascripts/es6_browserified/components/BSelect2.js4
-rw-r--r--app/assets/javascripts/es6_browserified/components/Todo.js2
-rw-r--r--app/assets/javascripts/es6_browserified/reducers/todos.js2
-rw-r--r--app/assets/javascripts/es6_browserified/stop_points.js1
-rw-r--r--app/controllers/autocomplete_stop_areas_controller.rb3
-rw-r--r--app/helpers/routes_helper.rb2
-rw-r--r--app/models/chouette/stop_area.rb16
-rw-r--r--app/views/autocomplete_stop_areas/index.rabl3
-rw-r--r--app/views/lines/_form.html.slim32
-rw-r--r--app/views/lines/show.html.slim6
-rw-r--r--app/views/referential_stop_areas/index.html.slim6
-rw-r--r--app/views/routes/show.html.slim3
-rw-r--r--app/views/shared/_lines_search_form.html.slim4
-rw-r--r--app/views/stop_areas/_stop_area.html.slim17
-rw-r--r--app/views/stop_areas/index.html.slim42
-rw-r--r--config/locales/lines.en.yml2
-rw-r--r--config/locales/lines.fr.yml2
-rw-r--r--config/locales/stop_areas.en.yml1
-rw-r--r--config/locales/stop_areas.fr.yml1
19 files changed, 73 insertions, 76 deletions
diff --git a/app/assets/javascripts/es6_browserified/components/BSelect2.js b/app/assets/javascripts/es6_browserified/components/BSelect2.js
index ec0d130d2..0bd53a083 100644
--- a/app/assets/javascripts/es6_browserified/components/BSelect2.js
+++ b/app/assets/javascripts/es6_browserified/components/BSelect2.js
@@ -21,7 +21,9 @@ class BSelect3 extends React.Component{
}
onChange(e) {
this.props.onChange(this.props.index, {
- text: e.currentTarget.textContent, stoparea_id: e.currentTarget.value
+ text: e.currentTarget.textContent,
+ stoparea_id: e.currentTarget.value,
+ user_objectid: e.params.data.user_objectid
})
this.setState({edit: false})
}
diff --git a/app/assets/javascripts/es6_browserified/components/Todo.js b/app/assets/javascripts/es6_browserified/components/Todo.js
index 6d8a6988f..f2932ab1d 100644
--- a/app/assets/javascripts/es6_browserified/components/Todo.js
+++ b/app/assets/javascripts/es6_browserified/components/Todo.js
@@ -8,7 +8,7 @@ const Todo = (props) => {
<div className='row'>
<div className='col-lg-5 col-md-5 col-sm-4 col-xs-5'>
<div style={{display: 'inline-block', width: '20%', verticalAlign: 'middle', textAlign: 'right', marginTop: 24}}>
- <span className='label label-default' style={{marginRight: 10}}>{props.value.stoparea_id}</span>
+ <span className='label label-default' style={{marginRight: 10}}>{props.value.user_objectid}</span>
</div>
<div style={{display: 'inline-block', width: '80%', verticalAlign: 'middle'}}>
diff --git a/app/assets/javascripts/es6_browserified/reducers/todos.js b/app/assets/javascripts/es6_browserified/reducers/todos.js
index 916cd4704..215a3e2c2 100644
--- a/app/assets/javascripts/es6_browserified/reducers/todos.js
+++ b/app/assets/javascripts/es6_browserified/reducers/todos.js
@@ -58,7 +58,7 @@ const todos = (state = [], action) => {
return Object.assign(
{},
t,
- {text: action.text.text, stoparea_id: action.text.stoparea_id}
+ {stoppoint_id: "", text: action.text.text, stoparea_id: action.text.stoparea_id, user_objectid: action.text.user_objectid}
)
} else {
return t
diff --git a/app/assets/javascripts/es6_browserified/stop_points.js b/app/assets/javascripts/es6_browserified/stop_points.js
index f594c0da4..d5f53fb4f 100644
--- a/app/assets/javascripts/es6_browserified/stop_points.js
+++ b/app/assets/javascripts/es6_browserified/stop_points.js
@@ -24,6 +24,7 @@ const getInitialState = () => {
state.push({
stoppoint_id: value.stoppoint_id,
stoparea_id: value.stoparea_id,
+ user_objectid: value.user_objectid,
index: index,
city_name: value.city_name,
zip_code: value.zip_code,
diff --git a/app/controllers/autocomplete_stop_areas_controller.rb b/app/controllers/autocomplete_stop_areas_controller.rb
index 31ecae9f5..92d4c631f 100644
--- a/app/controllers/autocomplete_stop_areas_controller.rb
+++ b/app/controllers/autocomplete_stop_areas_controller.rb
@@ -24,7 +24,8 @@ class AutocompleteStopAreasController < InheritedResources::Base
else
result = referential.stop_areas
end
- @stop_areas = result.where("name LIKE '%#{params[:q]}%' OR registration_number LIKE '%#{params[:q]}%' OR objectid LIKE '%#{params[:q]}%' ").limit(50)
+ args = [].tap{|arg| 3.times{arg << "%#{params[:q]}%"}}
+ @stop_areas = result.where("name ILIKE ? OR registration_number ILIKE ? OR objectid ILIKE ?", *args).limit(50)
@stop_areas
end
diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb
index 99278625d..b55308eb8 100644
--- a/app/helpers/routes_helper.rb
+++ b/app/helpers/routes_helper.rb
@@ -17,7 +17,7 @@ module RoutesHelper
route.stop_points.includes(:stop_area).map do |stop_point|
stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code")
stop_point_attributes = stop_point.attributes.slice("for_boarding","for_alighting")
- stop_area_attributes.merge(stop_point_attributes).merge(stoppoint_id: stop_point.id, stoparea_id: stop_point.stop_area.id)
+ stop_area_attributes.merge(stop_point_attributes).merge(stoppoint_id: stop_point.id, stoparea_id: stop_point.stop_area.id).merge(user_objectid: stop_point.stop_area.user_objectid)
end.to_json
end
diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb
index 0d2595684..cba43b3ff 100644
--- a/app/models/chouette/stop_area.rb
+++ b/app/models/chouette/stop_area.rb
@@ -87,6 +87,14 @@ class Chouette::StopArea < Chouette::ActiveRecord
end
end
+ def user_objectid
+ if objectid =~ /^.*:([0-9A-Za-z_-]+):STIF$/
+ $1
+ else
+ id.to_s
+ end
+ end
+
def children_in_depth
return [] if self.children.empty?
@@ -119,15 +127,11 @@ class Chouette::StopArea < Chouette::ActiveRecord
end
def lines
- if (area_type == 'CommercialStopPoint')
- self.children.collect(&:stop_points).flatten.collect(&:route).flatten.collect(&:line).flatten.uniq
- else
- self.stop_points.collect(&:route).flatten.collect(&:line).flatten.uniq
- end
+ []
end
def routes
- self.stop_points.collect(&:route).flatten.uniq
+ []
end
def self.commercial
diff --git a/app/views/autocomplete_stop_areas/index.rabl b/app/views/autocomplete_stop_areas/index.rabl
index 6d81442c7..adec16cff 100644
--- a/app/views/autocomplete_stop_areas/index.rabl
+++ b/app/views/autocomplete_stop_areas/index.rabl
@@ -9,7 +9,8 @@ node do |stop_area|
:short_name => truncate(stop_area.name, :length => 30) || "",
:zip_code => stop_area.zip_code || "",
:city_name => stop_area.city_name || "",
- :short_city_name => truncate(stop_area.city_name, :length => 15) || ""
+ :short_city_name => truncate(stop_area.city_name, :length => 15) || "",
+ :user_objectid => stop_area.user_objectid
}
end
diff --git a/app/views/lines/_form.html.slim b/app/views/lines/_form.html.slim
index cbb50ae28..d7b5a65ed 100644
--- a/app/views/lines/_form.html.slim
+++ b/app/views/lines/_form.html.slim
@@ -1,21 +1,21 @@
= semantic_form_for [@line_referential, @line] do |form|
= form.inputs do
- = form.input :network, as: :select, :collection => Chouette::Network.all, include_blank: false
- = form.input :company, as: :select, :collection => Chouette::Company.all, include_blank: false
- = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.name") }
- = form.input :published_name
- = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.registration_number")}
- = form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.number") }
- = form.input :transport_mode, include_blank: false
- = form.input :color, as: :string
- = form.input :text_color
- = form.input :stable_id
- = form.input :url
- = form.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true
- = form.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true
- = form.input :comment
- = form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.objectid")}
- = form.input :group_of_line_tokens, :label => t('.group_of_lines'), as: :text, :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json }
+ / = form.input :network, as: :select, :collection => Chouette::Network.all, include_blank: false
+ / = form.input :company, as: :select, :collection => Chouette::Company.all, include_blank: false
+ / = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.name") }
+ / = form.input :published_name
+ / = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.registration_number")}
+ / = form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.number") }
+ / = form.input :transport_mode, include_blank: false
+ / = form.input :color, as: :string
+ / = form.input :text_color
+ / = form.input :stable_id
+ / = form.input :url
+ / = form.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true
+ / = form.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true
+ / = form.input :comment
+ / = form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.objectid")}
+ / = form.input :group_of_line_tokens, :label => t('.group_of_lines'), as: :text, :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json }
.footnotes_block
h3 = t("footnotes.index.title")
diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim
index f4a449432..d887d2181 100644
--- a/app/views/lines/show.html.slim
+++ b/app/views/lines/show.html.slim
@@ -109,12 +109,6 @@
/ = " : "
/ = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("flexible_service = ?", true).count + @line.vehicle_journeys.where("flexible_service = ?", false).count)
- p
- label = "#{@line.human_attribute_name('footnotes')} : "
- ul
- - @line.footnotes.each do |footnote|
- li = "#{footnote.code} : #{footnote.label}"
-
/ p
/ label = "#{@line.human_attribute_name('comment')} : "
/ = @line.comment
diff --git a/app/views/referential_stop_areas/index.html.slim b/app/views/referential_stop_areas/index.html.slim
index 967d91c48..604a5a76e 100644
--- a/app/views/referential_stop_areas/index.html.slim
+++ b/app/views/referential_stop_areas/index.html.slim
@@ -7,7 +7,7 @@
.panel.panel-default
.panel-heading
.input-group.col-md-9.col-sm-9
- = f.text_field :name_cont, :placeholder => "#{t('.name')}", class: 'form-control'
+ = f.text_field :name_or_objectid_cont, placeholder: t('.name_or_objectid'), class: 'form-control'
.input-group-btn
button.btn.btn-default type="submit"
i.fa.fa-search
@@ -23,6 +23,8 @@
= f.text_field :zip_code_cont, placeholder: "#{t('.zip_code')}", class: 'form-control typeahead', style: 'width: 100%'
.col-sm-3
= f.select(:area_type_cont, Chouette::StopArea.area_type.options, { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t(".area_type") })
+ = f.text_field :city_name_cont, placeholder: "#{t('.city_name')}", class: 'form-control typeahead', style: 'width: 100%'
+ .col-sm-3
#stop_areas
= render 'stop_areas'
@@ -33,4 +35,4 @@
li
= link_to t('stop_areas.actions.new'), new_referential_stop_area_path(@referential), class: 'add'
li
- / = link_to t('stop_areas.actions.default_geometry'), default_geometry_referential_stop_areas_path(@referential), :method => :put, :class => "calculator"
+ / = link_to t('stop_areas.actions.default_geometry'), default_geometry_referential_stop_areas_path(@referential), :method => :put, :class => "calculator" \ No newline at end of file
diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim
index cfd71e16a..c914030c9 100644
--- a/app/views/routes/show.html.slim
+++ b/app/views/routes/show.html.slim
@@ -59,10 +59,9 @@ p.after_map
div style='display: table-cell;vertical-align: middle;'
div style='display: inline-block;width: 10%;vertical-align: middle;text-align: right;'
span.label.label-default style='margin-right: 10px;'
- = "#{point.stop_area.id}"
+ = "#{point.stop_area.user_objectid}"
div style='display: inline-block;width: 90%;vertical-align: middle;'
= linktxt
-
/ .panel.panel-default
/ .panel-heading
diff --git a/app/views/shared/_lines_search_form.html.slim b/app/views/shared/_lines_search_form.html.slim
index ec355ad8e..c12ee132b 100644
--- a/app/views/shared/_lines_search_form.html.slim
+++ b/app/views/shared/_lines_search_form.html.slim
@@ -19,4 +19,6 @@
.col-xs-3
= f.select(:company_id_eq, referential.companies.collect { |c| [c.name, c.id] }.unshift([t("lines.index.no_networks"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_companies") })
.col-xs-3
- = f.select(:transport_mode_eq, Chouette::Line.transport_mode.values.collect { |v| [ I18n.t("enumerize.line.transport_mode.#{v}"), v] }.unshift([t("lines.index.no_transport_modes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_modes") })
+ = f.select(:transport_mode_eq, Chouette::Line.transport_mode.values.collect { |v| [ I18n.t("enumerize.line.transport_mode.#{v}"), v] }.unshift([t("lines.index.no_transport_modes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_modes") })
+ .col-xs-3
+ = f.select(:transport_submode_eq, Chouette::Line.transport_submode.values.collect { |v| [ I18n.t("enumerize.line.transport_submode.#{v}"), v] }.unshift([t("lines.index.no_transport_submodes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_submodes") })
diff --git a/app/views/stop_areas/_stop_area.html.slim b/app/views/stop_areas/_stop_area.html.slim
index 2d381dd10..73c565ce9 100644
--- a/app/views/stop_areas/_stop_area.html.slim
+++ b/app/views/stop_areas/_stop_area.html.slim
@@ -31,20 +31,3 @@
p
= "#{t('.address')} : "
= (stop_area.zip_code.present? || stop_area.city_name.present?) ? "#{stop_area.zip_code} #{stop_area.city_name}" : t(".no_object")
-
- p
- - if stop_area.area_type == 'ITL'
- = "#{t('.lines')} : "
- - if stop_area.routing_lines.blank?
- = t(".no_object")
- - else
- - stop_area.routing_lines.each do |line|
- span.label.label-default.line = line.number
-
- - else
- = "#{t('.lines')} : "
- - if stop_area.lines.blank?
- = t(".no_object")
- - else
- - stop_area.lines.each do |line|
- span.label.label-default.line = line.number || truncate( line.name, length: 4 )
diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim
index 0e8d9281d..24f4db38c 100644
--- a/app/views/stop_areas/index.html.slim
+++ b/app/views/stop_areas/index.html.slim
@@ -4,26 +4,28 @@
= @country_codes.to_json
= search_form_for @q, url: stop_area_referential_stop_areas_path(@stop_area_referential), remote: true, html: { method: :get, class: "form", id: "search", role: "form"} do |f|
- .well.well-sm
- .input-group
- = f.text_field :name_or_objectid_cont, placeholder: t('.name_or_objectid'), class: 'form-control'
-
- .input-group-btn
- button.btn.btn-primary type="submit"
- span.fa.fa-search
-
- a data-toggle="collapse" data-parent="#search" href="#advanced_search"
- i.fa.fa-plus
- = "#{t('.advanced_search')}"
-
-
- #advanced_search.panel-collapse.collapse
- .panel-body
- .row
- .col-sm-3
- = f.text_field :zip_code_cont, placeholder: "#{t('.zip_code')}", class: 'form-control typeahead'
- .col-md-5.col-sm-5
- = f.select(:area_type_cont, Chouette::StopArea.area_type.options, { include_blank: t('.area_type') }, { class: 'form-control' })
+ .panel.panel-default
+ .panel-heading
+ .input-group.col-md-9.col-sm-9
+ = f.text_field :name_or_objectid_cont, placeholder: t('.name_or_objectid'), class: 'form-control'
+
+ .input-group-btn
+ button.btn.btn-primary type="submit"
+ span.fa.fa-search
+
+ a data-toggle="collapse" data-parent="#search" href="#advanced_search"
+ i.fa.fa-plus
+ = "#{t('.advanced_search')}"
+
+ #advanced_search.panel-collapse.collapse
+ .panel-body
+ .row
+ .col-sm-3
+ = f.text_field :zip_code_cont, placeholder: "#{t('.zip_code')}", class: 'form-control typeahead', style: 'width: 100%'
+ .col-sm-3
+ = f.text_field :city_name_cont, placeholder: "#{t('.city_name')}", class: 'form-control typeahead', style: 'width: 100%'
+ .col-sm-3
+ = f.select(:area_type_cont, Chouette::StopArea.area_type.options, { include_blank: t('.area_type') }, { class: 'form-control' })
#stop_areas
= render 'stop_areas'
diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml
index 33e979a00..c7de51eb6 100644
--- a/config/locales/lines.en.yml
+++ b/config/locales/lines.en.yml
@@ -28,10 +28,12 @@ en:
no_companies: "No companies"
no_group_of_lines: "No group of lines"
no_transport_modes: No transport mode
+ no_transport_submodes: No transport sub mode
all_networks: "All networks"
all_companies: "All companies"
all_group_of_lines: "All group of lines"
all_transport_modes: All transport modes
+ all_transport_submodes: All transport sub modes
multi_selection: "Multiple selection"
multi_selection_enable: "Enable multiple selection"
multi_selection_disable: "Disable multiple selection"
diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml
index 58331b363..4fc32acc7 100644
--- a/config/locales/lines.fr.yml
+++ b/config/locales/lines.fr.yml
@@ -28,10 +28,12 @@ fr:
no_companies: "Aucun transporteurs"
no_group_of_lines: "Aucun groupes de ligne"
no_transport_modes: Aucun mode de transport
+ no_transport_submodes: Aucun sous mode de transport
all_networks: "Tous les réseaux"
all_companies: "Tous les transporteurs"
all_group_of_lines: "Tous les groupes de ligne"
all_transport_modes: Tous les modes de transport
+ all_transport_submodes: Tous les sous modes de transport
multi_selection: "Sélection multiple"
multi_selection_enable: "Activer la sélection multiple"
multi_selection_disable: "Désactiver la sélection multiple"
diff --git a/config/locales/stop_areas.en.yml b/config/locales/stop_areas.en.yml
index d06da3e76..9e5f605d9 100644
--- a/config/locales/stop_areas.en.yml
+++ b/config/locales/stop_areas.en.yml
@@ -53,6 +53,7 @@ en:
name: "Search by name..."
name_or_objectid: "Search by name or by objectid..."
zip_code: "Zip Code"
+ city_name: "City name"
selection: "Filter on"
selection_all: "All"
area_type: "Area Type"
diff --git a/config/locales/stop_areas.fr.yml b/config/locales/stop_areas.fr.yml
index 0015b571d..b7d281ebe 100644
--- a/config/locales/stop_areas.fr.yml
+++ b/config/locales/stop_areas.fr.yml
@@ -58,6 +58,7 @@ fr:
name: "Recherche par nom..."
name_or_objectid: "Recherche par nom ou par objectid..."
zip_code: "Code Postal"
+ city_name: "Commune"
title: "Arrêts"
selection: "Filtrer sur"
selection_all: "Tous"