diff options
35 files changed, 739 insertions, 18 deletions
@@ -26,6 +26,7 @@ gem 'inherited_resources' gem 'will_paginate', '~> 3.0' gem 'ransack' gem 'squeel' +gem 'RedCloth' gem "acts_as_tree", :git => "git://github.com/dryade/acts_as_tree.git" gem 'apartment', :git => 'git://github.com/dryade/apartment.git' diff --git a/Gemfile.lock b/Gemfile.lock index c22b08942..2e0505b07 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://chouette.dryade.priv/ninoxe - revision: 8b4136d1c06cc03c22443cae4408b5b173dca9b5 + revision: d2bc7fde85bb5faf8830883a026ef0183f964eaa specs: ninoxe (0.0.8) GeoRuby @@ -51,6 +51,8 @@ GEM remote: http://rubygems.org/ specs: GeoRuby (1.3.4) + RedCloth (4.2.9) + RedCloth (4.2.9-java) SyslogLogger (1.4.0) hoe (>= 1.2.0) actionmailer (3.1.3) @@ -261,7 +263,7 @@ GEM shoulda-context (1.0.0) shoulda-matchers (1.0.0) spoon (0.0.1) - sprockets (2.0.3) + sprockets (2.0.4) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) @@ -296,6 +298,7 @@ PLATFORMS ruby DEPENDENCIES + RedCloth SyslogLogger activerecord-jdbcpostgresql-adapter! activerecord-jdbcsqlite3-adapter diff --git a/app/assets/stylesheets/connection_links.css.scss b/app/assets/stylesheets/connection_links.css.scss new file mode 100644 index 000000000..e3aedc918 --- /dev/null +++ b/app/assets/stylesheets/connection_links.css.scss @@ -0,0 +1,40 @@ +// 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.connection_links.index +{ + .connection_link:after { + @include after_div_for_object; + } + + .connection_links { + margin-top: 20px; + } + + .connection_links:after { + @include content_to_clear; + } + + .connection_link { + @include div_for_object; + + /* to create multi-column index */ + width: 350px; + float: left; + padding-right: 10px; + } +} + + +#workspace.connection_links.show +{ + + .summary p label { + font-weight: bold; + } +} + + + diff --git a/app/controllers/connection_links_controller.rb b/app/controllers/connection_links_controller.rb new file mode 100644 index 000000000..327fb7989 --- /dev/null +++ b/app/controllers/connection_links_controller.rb @@ -0,0 +1,27 @@ +class ConnectionLinksController < ChouetteController + defaults :resource_class => Chouette::ConnectionLink + + belongs_to :referential do + #belongs_to :departure, :parent_class => Chouette::StopArea, :optional => false + #belongs_to :arrival, :parent_class => Chouette::StopArea, :optional => false + end + + respond_to :html, :xml, :json + + + protected + + def collection + @q = referential.connection_links.search(params[:q]) + @connection_links ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page], :per_page => 10) + end + + def resource_url(connection_link = nil) + referential_connection_link_path(referential, connection_link || resource) + end + + def collection_url + referential_connection_links_path(referential) + end + +end diff --git a/app/models/referential.rb b/app/models/referential.rb index a05e3f065..c78c81a75 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -24,6 +24,10 @@ class Referential < ActiveRecord::Base def time_tables Chouette::TimeTable.scoped end + + def connection_links + Chouette::ConnectionLink.scoped + end def switch raise "Referential not created" if new_record? diff --git a/app/views/connection_links/_connection_link.erb b/app/views/connection_links/_connection_link.erb new file mode 100644 index 000000000..116adafb6 --- /dev/null +++ b/app/views/connection_links/_connection_link.erb @@ -0,0 +1,12 @@ +<%= div_for(connection_link) do %> + <%= link_to truncate(connection_link.name, :length => 30), [@referential, connection_link], :title => "Correspondance #{connection_link.name}" %> + <div class="info"> + <%= connection_link.human_attribute_name('departure') %> <%= link_to_if connection_link.departure, connection_link.departure.name, referential_stop_area_path(@referential, connection_link.departure), :title => "#{connection_link.human_attribute_name('departure')} #{connection_link.departure.name}" %> - + <%= connection_link.human_attribute_name('arrival') %> <%= link_to_if( connection_link.arrival, connection_link.arrival.name, referential_stop_area_path(@referential, connection_link.arrival), :title => "#{connection_link.human_attribute_name('arrival')} #{connection_link.arrival.name}" ) %> + + <div class="actions"> + <%= link_to t("actions.edit"), edit_referential_connection_link_path(@referential, connection_link), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_connection_link_path(@referential, connection_link), :method => :delete, :confirm => t('connection_links.actions.destroy_confirm'), :class => "remove" %> + </div> + </div> +<% end %> diff --git a/app/views/connection_links/_form.erb b/app/views/connection_links/_form.erb new file mode 100644 index 000000000..16174ec9a --- /dev/null +++ b/app/views/connection_links/_form.erb @@ -0,0 +1,26 @@ +<!-- <%= @connection_link.errors.inspect %> --> +<%= semantic_form_for [@referential, @connection_link] do |form| %> + <%= form.inputs do %> + <!-- + <%= form.input :departure, :as => :select, :collection => Chouette::Network.all, :include_blank => false %> + <%= form.input :arrival, :as => :select, :collection => Chouette::Company.all, :include_blank => false%> + --> + <%= form.input :name %> + <%= form.input :connection_link_type, :as => :select, :collection => Chouette::ConnectionLink.connection_link_types, :include_blank => false, :member_label => Proc.new { |mode| t("connection_link_types.label.#{mode}") } %> + <%= form.input :comment %> + <% if @connection_link.new_record? %> + <%= form.input :objectid %> + <% else %> + <li> + <label><%= @connection_link.human_attribute_name("objectid") %>: </label> + <%= @connection_link.objectid %> + </li> + <% end %> + <% end %> + + <%= form.buttons do %> + <%= form.commit_button true %> + <li><%= t('or') %></li> + <li><%= link_to t('cancel'), :back %></li> + <% end %> +<% end %> diff --git a/app/views/connection_links/edit.html.erb b/app/views/connection_links/edit.html.erb new file mode 100644 index 000000000..77200420b --- /dev/null +++ b/app/views/connection_links/edit.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('connection_links.edit.title', :connection_link => @connection_link.name ) %> + +<%= render "form" %> diff --git a/app/views/connection_links/index.html.erb b/app/views/connection_links/index.html.erb new file mode 100644 index 000000000..fdbd28021 --- /dev/null +++ b/app/views/connection_links/index.html.erb @@ -0,0 +1,22 @@ +<%= title_tag t('connection_links.index.title') %> + +<%= search_form_for @q, :url => referential_connection_links_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_connection_links_path(@referential) %> +<% end %> + +<%= will_paginate @connection_links %> +<div class="connection_links paginated_content"> + <%= render :partial => "connection_link", :collection => @connection_links %> +</div> +<%= will_paginate @connection_links %> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('connection_links.actions.new'), new_referential_connection_link_path(@referential), :class => "add" %></li> +</ul> + +<% end %> diff --git a/app/views/connection_links/new.html.erb b/app/views/connection_links/new.html.erb new file mode 100644 index 000000000..bd098adc0 --- /dev/null +++ b/app/views/connection_links/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('connection_links.new.title') %> + +<%= render "form" %> diff --git a/app/views/connection_links/show.html.erb b/app/views/connection_links/show.html.erb new file mode 100644 index 000000000..cd564ce9b --- /dev/null +++ b/app/views/connection_links/show.html.erb @@ -0,0 +1,47 @@ +<%= title_tag t('connection_links.show.title', :connection_link => @connection_link.name ) %> + +<div class="connection_link_show"> + + <div class="summary"> + <p> + <label><%= @connection_link.human_attribute_name(:departure) %>: </label> + <%= link_to @connection_link.departure.name, [@referential, @connection_link.departure] %> + </p> + <p> + <label><%= @connection_link.human_attribute_name(:arrival) %>: </label> + <%= link_to @connection_link.arrival.name, [@referential, @connection_link.arrival] %> + </p> + <p> + <label><%= @connection_link.human_attribute_name("name") %>: </label> + <%= @connection_link.name %> + </p> + <p> + <label><%= @connection_link.human_attribute_name("link_type") %>: </label> + <%= t("connection_link_types.label.#{@connection_link.link_type}") %> + </p> + <p> + <label><%= @connection_link.human_attribute_name("comment") %>: </label> + <%= @connection_link.comment %> + </p> + <p> + <label><%= @connection_link.human_attribute_name("objectid") %>: </label> + <%= @connection_link.objectid %> + </p> + <p> + <label><%= @connection_link.human_attribute_name("creation_time") %>: </label> + <%= @connection_link.creation_time %> + </p> + <p> + <label><%= @connection_link.human_attribute_name("creator_id") %>: </label> + <%= @connection_link.creator_id %> + </p> + </div> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('connection_links.actions.edit'), edit_referential_connection_link_path(@referential, @connection_link), :class => "edit" %></li> + <li><%= link_to t('connection_links.actions.destroy'), referential_connection_link_path(@referential, @connection_link), :method => :delete, :confirm => t('connection_links.actions.destroy_confirm'), :class => "remove" %></li> + <br> +</ul> +<% end %> diff --git a/app/views/help/companies.textile b/app/views/help/companies.textile index c1db6f4d3..0b89d9796 100644 --- a/app/views/help/companies.textile +++ b/app/views/help/companies.textile @@ -9,7 +9,7 @@ Dans la réalité, le transporteur est l'entité en charge de Ce principe se retrouve dans ce logiciel. * Il s'agit de l'exploitant de la ligne; chaque ligne est rattachée à un seul transporteur, un transporteur pouvant évidemment gérer plusieurs lignes. -* Chaque transporteur dispose d'un identifiant fonctionnel (« numéro d'enregistrement ») qui est utilisé dans les échanges XML pour identifier le transporteur et le mettre à jour. Cet identifiant est unique pour toute la base CHOUETTE, quel que soit le réseau ; il est donc important que le gestionnaire de la base CHOUETTE le renseigne d'une manière bien définie et pérenne. +* Chaque transporteur dispose d'un identifiant fonctionnel (« numéro d'enregistrement ») qui est utilisé dans les échanges XML pour identifier le transporteur et le mettre à jour. Cet identifiant est unique pour toute la base CHOUETTE, quel que soit le réseau ; il est donc important que le gestionnaire de la base CHOUETTE le renseigne d'une manière bien définie et pérenne. h3. Attributs diff --git a/app/views/help/connection_links.textile b/app/views/help/connection_links.textile new file mode 100644 index 000000000..4969db77d --- /dev/null +++ b/app/views/help/connection_links.textile @@ -0,0 +1,46 @@ +--- +layout: default +title: Correspondances +--- + +h3. Définition + +Une correspondance ou un changement est, dans un voyage en transports en commun, une étape nécessitant de changer de ligne. Le changement peut se faire soit au sein du même réseau, soit de manière intermodale, c'est-à-dire en changeant également de mode de transport. +La correspondance permet d'établir une liaison entre un arrêt physique (ou une zone d'arrêt de type « arrêt commercial » ou de type « pôle d'échange ») et un autre arrêt physique (ou une autre zone d'arrêt de type « arrêt commercial » ou de type « pôle d'échange »). +Cette liaison définit aussi une durée de parcours entre les arrêts (ou zones) reliés. + +h3. Attributs + +- Nom := nom de la correspondances +- Commentaire := zone de texte libre +- Distance := distance en mètres +- Type := liste de choix parmi « Aérien », « Souterrain» ou mixte « Aérien et souterrain » +- Départ := arrêt de départ de la correspondance +- Arrivée := arrêt d'arrivée de la correspondance +- Durée moyenne := champ de type horaire hh:mm +- Durée pour un voyageur à mobilité réduite := champ de type horaire hh:mm +- Durée pour un voyageur occasionnel := champ de type horaire hh:mm +- Durée pour un habitué := champ de type horaire hh:mm +- Ascenseur := indicateur (Oui ou Non) +- Accès pour personne à mobilité réduite := indicateur (Oui ou Non) +- Escalator disponible := indicateur (Oui ou Non) + +p(attr_data). Données de gestion : + +- Identifiant Neptune := +clé unique pérenne identifiant la correspondance 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 = ConnectionLink : 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 le préfixe 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/index.textile b/app/views/help/index.textile index c3b5ee2bd..73c0f04c1 100644 --- a/app/views/help/index.textile +++ b/app/views/help/index.textile @@ -3,7 +3,7 @@ layout: default title: Présentation --- -Chouette v2 : itération 4 du 16/04/2012 +Chouette v2 : itération 5 du 07/05/2012 Cette itération présente les formulaires de : @@ -12,16 +12,19 @@ Cette itération présente les formulaires de : * lignes * arrêts * calendriers d'application +* correspondances +* séquences d'arrêts l'avancement actuel permet de : * créer, modifier et supprimer les objets * consulter les cartes +* déplacer un arrêt depuis la carte +* associer les arrêts à leurs parents les action suivantes ne sont pas encore disponible : -* déplacer un arrêt depuis la carte * afficher le fond Géoportail * ajouter ou supprimer des dates et des périodes aux calendriers -* associer les arrêts à leurs parents * associer une ITL à une ligne + diff --git a/app/views/help/normalisation.textile b/app/views/help/normalisation.textile index 2790d5320..6d7793eb4 100644 --- a/app/views/help/normalisation.textile +++ b/app/views/help/normalisation.textile @@ -21,7 +21,7 @@ Ces spécifications d'échange couvrent l'information VP et TC, th&e * un modèle de données orienté objets décrit en UML, reprenant pour ce qui concerne les transports publics, le modèle conceptuel de données Transmodel V4.0, normalisé au niveau européen ; * un format d'échange XML spécifié sous forme de schémas XSD. -Les spécifications TRIDENT ont été implémentées dans plusieurs pays européens, et en France ont été mises en œuvre par la RATP pour son système d'information sur les situations perturbées SIPRE, et également pour les échanges d'information au niveau francilien en cours entre les systèmes de la RATP et du STIF, pour ce qui concerne l'information théorique. +Les spécifications TRIDENT ont été implémentées dans plusieurs pays européens, et en France ont été mises en &œlig;uvre par la RATP pour son système d'information sur les situations perturbées SIPRE, et également pour les échanges d'information au niveau francilien en cours entre les systèmes de la RATP et du STIF, pour ce qui concerne l'information théorique. Le travail du groupe GT7 a abouti à des spécifications de profil d'échange TRIDENT / Chouette en 2006, qui ont servi de référence pour implémenter le logiciel CHOUETTE et sont utilisées depuis lors par plusieurs projets de SIM en France. diff --git a/app/views/help/routes.textile b/app/views/help/routes.textile new file mode 100644 index 000000000..f02946b41 --- /dev/null +++ b/app/views/help/routes.textile @@ -0,0 +1,38 @@ +--- +layout: default +title: Séquence d'arrêts +--- + +h3. Définition + +La séquence d'arrêts est une sélection ordonnée de références aux points d'arrêt (exemple: itinéraires aller et retour d'une ligne). Une séquence d'arrêts est spécifique à une ligne; les séquences d'arrêts peuvent référencer des arrêts communs. + +h3. Attributs + +- Nom := nom de la séquence d'arrêts +- Nom public := nom public pour les voyageurs +- Commentaire := zone de texte libre sur le réseau +- Direction := orientation principale (points cardinaux, circulaire ou aller/retour) +- Indoce := numéro de la séquence d'arrêts +- Sens := aller ou retour +- Itinéraire associé en sens opposé := référence de l'itinéraire de sens opposé associé + +p(attr_data). Données de gestion : + +- Identifiant Neptune := +clé unique pérenne identifiant la séquence d'arrêts 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 = Route : 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 le préfixe 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/toc.textile b/app/views/help/toc.textile index f4f6998f8..e3ed1ba6f 100644 --- a/app/views/help/toc.textile +++ b/app/views/help/toc.textile @@ -1,6 +1,6 @@ --- layout: default -title: sommaire +title: Sommaire --- h3. Sommaire @@ -11,10 +11,10 @@ h3. Sommaire # "Réseaux":networks # "Transporteurs":companies # "Lignes":lines -## Séquences d'arrêts +## "Séquences d'arrêts":routes ## Horaires # "Arrêts":stop_areas -## Correspondances +## "Correspondances":connection_links ## Accès ## Liaisons Arrêt-Accès # "Calendriers d'application":timetables diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9c48ff00b..d757c92d4 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -41,6 +41,7 @@ <li><%= tab_link_to Chouette::Company, referential_companies_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> <li><%= tab_link_to Chouette::TimeTable, referential_time_tables_path(@referential) %></li> <% end %> </ul> diff --git a/config/locales/connection_link_types.yml b/config/locales/connection_link_types.yml new file mode 100644 index 000000000..f896e1883 --- /dev/null +++ b/config/locales/connection_link_types.yml @@ -0,0 +1,13 @@ +en: + connection_link_types: + label: + Underground: Underground + Mixed: Mixed + Overground: Overground + +fr: + connection_link_types: + label: + Underground: Souterrain + Mixed: Mixte + Overground: Aérien diff --git a/config/locales/connection_links.yml b/config/locales/connection_links.yml new file mode 100644 index 000000000..5eb2bbacf --- /dev/null +++ b/config/locales/connection_links.yml @@ -0,0 +1,94 @@ +en: + connection_links: + actions: + new: Add a new connection link + edit: Edit this connection link + destroy: Remove this liconnection linkne + destroy_confirm: Are you sure you want destroy this connection link? + new: + title: Add a new connection link + edit: + title: Update connection link %{connection_link} + show: + title: Connection link %{connection_link} + index: + title: Connection_ links + name: Name + departure: Start of link + arrival: End of link + selection: Selection + selection_all: All + activerecord: + models: + connection_link: Connection link + attributes: + connection_link: + departure: Start of link + arrival: End of link + name: Name + comment: Comment + linkdistance: Distance + connection_link_type: Type + defaultduration: Average duration + frequenttravellerduration: Regular passenger duration + occasionaltravellerduration: Occasional passenger duration + mobilityrestrictedtravellerduration: Mobility reduced passenger duration + mobilityrestrictedsuitability: Mobility reduced passenger suitable + stairsavailability: Escalator + liftavailability: Lift + objectid: Neptune identifier + object_version: Version + creation_time: Created on + creator_id: Created by + formtastic: + hints: + connection_link: + objectid: "[prefix]:ConnectionLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + +fr: + connection_links: + actions: + new: Ajouter une correspondance + edit: Modifier cette correspondance + destroy: Supprimer cette correspondance + destroy_confirm: Etes vous sûr de détruire cette correspondance ? + new: + title: Ajouter une correspondance + edit: + title: Modifier la correspondance %{connection_link} + show: + title: Correspondance %{connection_link} + index: + name: Nom ou indice + title: Correspondances + departure: Arrêt de départ + arrival: "Arrêt d'arrivée" + selection: Sélection + selection_all: Tous + activerecord: + models: + connection_link: Correspondance + attributes: + connection_link: + departure: Arrêt de départ + arrival: "Arrêt d'arrivée" + name: Nom + comment: Commentaire + linkdistance: Distance + connection_link_type: Type + defaultduration: Durée moyenne + frequenttravellerduration: Durée pour un habitué + occasionaltravellerduration: Durée pour un voyageur occasionnel + mobilityrestrictedtravellerduration: Durée pour un voyageur à mobilité réduite + mobilityrestrictedsuitability: Accès pour personne à mobilité réduite + stairsavailability: Escalator + liftavailability: Ascenseur + objectid: Identifiant Neptune + object_version: Version + creation_time: Créé le + creator_id: Créé par + formtastic: + hints: + connection_link: + objectid: "[prefixe]:ConnectionLink:[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/directions.yml b/config/locales/directions.yml index 82b87673a..8e59b0b84 100644 --- a/config/locales/directions.yml +++ b/config/locales/directions.yml @@ -3,8 +3,8 @@ en: label: straight_forward: straight forward backward: backward - clockwise: clockwise - anti_clockwise: anticlockwise + clock_wise: clockwise + counter_clock_wise: counterclockwise north: north north_west: north west west: west @@ -18,8 +18,8 @@ fr: label: straight_forward: aller backward: retour - clockwise: sens horaire - anti_clockwise: sens anti horaire + clock_wise: sens horaire + counter_clock_wise: sens anti horaire north: nord north_west: nord ouest west: ouest diff --git a/config/locales/lines.yml b/config/locales/lines.yml index 490a7b630..a2ba7df95 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -28,7 +28,7 @@ en: name: Name published_name: Published name number: Number - transport_mode_name: Transport mode + transport_mode: Transport mode comment: Comments objectid: Neptune identifier object_version: Version @@ -70,7 +70,7 @@ fr: name: Nom published_name: Nom public number: Indice - transport_mode_name: Mode de transport + transport_mode: Mode de transport comment: Commentaire objectid: Identifiant Neptune object_version: Version diff --git a/config/routes.rb b/config/routes.rb index 4aaedc87b..1cf771edb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,7 +20,7 @@ ChouetteIhm::Application.routes.draw do resources :routes end - resources :companies, :stop_areas, :time_tables + resources :companies, :stop_areas, :time_tables, :connection_links end match '/help/(*slug)' => 'help#show' diff --git a/db/migrate/20120426141032_create_chouette_connection_link.rb b/db/migrate/20120426141032_create_chouette_connection_link.rb new file mode 100644 index 000000000..185c49af2 --- /dev/null +++ b/db/migrate/20120426141032_create_chouette_connection_link.rb @@ -0,0 +1,28 @@ +class CreateChouetteConnectionLink < ActiveRecord::Migration + def up + create_table "connectionlink", :force => true do |t| + t.integer "departureid", :limit => 8 + t.integer "arrivalid", :limit => 8 + t.string "objectid", :null => false + t.integer "objectversion" + t.datetime "creationtime" + t.string "creatorid" + t.string "name" + t.string "comment" + t.decimal "linkdistance", :precision => 19, :scale => 2 + t.string "linktype" + t.time "defaultduration" + t.time "frequenttravellerduration" + t.time "occasionaltravellerduration" + t.time "mobilityrestrictedtravellerduration" + t.boolean "mobilityrestrictedsuitability" + t.boolean "stairsavailability" + t.boolean "liftavailability" + t.integer "intuserneeds" + end + add_index "connectionlink", ["objectid"], :name => "connectionlink_objectid_key", :unique => true + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 07dc4922d..7666b10bf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120425125542) do +ActiveRecord::Schema.define(:version => 20120426141032) do create_table "company", :force => true do |t| t.string "objectid" @@ -31,6 +31,29 @@ ActiveRecord::Schema.define(:version => 20120425125542) do add_index "company", ["objectid"], :name => "company_objectid_key", :unique => true add_index "company", ["registrationnumber"], :name => "company_registrationnumber_key", :unique => true + create_table "connectionlink", :force => true do |t| + t.integer "departureid", :limit => 8 + t.integer "arrivalid", :limit => 8 + t.string "objectid", :null => false + t.integer "objectversion" + t.datetime "creationtime" + t.string "creatorid" + t.string "name" + t.string "comment" + t.decimal "linkdistance", :precision => 19, :scale => 2 + t.string "linktype" + t.time "defaultduration" + t.time "frequenttravellerduration" + t.time "occasionaltravellerduration" + t.time "mobilityrestrictedtravellerduration" + t.boolean "mobilityrestrictedsuitability" + t.boolean "stairsavailability" + t.boolean "liftavailability" + t.integer "intuserneeds" + end + + add_index "connectionlink", ["objectid"], :name => "connectionlink_objectid_key", :unique => true + create_table "line", :force => true do |t| t.integer "ptnetworkid", :limit => 8 t.integer "companyid", :limit => 8 diff --git a/spec/requests/connection_links_spec.rb b/spec/requests/connection_links_spec.rb new file mode 100644 index 000000000..c40e81970 --- /dev/null +++ b/spec/requests/connection_links_spec.rb @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe "ConnectionLinks" do + login_user + + let!(:referential) { create(:referential).switch } + let!(:connection_links) { referential; Array.new(2) { create(:connection_link) } } + subject { connection_links.first } + + describe "list" do + it "display connection_links" do + visit referential_connection_links_path(referential) + page.should have_content(connection_links.first.name) + page.should have_content(connection_links.last.name) + end + + end + + describe "show" do + it "display connection_link" do + visit referential_connection_links_path(referential) + click_link "#{connection_links.first.name}" + page.should have_content(connection_links.first.name) + end + + it "display map" do + pending ": map not yet implemented" +# subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) +# visit referential_connection_links_path(referential) +# click_link "#{connection_links.first.name}" +# page.should have_selector("#map", :class => 'connection_link') + end + + end + + describe "new" do + pending ": TODO see how to affect departure and arrival" +# it "creates connection_link and return to show" do +# visit referential_connection_links_path(referential) +# click_link "Ajouter une correspondance" +# fill_in "Nom", :with => "ConnectionLink 1" +# fill_in "Identifiant Neptune", :with => "test:Timetable:1" +# click_button("Créer Correspondance") +# page.should have_content("ConnectionLink 1") +# end + end + + describe "edit and return to show" do + pending ": TODO see how to affect departure and arrival" +# it "edit connection_link" do +# visit referential_connection_link_path(referential, subject) +# click_link "Modifier cette correspondance" +# fill_in "Nom", :with => "ConnectionLink Modified" +# click_button("Modifier Correspondance") +# page.should have_content("ConnectionLink Modified") +# end + end + +end diff --git a/spec/requests/time_tables_spec.rb b/spec/requests/time_tables_spec.rb new file mode 100644 index 000000000..720370ead --- /dev/null +++ b/spec/requests/time_tables_spec.rb @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe "TimeTables" do + login_user + + let!(:referential) { create(:referential).switch } + let!(:time_tables) { referential; Array.new(2) { create(:time_table) } } + subject { time_tables.first } + + describe "list" do + it "display time_tables" do + visit referential_time_tables_path(referential) + page.should have_content(time_tables.first.comment) + page.should have_content(time_tables.last.comment) + end + + end + + describe "show" do + it "display time_table" do + visit referential_time_tables_path(referential) + click_link "#{time_tables.first.comment}" + page.should have_content(time_tables.first.comment) + end + + end + + describe "new" do + it "creates time_table and return to show" do + visit referential_time_tables_path(referential) + click_link "Ajouter un calendrier" + fill_in "Description", :with => "TimeTable 1" + fill_in "Identifiant Neptune", :with => "test:Timetable:1" + click_button("Créer Calendrier") + page.should have_content("TimeTable 1") + end + end + + describe "edit and return to show" do + it "edit time_table" do + visit referential_time_table_path(referential, subject) + click_link "Modifier ce calendrier" + fill_in "Description", :with => "TimeTable Modified" + click_button("Modifier Calendrier") + page.should have_content("TimeTable Modified") + end + end + +end diff --git a/spec/views/connection_links/edit.html.erb_spec.rb b/spec/views/connection_links/edit.html.erb_spec.rb new file mode 100644 index 000000000..331529ff8 --- /dev/null +++ b/spec/views/connection_links/edit.html.erb_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe "/connection_links/edit" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:connection_link) { assign(:connection_link, create(:connection_link)) } + let!(:connection_links) { Array.new(2) { create(:connection_link) } } + + describe "test" do + it "should render h2 with the connection_link name" do + render + rendered.should have_selector("h2", :text => Regexp.new(connection_link.name)) + end + end + + describe "form" do + it "should render input for name" do + render + rendered.should have_selector("form") do + with_tag "input[type=text][name='connection_link[name]'][value=?]", connection_link.name + end + end + end + +end diff --git a/spec/views/connection_links/index.html.erb_spec.rb b/spec/views/connection_links/index.html.erb_spec.rb new file mode 100644 index 000000000..9732c16c5 --- /dev/null +++ b/spec/views/connection_links/index.html.erb_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe "/connection_links/index" do + + let!(:referential) { assign( :referential, create(:referential) ) } + let!(:connection_links) { assign :connection_links, Array.new(2) { create(:connection_link) }.paginate } + let!(:search) { assign :q, Ransack::Search.new(Chouette::ConnectionLink) } + + it "should render a show link for each group" do + render + connection_links.each do |connection_link| + rendered.should have_selector(".connection_link a[href='#{view.referential_connection_link_path(referential, connection_link)}']", :text => connection_link.name) + end + end + + it "should render a link to create a new group" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{new_referential_connection_link_path(referential)}']") + end + +end diff --git a/spec/views/connection_links/new.html.erb_spec.rb b/spec/views/connection_links/new.html.erb_spec.rb new file mode 100644 index 000000000..1e9ee570d --- /dev/null +++ b/spec/views/connection_links/new.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "/connection_links/new" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:connection_link) { assign(:connection_link, build(:connection_link)) } + + describe "form" do + + it "should render input for name" do + render + rendered.should have_selector("form") do + with_selector "input[type=text][name=?]", connection_link.name + end + end + + end +end diff --git a/spec/views/connection_links/show.html.erb_spec.rb b/spec/views/connection_links/show.html.erb_spec.rb new file mode 100644 index 000000000..bc8d075cf --- /dev/null +++ b/spec/views/connection_links/show.html.erb_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe "/connection_links/show" do + + let!(:referential) { assign(:referential, create(:referential)) } + let!(:connection_link) { assign(:connection_link, create(:connection_link)) } + + it "should render h2 with the connection_link name" do + render + rendered.should have_selector("h2", :text => Regexp.new(connection_link.name)) + end + + it "should display a map with class 'connection_link'" do + pending ": map not yet implemented" + # render + # rendered.should have_selector("#map", :class => 'connection_link') + end + + it "should render a link to edit the connection_link" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.edit_referential_connection_link_path(referential, connection_link)}']") + end + + it "should render a link to remove the connection_link" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.referential_connection_link_path(referential, connection_link)}'][class='remove']") + end + +end + diff --git a/spec/views/time_tables/edit.html.erb_spec.rb b/spec/views/time_tables/edit.html.erb_spec.rb new file mode 100644 index 000000000..6baf741fc --- /dev/null +++ b/spec/views/time_tables/edit.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "/time_tables/edit" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:time_table) { assign(:time_table, create(:time_table) ) } + + describe "test" do + it "should render h2 with the group comment" do + render + rendered.should have_selector("h2", :text => Regexp.new(time_table.comment)) + end + end + + describe "form" do + it "should render input for comment" do + render + rendered.should have_selector("form") do + with_tag "input[type=text][comment='time_table[comment]'][value=?]", time_table.comment + end + end + + end +end diff --git a/spec/views/time_tables/index.html.erb_spec.rb b/spec/views/time_tables/index.html.erb_spec.rb new file mode 100644 index 000000000..7d56ad982 --- /dev/null +++ b/spec/views/time_tables/index.html.erb_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe "/time_tables/index" do + + let!(:referential) { assign :referential, create(:referential) } + let!(:time_tables) { assign :time_tables, Array.new(2){ create(:time_table) }.paginate } + let!(:search) { assign :q, Ransack::Search.new(Chouette::TimeTable) } + + it "should render a show link for each group" do + render + time_tables.each do |time_table| + rendered.should have_selector(".time_table a[href='#{view.referential_time_table_path(referential, time_table)}']", :text => time_table.comment) + end + end + + it "should render a link to create a new group" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{new_referential_time_table_path(referential)}']") + end + +end diff --git a/spec/views/time_tables/new.html.erb_spec.rb b/spec/views/time_tables/new.html.erb_spec.rb new file mode 100644 index 000000000..dd7a35b3b --- /dev/null +++ b/spec/views/time_tables/new.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "/time_tables/new" do + let!(:referential) { assign(:referential, create(:referential)) } + let!(:time_table) { assign(:time_table, build(:time_table)) } + + describe "form" do + + it "should render input for comment" do + render + rendered.should have_selector("form") do + with_selector "input[type=text][comment=?]", time_table.comment + end + end + + end +end diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb new file mode 100644 index 000000000..056919b2b --- /dev/null +++ b/spec/views/time_tables/show.html.erb_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe "/time_tables/show" do + + let!(:referential) { assign(:referential, create(:referential)) } + let!(:time_table) { assign(:time_table, create(:time_table)) } + + it "should render h2 with the time_table comment" do + render + rendered.should have_selector("h2", :text => Regexp.new(time_table.comment)) + end + + it "should render a link to edit the time_table" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.edit_referential_time_table_path(referential, time_table)}']") + end + + it "should render a link to remove the time_table" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.referential_time_table_path(referential, time_table)}'][class='remove']") + end + +end + |
