diff options
| author | Luc Donnet | 2012-10-11 09:39:25 +0200 |
|---|---|---|
| committer | Luc Donnet | 2012-10-11 09:39:25 +0200 |
| commit | 0f61b9f0de549290b9ebf4f5cc2d00b63c2fd02e (patch) | |
| tree | f2955e539117ecaa10331994fd42f0345e17fbf7 | |
| parent | 09419f7fbe6be35abba2b638431e41480e8cf764 (diff) | |
| parent | 8b8c8f3ec124e6327e535c13a4045c1d62859d52 (diff) | |
| download | chouette-core-0f61b9f0de549290b9ebf4f5cc2d00b63c2fd02e.tar.bz2 | |
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
40 files changed, 588 insertions, 136 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 0b98f9825..c5c0d5712 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -330,7 +330,7 @@ GEM therubyrhino_jar (1.7.4) thor (0.16.0) tilt (1.3.3) - treetop (1.4.10) + treetop (1.4.11) polyglot polyglot (>= 0.3.1) tzinfo (0.3.33) diff --git a/app/assets/javascripts/group_of_line.js.coffee b/app/assets/javascripts/group_of_line.js.coffee new file mode 100644 index 000000000..c49b0d54a --- /dev/null +++ b/app/assets/javascripts/group_of_line.js.coffee @@ -0,0 +1,15 @@ +jQuery -> + + switch_lines = (event) -> + event.preventDefault() + $('.group_of_lines.show .lines_detail').toggle('slow') + $('a.lines .switcher').toggle() + + $('.group_of_lines.show a.lines').click(switch_lines) + + + make_ajax_pagination = () -> + $.get(this.href, null, null, 'script') + false + + $('.group_of_lines.show .lines_detail .pagination a').live("click", make_ajax_pagination) diff --git a/app/assets/stylesheets/group_of_lines.css.scss b/app/assets/stylesheets/group_of_lines.css.scss new file mode 100644 index 000000000..24fbdce12 --- /dev/null +++ b/app/assets/stylesheets/group_of_lines.css.scss @@ -0,0 +1,101 @@ +// Place all the styles related to the lines controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +@import "common"; + +#workspace.group_of_lines.index +{ + .group_of_line:after { + @include after_div_for_object; + } + + .group_of_lines { + margin-top: 20px; + } + + .group_of_lines:after { + @include content_to_clear; + } + + .group_of_line { + @include div_for_object; + + /* to create multi-column index */ + width: 350px; + float: left; + padding-right: 10px; + + } +} + +#workspace.group_of_lines.show +{ + .summary p label { + font-weight: bold; + } + .lines_detail div.page_info { + margin-top: 0px; + } + + .line:after { + @include after_div_for_object; + } + + .lines { + margin-top: 10px; + } + + .lines:after { + @include content_to_clear; + } + .group_of_line_lines { + clear: both; + margin: 0px; + padding: 0px; + a { + cursor: pointer; + } + } + + .line { + @include div_for_object; + /* to create multi-column index */ + width: 250px; + float: left; + padding-right: 10px; + + .position { + width: 25px; + height: 20px; + float: left; + background-color: #61970B; + font-weight: bold; + color: white; + margin-right: 10px; + padding-left: 4px; + } + .color { + background-color: white; + width: 64px; + height: 64px; + float: left; + margin-right: 10px; + border: 1px solid #999; + + a { + text-decoration: none; + } + } + + .number { + font-size: 16px; + text-align: center; + font-weight: bold; + padding-top: 21px; + } + .name a { + display: inline; + } + } +} + diff --git a/app/assets/stylesheets/lines.css.scss b/app/assets/stylesheets/lines.css.scss index cbd39f90b..8632a72b2 100644 --- a/app/assets/stylesheets/lines.css.scss +++ b/app/assets/stylesheets/lines.css.scss @@ -77,6 +77,40 @@ .summary p label { font-weight: bold; } + .group_of_line { + @include div_for_object; + /* to create multi-column index */ + width: 250px; + float: left; + padding-right: 10px; + + .position { + width: 25px; + height: 20px; + float: left; + background-color: #61970B; + font-weight: bold; + color: white; + margin-right: 10px; + padding-left: 4px; + } + .color { + background-color: white; + width: 64px; + height: 64px; + float: left; + margin-right: 10px; + border: 1px solid #999; + + a { + text-decoration: none; + } + } + + .name a { + display: inline; + } + } } diff --git a/app/controllers/group_of_lines_controller.rb b/app/controllers/group_of_lines_controller.rb new file mode 100644 index 000000000..c758ad16d --- /dev/null +++ b/app/controllers/group_of_lines_controller.rb @@ -0,0 +1,47 @@ +class GroupOfLinesController < ChouetteController + defaults :resource_class => Chouette::GroupOfLine + respond_to :html + respond_to :xml + respond_to :json + respond_to :kml, :only => :show + + belongs_to :referential + + def show + @map = GroupOfLineMap.new(resource).with_helpers(self) + @lines = resource.lines.order(:name).paginate(:page => params[:page]) + show! + end + + def name_filter + respond_to do |format| + format.json { render :json => filtered_group_of_lines_maps} + end + + end + + protected + + def filtered_group_of_lines_maps + filtered_group_of_lines.collect do |group_of_line| + { :id => group_of_line.id, :name => group_of_line.name } + end + end + + def filtered_group_of_lines + referential.group_of_lines.select{ |t| t.name =~ /#{params[:q]}/i } + end + + def collection + @q = referential.group_of_lines.search(params[:q]) + @group_of_lines ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page]) + end + + def resource_url(group_of_line = nil) + referential_group_of_line_path(referential, group_of_line || resource) + end + + def collection_url + referential_group_of_lines_path(referential) + end +end diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index e85c29fc9..c8655908d 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -10,6 +10,7 @@ class LinesController < ChouetteController def show @map = LineMap.new(resource).with_helpers(self) @routes = @line.routes + @group_of_lines = @line.group_of_lines show! end @@ -20,8 +21,25 @@ class LinesController < ChouetteController respond_with(objects, :location => smart_collection_url) end + def name_filter + respond_to do |format| + format.json { render :json => filtered_lines_maps} + end + + end + protected + def filtered_lines_maps + filtered_lines.collect do |line| + { :id => line.id, :name => line.published_name } + end + end + + def filtered_lines + referential.lines.select{ |t| t.published_name =~ /#{params[:q]}/i } + end + def collection @q = referential.lines.search(params[:q]) @lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page]).includes([:network, :company]) diff --git a/app/controllers/time_table_dates_controller.rb b/app/controllers/time_table_dates_controller.rb deleted file mode 100644 index 100034394..000000000 --- a/app/controllers/time_table_dates_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -class TimeTableDatesController < ChouetteController - defaults :resource_class => Chouette::TimeTableDate, :collection_name => 'dates' - - respond_to :html - - belongs_to :referential do - belongs_to :time_table, :parent_class => Chouette::TimeTable - end - - def update - update! do |success, failure| - success.html { redirect_to referential_time_table_path(@referential,@time_table) } - end - end - - def create - create! do |success, failure| - success.html { redirect_to referential_time_table_path(@referential,@time_table) } - end - end - - def destroy - destroy! do |success, failure| - success.html { redirect_to referential_time_table_path(@referential,@time_table) } - end - end -end diff --git a/app/controllers/time_table_periods_controller.rb b/app/controllers/time_table_periods_controller.rb deleted file mode 100644 index 0614de2d5..000000000 --- a/app/controllers/time_table_periods_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -class TimeTablePeriodsController < ChouetteController - defaults :resource_class => Chouette::TimeTablePeriod, :collection_name => 'periods' - - respond_to :html - - belongs_to :referential do - belongs_to :time_table, :parent_class => Chouette::TimeTable - end - - def update - update! do |success, failure| - success.html { redirect_to referential_time_table_path(@referential,@time_table) } - end - end - - def create - create! do |success, failure| - success.html { redirect_to referential_time_table_path(@referential,@time_table) } - end - end - - def destroy - destroy! do |success, failure| - success.html { redirect_to referential_time_table_path(@referential,@time_table) } - end - end -end diff --git a/app/maps/group_of_line_map.rb b/app/maps/group_of_line_map.rb new file mode 100644 index 000000000..fdd8cac1d --- /dev/null +++ b/app/maps/group_of_line_map.rb @@ -0,0 +1,34 @@ +class GroupOfLineMap < ApplicationMap + + attr_reader :group_of_line, :group_of_line_style + + def initialize(group_of_line, group_of_line_style = nil) + @group_of_line = group_of_line + @group_of_line_style = group_of_line_style + end + + def map + @map ||= MapLayers::Map.new(id, :projection => projection("EPSG:900913"), :controls => controls) do |map, page| + page << map.add_layer(MapLayers::OSM_MAPNIK) + page << map.add_layer(google_physical) + page << map.add_layer(google_streets) + page << map.add_layer(google_hybrid) + page << map.add_layer(google_satellite) + + page.assign "stop_areas_layer", kml_layer([group_of_line.referential, group_of_line], :styleMap => StyleMap::StopAreasStyleMap.new(helpers).style_map) + + page << map.add_layer(:stop_areas_layer) + page << map.add_control( hover_control_display_name(:stop_areas_layer) ) + page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds + end + end + + def bounds + @bounds ||= GeoRuby::SimpleFeatures::Point.bounds(group_of_line.stop_areas.collect(&:geometry).compact) + end + + def ready? + Chouette::StopArea.bounds.present? + end + +end diff --git a/app/models/referential.rb b/app/models/referential.rb index ab4290cdd..b4601caee 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -47,6 +47,10 @@ class Referential < ActiveRecord::Base Chouette::Network.scoped end + def group_of_lines + Chouette::GroupOfLine.scoped + end + def companies Chouette::Company.scoped end diff --git a/app/views/group_of_lines/_form.erb b/app/views/group_of_lines/_form.erb new file mode 100644 index 000000000..0dcdc9379 --- /dev/null +++ b/app/views/group_of_lines/_form.erb @@ -0,0 +1,27 @@ +<%= semantic_form_for [@referential, @group_of_line] do |form| %> + <%= form.inputs do %> + <%= form.input :name %> + <%= form.input :comment %> + <%= form.input :objectid, :required => !@group_of_line.new_record?, :input_html => { :disabled => !@group_of_line.new_record? } %> + <% end %> + + <%= form.inputs do %> + <%= form.input :line_tokens, :label => t('.lines'), :as => :text, :input_html => { :"data-pre" => ( @group_of_line.lines.map { |line| { :id => line.id, :name => line.published_name } } ).to_json } %> + <% end %> + + <%= form.actions do %> + <%= form.action :submit, :as => :button %> + <%= form.action :cancel, :as => :link %> + <% end %> +<% end %> + +<script> + $(function() { + $( "#group_of_line_line_tokens" ).tokenInput('<%= name_filter_referential_lines_path(@referential, :format => :json) %>', { + crossDomain: false, + prePopulate: $('#line_tokens').data('pre'), + minChars: 3, + preventDuplicates: true, + }); + }); +</script> diff --git a/app/views/group_of_lines/_group_of_line.erb b/app/views/group_of_lines/_group_of_line.erb new file mode 100644 index 000000000..a1933744a --- /dev/null +++ b/app/views/group_of_lines/_group_of_line.erb @@ -0,0 +1,12 @@ +<%= div_for(group_of_line) do %> + <%= link_to group_of_line.name, [@referential, group_of_line] %> + <div class="info"> + <%= group_of_line.human_attribute_name('line_count') %>:<%= group_of_line.lines.count %> + <% if @line.nil? %> + <div class="actions"> + <%= link_to t("actions.edit"), edit_referential_group_of_line_path(@referential, group_of_line), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_group_of_line_path(@referential, group_of_line), :method => :delete, :data => {:confirm => t('group_of_lines.actions.destroy_confirm')}, :class => "remove" %> + </div> + <% end %> + </div> +<% end %> diff --git a/app/views/group_of_lines/_lines_detail.html.erb b/app/views/group_of_lines/_lines_detail.html.erb new file mode 100644 index 000000000..4d4058540 --- /dev/null +++ b/app/views/group_of_lines/_lines_detail.html.erb @@ -0,0 +1,10 @@ + <div class="page_info"> + <span class="search"> <%= t("will_paginate.page_entries_info.list") %></span> <%= page_entries_info @lines %> + </div> + <div class="lines paginated_content"> + <%= render :partial => "lines/line", :collection => @lines %> + </div> + <div class="pagination"> + <%= will_paginate @lines, :container => false %> + </div> + diff --git a/app/views/group_of_lines/edit.html.erb b/app/views/group_of_lines/edit.html.erb new file mode 100644 index 000000000..541e708ca --- /dev/null +++ b/app/views/group_of_lines/edit.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('group_of_lines.edit.title', :group_of_line => @group_of_line.name) %> + +<%= render "form" %> diff --git a/app/views/group_of_lines/index.html.erb b/app/views/group_of_lines/index.html.erb new file mode 100644 index 000000000..6f01455b8 --- /dev/null +++ b/app/views/group_of_lines/index.html.erb @@ -0,0 +1,26 @@ +<%= title_tag t('group_of_lines.index.title') %> + +<%= search_form_for @q, :url => referential_group_of_lines_path(@referential), :html => {:method => :get} do |f| %> + <%= f.label :name_cont, "#{t('.name')} :" %> + <%= f.text_field :name_cont %> + + <%= f.submit t('actions.search') %> <%= t("or") %> + <%= link_to t("cancel"), referential_group_of_lines_path(@referential) %> +<% end %> + +<div class="page_info"> + <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @group_of_lines %> +</div> +<div class="group_of_lines paginated_content"> + <%= render :partial => "group_of_line", :collection => @group_of_lines %> +</div> +<div class="pagination"> + <%= will_paginate @group_of_lines, :container => false %> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('group_of_lines.actions.new'), new_referential_group_of_line_path(@referential), :class => "add" %></li> + <br> +</ul> +<% end %> diff --git a/app/views/group_of_lines/new.html.erb b/app/views/group_of_lines/new.html.erb new file mode 100644 index 000000000..a2da652af --- /dev/null +++ b/app/views/group_of_lines/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('group_of_lines.new.title') %> + +<%= render "form" %> diff --git a/app/views/group_of_lines/show.html.erb b/app/views/group_of_lines/show.html.erb new file mode 100644 index 000000000..60c4b7def --- /dev/null +++ b/app/views/group_of_lines/show.html.erb @@ -0,0 +1,48 @@ +<%= title_tag t('group_of_lines.show.title', :group_of_line => @group_of_line.name )%> + +<div class="group_of_line_show"> + <%= @map.to_html %> + <div class="summary"> + <p> + <label><%= @group_of_line.human_attribute_name("name") %>: </label> + <%= @group_of_line.name %> + </p> + <p> + <label><%= @group_of_line.human_attribute_name("comment") %>: </label> + <%= @group_of_line.comment %> + </p> + <p> + <label><%= @group_of_line.human_attribute_name("objectid") %>: </label> + <%= @group_of_line.objectid %> + </p> + <p> + <label><%= @group_of_line.human_attribute_name("creation_time") %>: </label> + <%= l @group_of_line.creation_time %> + </p> + <p> + <label><%= @group_of_line.human_attribute_name("creator_id") %>: </label> + <%= @group_of_line.creator_id %> + </p> + </div> + + <p class="after_map" /> + <h3 class="group_of_line_lines"> + <a class="lines"><%= t('.lines') %> + <%= image_tag("icons/plus.png" , :class => "switcher") %> + <%= image_tag("icons/minus.png" , :class => "switcher" , :style => "display: none;") %> + </a> + </h3> + <div class="lines_detail" style="display: none;"> + <%= render :partial => "lines_detail" %> + </div> + + +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('group_of_lines.actions.edit'), edit_referential_group_of_line_path(@referential, @group_of_line), :class => "edit" %></li> + <li><%= link_to t('group_of_lines.actions.destroy'), referential_group_of_line_path(@referential, @group_of_line), :method => :delete, :data => {:confirm => t('group_of_lines.actions.destroy_confirm')} , :class => "remove" %></li> + <br> +</ul> +<% end %> diff --git a/app/views/group_of_lines/show.js.erb b/app/views/group_of_lines/show.js.erb new file mode 100644 index 000000000..bd8ac5a7f --- /dev/null +++ b/app/views/group_of_lines/show.js.erb @@ -0,0 +1,4 @@ +$(function (){ + $(".lines_detail").html("<%= escape_javascript(render(:partial => "lines_detail")) %>"); +}); + diff --git a/app/views/group_of_lines/show.kml.erb b/app/views/group_of_lines/show.kml.erb new file mode 100644 index 000000000..6b1a34688 --- /dev/null +++ b/app/views/group_of_lines/show.kml.erb @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kml xmlns="http://www.opengis.net/kml/2.2"> + <Document> + <% @group_of_line.commercial_stop_areas.each do |stop_area| %> + <Placemark id="<%= stop_area.id %>" > + <name><%= stop_area.name %></name> + <stop_area_type><%= stop_area.area_type.underscore %></stop_area_type> + <%= (stop_area.position or stop_area.default_position).kml_representation.html_safe %> + </Placemark> + <% end %> + </Document> +</kml> + diff --git a/app/views/help/group_of_lines.textile b/app/views/help/group_of_lines.textile new file mode 100644 index 000000000..f586f39f6 --- /dev/null +++ b/app/views/help/group_of_lines.textile @@ -0,0 +1,37 @@ +--- +layout: default +title: Groupes de lignes +--- + +h3. Définition + +Un groupe de lignes regroupe un ensemble de lignes assurant un type de service commun ; ces lignes ne sont pas forcément du même réseau. +Note 1: dans NeTex, le réseau est un groupe de ligne parmi les autres. + +Note 2: dans Neptune, une ligne ne peut appartenir qu'à un seul groupe de ligne; donc dans l'export Neptune, un seul groupe sera exporté. + + +h3. Attributs + +- Nom := nom du groupe de lignes +- Lignes := liste des "lignes":lines affectées au groupe + +p(attr_data). Données de gestion : + +- Identifiant Neptune := +clé unique pérenne identifiant le groupe de lignes pour les échanges Neptune +cet identifiant est composé de 3 parties : préfixe:type:id_technique +* préfixe : clé identifiant un producteur de données unique +* type = GroupOfLine : clé identifiant le type d'objet (valeur imposée) +* id_technique : valeur identifiant un seul object d'un type donné pour un même producteur +ce champ obligatoire est automatiquement généré s'il n'est pas renseigné +il est possible aussi de ne renseigner que l'identifiant technique auquel cas la valeur sera complétée automatiquement. +=: +- Date de création := date à laquelle l'objet a été créé ou modifié pour la dernière fois +- Version := version de l'objet (auto incrémenté à chaque modification) +- Créé par := compte utilisateur ayant procédé à la dernière modification + +h3. Implémentation + +p. TODO + diff --git a/app/views/help/lines.textile b/app/views/help/lines.textile index 7263dd04b..cb7dd89f1 100644 --- a/app/views/help/lines.textile +++ b/app/views/help/lines.textile @@ -24,6 +24,7 @@ mode de transport principal de la ligne les modes de transports particuliers sont indiqués au niveau de chaque course =: - Commentaire := zone de texte libre sur la ligne +- Groupes de lignes := "groupes de lignes":group_of_lines auxquels appartiet la ligne p(attr_data). Données de gestion : diff --git a/app/views/help/toc.textile b/app/views/help/toc.textile index e8e99c609..06ac07d62 100644 --- a/app/views/help/toc.textile +++ b/app/views/help/toc.textile @@ -12,6 +12,7 @@ h3. Sommaire # "Utilisateurs et Organisations":users # "Espaces de données":dataspaces # "Réseaux":networks +# "Groupes de lignes":group_of_lines # "Transporteurs":companies # "Lignes":lines ## "Séquences d'arrêts":routes diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 5df5f6b41..77873a855 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -47,6 +47,7 @@ <li><%= link_to t("layouts.tabs.dashboard").capitalize, referential_path(@referential), :class => ("current" if current_page?(referential_path(@referential))) %></li> <li><%= tab_link_to Chouette::Network, referential_networks_path(@referential) %></li> <li><%= tab_link_to Chouette::Company, referential_companies_path(@referential) %></li> + <li><%= tab_link_to Chouette::GroupOfLine, referential_group_of_lines_path(@referential) %></li> <li><%= tab_link_to Chouette::Line, referential_lines_path(@referential) %></li> <li><%= tab_link_to Chouette::StopArea, referential_stop_areas_path(@referential) %></li> <li><%= tab_link_to Chouette::ConnectionLink, referential_connection_links_path(@referential) %></li> diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb index 898f04223..f44c038d7 100644 --- a/app/views/lines/_form.erb +++ b/app/views/lines/_form.erb @@ -12,8 +12,23 @@ <%= form.input :objectid, :required => !@line.new_record?, :input_html => { :disabled => !@line.new_record? } %> <% end %> + <%= form.inputs do %> + <%= 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 } %> + <% end %> + <%= form.actions do %> <%= form.action :submit, :as => :button %> <%= form.action :cancel, :as => :link %> <% end %> <% end %> + +<script> + $(function() { + $( "#line_group_of_line_tokens" ).tokenInput('<%= name_filter_referential_group_of_lines_path(@referential, :format => :json) %>', { + crossDomain: false, + prePopulate: $('#group_of_line_tokens').data('pre'), + minChars: 3, + preventDuplicates: true, + }); + }); +</script> diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index 9fe32ce83..444d5808f 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -21,9 +21,11 @@ <% else %> <%= line.human_attribute_name('company') %> <%= link_to_if( line.company, line.company.name, referential_company_path(@referential, line.company), :title => "#{line.human_attribute_name('company')} #{line.company.name}" ) %> <% end %> + <% if @group_of_line.nil? %> <div class="actions"> <%= link_to t("actions.edit"), edit_referential_line_path(@referential, line), :class => "edit" %> | <%= link_to t("actions.destroy"), referential_line_path(@referential, line), :method => :delete, :confirm => t('lines.actions.destroy_confirm'), :class => "remove" %> </div> + <% end %> </div> <% end %> diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index 6da0bf61e..ad91e1dfc 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -66,6 +66,14 @@ <%= render :partial => "routes/route", :collection => @routes %> </div> +<% if @line.group_of_lines.any? %> + <h3 class="line_group_of_lines"><%= t('.group_of_lines') %> + </h3> + <div class="group_of_lines_detail"> + <%= render :partial => "group_of_lines/group_of_line", :collection => @group_of_lines %> + </div> +<% end %> + <% content_for :sidebar do %> <ul class="actions"> <li><%= link_to t('lines.actions.edit'), edit_referential_line_path(@referential, @line), :class => "edit" %></li> diff --git a/app/views/referentials/_counts.html.erb b/app/views/referentials/_counts.html.erb index 5b615d9a5..f6296f52e 100644 --- a/app/views/referentials/_counts.html.erb +++ b/app/views/referentials/_counts.html.erb @@ -15,6 +15,10 @@ <td class="value"> <%= @referential.companies.size %></td> </tr> <tr> + <td class="object" colspan="2"><%= Referential.human_attribute_name("group_of_lines") %></td> + <td class="value"> <%= @referential.group_of_lines.size %></td> + </tr> + <tr> <td class="object" colspan="2"><%= Referential.human_attribute_name("lines") %></td> <td class="value"> <%= @referential.lines.size %></td> </tr> diff --git a/app/views/referentials/_referential.erb b/app/views/referentials/_referential.erb index 4e74b081c..fff6b47fd 100644 --- a/app/views/referentials/_referential.erb +++ b/app/views/referentials/_referential.erb @@ -1,10 +1,10 @@ <%= div_for(referential) do %> <%= link_to referential.name, referential %> <div class="info"> - <%= t('.lines') %>: <span class="lines_count"></span> - - <%= t('.networks') %>: <span class="networks_count"></span> - - <%= t('.vehicle_journeys') %>: <span class="vehicle_journeys_count"></span> - - <%= t('.time_tables') %>: <span class="time_tables_count"></span> + <%= referential.human_attribute_name('lines') %>: <span class="lines_count"></span> - + <%= referential.human_attribute_name('networks') %>: <span class="networks_count"></span> - + <%= referential.human_attribute_name('vehicle_journeys') %>: <span class="vehicle_journeys_count"></span> - + <%= referential.human_attribute_name('time_tables') %>: <span class="time_tables_count"></span> <div class="actions"> <%= link_to t("actions.edit"), edit_referential_path(referential), :class => "edit" %> | <%= link_to t("actions.destroy"), referential_path(referential), :method => :delete, :confirm => t('referentials.actions.destroy_confirm'), :class => "remove" %> diff --git a/app/views/time_table_dates/_form.html.erb b/app/views/time_table_dates/_form.html.erb deleted file mode 100644 index 8d2231be4..000000000 --- a/app/views/time_table_dates/_form.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%= semantic_form_for [@referential, @time_table, @time_table_date] do |form| %> - <%= form.inputs do %> - <%= form.input :date, :as => :date_picker, :label => @time_table_date.human_attribute_name("date") %> - - <% end %> - <%= form.actions do %> - <%= form.action :submit, :as => :button %> - <%= form.action :cancel, :as => :link , :url => referential_time_table_path(@referential, @time_table) %> - <% end %> -<% end %> - diff --git a/app/views/time_table_dates/new.html.erb b/app/views/time_table_dates/new.html.erb deleted file mode 100644 index 4e6119b9a..000000000 --- a/app/views/time_table_dates/new.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= title_tag t('time_table_dates.new.title') %> - -<%= render "form" %> - diff --git a/app/views/time_table_periods/_form.html.erb b/app/views/time_table_periods/_form.html.erb deleted file mode 100644 index 9bfda0aa4..000000000 --- a/app/views/time_table_periods/_form.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%= semantic_form_for [@referential, @time_table, @time_table_period] do |form| %> - <%= form.inputs do %> - <%= form.input :period_start, :as => :date_picker, :label => @time_table_period.human_attribute_name("period_start") %> - <%= form.input :period_end, :as => :date_picker, :label => @time_table_period.human_attribute_name("period_end") %> - <% end %> - <%= form.actions do %> - <%= form.action :submit, :as => :button %> - <%= form.action :cancel, :as => :link , :url => referential_time_table_path(@referential, @time_table) %> - <% end %> -<% end %> - diff --git a/app/views/time_table_periods/new.html.erb b/app/views/time_table_periods/new.html.erb deleted file mode 100644 index 5088637a1..000000000 --- a/app/views/time_table_periods/new.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= title_tag t('time_table_periods.new.title') %> - -<%= render "form" %> - diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb index 0c0ccaecc..dd1a0dbaf 100644 --- a/app/views/vehicle_journeys/_form.html.erb +++ b/app/views/vehicle_journeys/_form.html.erb @@ -62,6 +62,7 @@ crossDomain: false, prePopulate: $('#time_table_tokens').data('pre'), minChars: 3, + preventDuplicates: true, }); }); </script> diff --git a/config/locales/group_of_lines.yml b/config/locales/group_of_lines.yml new file mode 100644 index 000000000..d4475b03d --- /dev/null +++ b/config/locales/group_of_lines.yml @@ -0,0 +1,78 @@ +en: + group_of_lines: + actions: + new: Add a new group of lines + edit: Edit this group of lines + destroy: Remove this group of lines + destroy_confirm: "Are you sure you want destroy this group of lines?" + new: + title: "Add a new group of lines" + edit: + title: "Update group of lines %{group_of_line}" + show: + title: "Group of lines %{group_of_line}" + lines: Lines list + index: + title: "Group of Lines" + name: Name + form: + lines: Associated lines + activerecord: + models: + group_of_line: + zero: group of line + one: group of line + other: groups of lines + attributes: + group_of_line: + name: "Name" + comment: "Comments" + line_count: Number of lines + objectid: Neptune identifier + object_version: Version + creation_time: Created on + creator_id: Created by + formtastic: + hints: + group_of_line: + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + +fr: + group_of_lines: + actions: + new: Ajouter un groupe de lignes + edit: Modifier ce groupe de lignes + destroy: Supprimer ce groupe de lignes + destroy_confirm: "Etes vous sûr de détruire ce groupe de lignes ?" + new: + title: "Ajouter un groupe de lignes" + edit: + title: Modifier le groupe de lignes %{group_of_line} + show: + title: Groupe de lignes %{group_of_line} + lines: Liste des lignes + index: + title: "Groupes de lignes" + name: Nom + form: + lines: Lignes associées + activerecord: + models: + group_of_line: + zero: groupe de lignes + one: groupe de lignes + other: groupes de lignes + attributes: + group_of_line: + name: "Nom" + comment: "Commentaire" + line_count: Nombre de lignes + objectid: "Identifiant Neptune" + object_version: "Version" + creation_time: "Créé le" + creator_id: "Créé par" + formtastic: + hints: + group_of_line: + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + diff --git a/config/locales/lines.yml b/config/locales/lines.yml index 7e37501fb..d46f30330 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -13,6 +13,7 @@ en: show: title: Line %{line} itineraries: "Line's route list" + group_of_lines: Groups of lines index: title: Lines name_or_number: Name or number @@ -26,6 +27,8 @@ en: select_all: Select all deselect_all: Deselect all unset: undefined + form: + group_of_lines: Associated groups of lines activerecord: models: line: @@ -67,6 +70,7 @@ fr: show: title: Ligne %{line} itineraries: "Liste des séquences d'arrêts de la ligne" + group_of_lines: Groupes de lignes index: name_or_number: Nom ou indice title: Lignes @@ -80,6 +84,8 @@ fr: select_all: Tout sélectionner deselect_all: Tout désélectionner unset: non défini + form: + group_of_lines: Groupes de lignes associés activerecord: models: line: diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml index 2b003e3e1..4d15af171 100644 --- a/config/locales/referentials.yml +++ b/config/locales/referentials.yml @@ -47,6 +47,7 @@ en: start_validity_period: from end_validity_period: to networks: Networks + group_of_lines: Group of lines lines: Lines vehicle_journeys: Vehicle journeys companies: Companies @@ -105,7 +106,7 @@ fr: name: Nom slug: Code prefix: Préfixe des identifiants Neptune - projection_type: Système de référence spatiale optionnel (SRID) + projection_type: Système de référence spatiale (SRID) optionnel time_zone: Fuseau horaire upper_corner: "Point haut/droite de l'emprise par défaut" lower_corner: "Point bas/gauche de l'emprise par défaut" @@ -115,6 +116,7 @@ fr: start_validity_period: du end_validity_period: au networks: Réseaux + group_of_lines: Groupes de lignes lines: Lignes vehicle_journeys: Courses companies: Transporteurs diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml index 2d920435d..124ab05c6 100644 --- a/config/locales/stop_areas.yml +++ b/config/locales/stop_areas.yml @@ -101,7 +101,7 @@ fr: genealogical: Lien entre arrêts genealogical_routing: "Liens de l'ITL" index: - name_or_country_code: Nom ou Code Postal + name_or_country_code: Nom ou Code INSEE title: Arrêts selection: Filtrer sur selection_all: Tous diff --git a/config/locales/time_table_dates.yml b/config/locales/time_table_dates.yml deleted file mode 100644 index 7f0fc6497..000000000 --- a/config/locales/time_table_dates.yml +++ /dev/null @@ -1,21 +0,0 @@ -en: - time_table_dates: - new: - title: "Timetable : add a new date" - activerecord: - models: - time_table_date: Date - attributes: - time_table_date: - date: Calendar date - -fr: - time_table_dates: - new: - title: "Calendrier : ajouter une date" - activerecord: - models: - time_table_date: Date - attributes: - time_table_date: - date: Date diff --git a/config/locales/time_table_periods.yml b/config/locales/time_table_periods.yml deleted file mode 100644 index 6d71cd681..000000000 --- a/config/locales/time_table_periods.yml +++ /dev/null @@ -1,23 +0,0 @@ -en: - time_table_periods: - new: - title: "Timetable : add a new period" - activerecord: - models: - time_table_period: Period - attributes: - time_table_period: - period_start: From - period_end: To - -fr: - time_table_periods: - new: - title: "Calendrier : ajouter une période d'application" - activerecord: - models: - time_table_period: Période - attributes: - time_table_period: - period_start: Du - period_end: Au diff --git a/config/routes.rb b/config/routes.rb index 6f51978a3..27f586261 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,7 +14,32 @@ ChouetteIhm::Application.routes.draw do resources :referentials do resources :stop_point_areas match 'lines' => 'lines#destroy_all', :via => :delete - resources :lines, :networks do + resources :group_of_lines do + resources :stop_areas do + resources :stop_area_parents + resources :stop_area_children + resources :stop_area_routing_lines + resources :stop_area_routing_stops + member do + get 'add_children' + get 'select_parent' + get 'add_routing_lines' + get 'add_routing_stops' + end + end + resources :lines + collection do + get :name_filter + end + end + + resources :lines do + collection do + get :name_filter + end + end + + resources :lines, :networks, :group_of_lines do resources :stop_areas do resources :stop_area_parents resources :stop_area_children |
