diff options
| author | Michel Etienne | 2012-03-20 11:59:27 +0100 |
|---|---|---|
| committer | Michel Etienne | 2012-03-20 11:59:27 +0100 |
| commit | 2011ee0247deede4a58dbdcc6f5c50146dedf584 (patch) | |
| tree | 01bf481ed549e7025b5de5416ed64eca513c25bf | |
| parent | 153c6f7022a608c6780b265d3b91c95829b192e4 (diff) | |
| download | chouette-core-2011ee0247deede4a58dbdcc6f5c50146dedf584.tar.bz2 | |
set conformance for line network and company screens with fields specifications
22 files changed, 486 insertions, 82 deletions
diff --git a/app/assets/stylesheets/companies.css.scss b/app/assets/stylesheets/companies.css.scss new file mode 100644 index 000000000..f6b80831b --- /dev/null +++ b/app/assets/stylesheets/companies.css.scss @@ -0,0 +1,152 @@ +// 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/ +@mixin div_for_object { + margin-bottom: 20px; + + .color { + width: 64px; + height: 64px; + float: left; + margin-right: 10px; + } + + img { + float: left; + margin-right: 10px; + } + + img.preview { + width: 90px; + height: 70px; + } + + a { + display:block; + text-decoration: underline; + margin: 5px 0px 0px 0px; + } + + .info { + font-size: 10px; + color: #777; + font-weight: normal; + line-height: 14px; + margin-top: 5px; + + a { + display:inline; + color: #777; + } + + .actions { + margin-top: 14px; + a { + color: #666; + padding-left: 12px; + } + + a.edit { + background: url(image-path('user_interface/ui/edit-small.png')) no-repeat 0% 50%; + } + a.remove { + background: url(image-path('user_interface/ui/remove-small.png')) no-repeat 0% 50%; + } + } + + p { + margin:0; + } + } +} + +@mixin content_to_clear { + content: " "; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +@mixin after_div_for_object { + @include content_to_clear; +} + +#workspace.companies.index +{ + .company:after { + @include after_div_for_object; + } + + .companies { + margin-top: 20px; + } + + .companies:after { + @include content_to_clear; + } + + .company { + @include div_for_object; + + /* to create multi-column index */ + width: 350px; + float: left; + padding-right: 10px; + + } +} + +#workspace.companies.edit, #workspace.companies.new +{ + #line_color{ width: 100px; + color: white; + font-weight: bold;} +} + +#workspace.lines.show +{ + .line_color{ color: white; + font-weight: bold; + padding: 0 5px 0 5px;} +} + + +#workspace .order { + float: right; + padding: 15px 0; + font-size: 0.8em; + + a { text-decoration: underline; } + + a.current { + font-weight: bold; + text-decoration: none; + } +} + +/* FIXME a déplacer dans layout */ + +#sidebar ul { + padding: 0 8px; + + li { + margin: 4px 0; + } +} + +#sidebar ul.selection li { + a { + padding-left: 20px; + } + a.current { + text-decoration: none; + color: black !important; + background: url(image-path('user_interface/ui/accept.png')) no-repeat; + } + a.all { + background-image: none; + } +} + + diff --git a/app/assets/stylesheets/networks.css.scss b/app/assets/stylesheets/networks.css.scss new file mode 100644 index 000000000..3f62b8bb6 --- /dev/null +++ b/app/assets/stylesheets/networks.css.scss @@ -0,0 +1,152 @@ +// 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/ +@mixin div_for_object { + margin-bottom: 20px; + + .color { + width: 64px; + height: 64px; + float: left; + margin-right: 10px; + } + + img { + float: left; + margin-right: 10px; + } + + img.preview { + width: 90px; + height: 70px; + } + + a { + display:block; + text-decoration: underline; + margin: 5px 0px 0px 0px; + } + + .info { + font-size: 10px; + color: #777; + font-weight: normal; + line-height: 14px; + margin-top: 5px; + + a { + display:inline; + color: #777; + } + + .actions { + margin-top: 14px; + a { + color: #666; + padding-left: 12px; + } + + a.edit { + background: url(image-path('user_interface/ui/edit-small.png')) no-repeat 0% 50%; + } + a.remove { + background: url(image-path('user_interface/ui/remove-small.png')) no-repeat 0% 50%; + } + } + + p { + margin:0; + } + } +} + +@mixin content_to_clear { + content: " "; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +@mixin after_div_for_object { + @include content_to_clear; +} + +#workspace.networks.index +{ + .network:after { + @include after_div_for_object; + } + + .networks { + margin-top: 20px; + } + + .networks:after { + @include content_to_clear; + } + + .network { + @include div_for_object; + + /* to create multi-column index */ + width: 350px; + float: left; + padding-right: 10px; + + } +} + +#workspace.networks.edit, #workspace.networks.new +{ + #line_color{ width: 100px; + color: white; + font-weight: bold;} +} + +#workspace.lines.show +{ + .line_color{ color: white; + font-weight: bold; + padding: 0 5px 0 5px;} +} + + +#workspace .order { + float: right; + padding: 15px 0; + font-size: 0.8em; + + a { text-decoration: underline; } + + a.current { + font-weight: bold; + text-decoration: none; + } +} + +/* FIXME a déplacer dans layout */ + +#sidebar ul { + padding: 0 8px; + + li { + margin: 4px 0; + } +} + +#sidebar ul.selection li { + a { + padding-left: 20px; + } + a.current { + text-decoration: none; + color: black !important; + background: url(image-path('user_interface/ui/accept.png')) no-repeat; + } + a.all { + background-image: none; + } +} + + diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 2b13d78cf..20967f733 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -11,6 +11,11 @@ class CompaniesController < ChouetteController # end protected + def collection + @q = referential.companies.search(params[:q]) + @companies ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page], :per_page => 10) + end + def resource_url(company = nil) referential_company_path(referential, company || resource) diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index b9423c976..e5c3e3ca7 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -6,6 +6,11 @@ class NetworksController < ChouetteController protected + def collection + @q = referential.networks.search(params[:q]) + @networks ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page], :per_page => 10) + end + def resource_url(network = nil) referential_network_path(referential, network || resource) end diff --git a/app/views/companies/_company.erb b/app/views/companies/_company.erb index 9d4683414..34c65b798 100644 --- a/app/views/companies/_company.erb +++ b/app/views/companies/_company.erb @@ -1,6 +1,11 @@ <%= div_for(company) do %> <%= link_to company.name, [@referential, company] %> <div class="info"> + <%= company.human_attribute_name('code') %> <%= company.code %> + <div class="actions"> + <%= link_to t("actions.edit"), edit_referential_company_path(@referential, company), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_company_path(@referential, company), :method => :delete, :confirm => t('companies.actions.destroy_confirm'), :class => "remove" %> + </div> </div> <% end %> diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb index 5e902bcec..bea95b0b4 100644 --- a/app/views/companies/_form.erb +++ b/app/views/companies/_form.erb @@ -1,7 +1,6 @@ <%= semantic_form_for [@referential, @company] do |form| %> <%= form.inputs do %> <%= form.input :name %> - <%= form.input :registration_number %> <%= form.input :short_name %> <%= form.input :organizational_unit %> <%= form.input :operating_department_name %> @@ -9,6 +8,15 @@ <%= form.input :phone, :as => :phone %> <%= form.input :fax, :as => :phone %> <%= form.input :email, :as => :email %> + <%= form.input :registration_number %> + <% if @company.new_record? %> + <%= form.input :objectid %> + <% else %> + <li> + <label><%= @company.human_attribute_name("objectid") %>: </label> + <%= @company.objectid %> + </li> + <% end %> <% end %> <%= form.buttons do %> diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb index 09501d5bf..6b047b0ce 100644 --- a/app/views/companies/index.html.erb +++ b/app/views/companies/index.html.erb @@ -1,6 +1,19 @@ <%= title_tag t('companies.index.title') %> -<%= render :partial => "company", :collection => @companies %> +<%= search_form_for @q, :url => referential_companies_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_companies_path(@referential) %> +<% end %> + +<%#= will_paginate @companies %> +<div class="companies paginated_content"> + <%= render :partial => "company", :collection => @companies %> +</div> +<%= will_paginate @companies %> + <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb index 4dd9e0a21..09a54e98b 100644 --- a/app/views/companies/show.html.erb +++ b/app/views/companies/show.html.erb @@ -4,10 +4,6 @@ <div class="summary"> <p> - <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label> - <%= @company.registration_number %> - </p> - <p> <label><%= Chouette::Company.human_attribute_name("name") %>: </label> <%= @company.name %> </p> @@ -24,6 +20,10 @@ <%= @company.operating_department_name %> </p> <p> + <label><%= Chouette::Company.human_attribute_name("code") %>: </label> + <%= @company.code %> + </p> + <p> <label><%= Chouette::Company.human_attribute_name("phone") %>: </label> <%= @company.phone %> </p> @@ -35,6 +35,14 @@ <label><%= Chouette::Company.human_attribute_name("email") %>: </label> <%= @company.email %> </p> + <p> + <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label> + <%= @company.registration_number %> + </p> + <p> + <label><%= Chouette::Company.human_attribute_name("objectid") %>: </label> + <%= @company.objectid %> + </p> </div> </div> diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb index e81bc7ce8..3476e5031 100644 --- a/app/views/networks/_form.erb +++ b/app/views/networks/_form.erb @@ -7,6 +7,14 @@ <%= form.input :description %> <%= form.input :source_name %> <%= form.input :source_identifier %> + <% if @network.new_record? %> + <%= form.input :objectid %> + <% else %> + <li> + <label><%= @network.human_attribute_name("objectid") %>: </label> + <%= @network.objectid %> + </li> + <% end %> <% end %> <%= form.buttons do %> diff --git a/app/views/networks/_network.erb b/app/views/networks/_network.erb index 4adf6896b..f3a0b597e 100644 --- a/app/views/networks/_network.erb +++ b/app/views/networks/_network.erb @@ -1,6 +1,9 @@ <%= div_for(network) do %> <%= link_to network.name, [@referential, network] %> <div class="info"> - + <div class="actions"> + <%= link_to t("actions.edit"), edit_referential_network_path(@referential, network), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_network_path(@referential, network), :method => :delete, :confirm => t('networks.actions.destroy_confirm'), :class => "remove" %> + </div> </div> <% end %> diff --git a/app/views/networks/index.html.erb b/app/views/networks/index.html.erb index 3743a1865..96e4f8b0b 100644 --- a/app/views/networks/index.html.erb +++ b/app/views/networks/index.html.erb @@ -1,6 +1,19 @@ <%= title_tag t('networks.index.title') %> -<%= render :partial => "network", :collection => @networks %> +<%= search_form_for @q, :url => referential_networks_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_networks_path(@referential) %> +<% end %> + +<%#= will_paginate @networks %> +<div class="networks paginated_content"> + <%= render :partial => "network", :collection => @networks %> +</div> +<%= will_paginate @networks %> + <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/networks/show.html.erb b/app/views/networks/show.html.erb index 489978f49..bd96938c5 100644 --- a/app/views/networks/show.html.erb +++ b/app/views/networks/show.html.erb @@ -31,6 +31,10 @@ <label><%= Chouette::Network.human_attribute_name("source_identifier") %>: </label> <%= @network.source_identifier %> </p> + <p> + <label><%= Chouette::Network.human_attribute_name("objectid") %>: </label> + <%= @network.objectid %> + </p> </div> </div> diff --git a/config/locales/companies.yml b/config/locales/companies.yml index d044d72b6..1d205cbd2 100644 --- a/config/locales/companies.yml +++ b/config/locales/companies.yml @@ -13,6 +13,8 @@ en: title: "Company %{company}" index: title: "Companies" + name: Name + activerecord: models: company: "Companies" @@ -23,11 +25,11 @@ en: short_name: "Short name" organizational_unit: "Unit" operating_department_name: "Department" - code: "Zip code" + code: "Postcode" phone: "Phone number" fax: "Fax number" - email: "E-mail" - object_id: Neptune identifier + email: "Email" + objectid: Neptune identifier object_version: Version creation_time: Created on creator_id: Created by @@ -47,6 +49,8 @@ fr: title: "Transporteur %{company}" index: title: "Transporteurs" + name: Nom + activerecord: models: company: "Transporteurs" @@ -55,13 +59,13 @@ fr: registration_number: "Numéro d'enregistrement" name: "Nom" short_name: "Nom court" - organizational_unit: "Service" - operating_department_name: "Nom du département" + organizational_unit: "Nom d'unité dans la société" + operating_department_name: "Nom du département dans la société" code: "Code postal" - phone: "Téléphone" - fax: "Fax" - email: "Adresse mel" - object_id: "Identifiant Neptune" + phone: "Numéro de téléphone" + fax: "Numero de fax" + email: "Email" + objectid: "Identifiant Neptune" object_version: "Version" creation_time: "Créé le" creator_id: "Créé par" diff --git a/config/locales/lines.yml b/config/locales/lines.yml index 447d61920..39cce218f 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -4,16 +4,16 @@ en: new: Add a new line edit: Edit this line destroy: Remove this line - destroy_confirm: "Are you sure you want destroy this line?" + destroy_confirm: Are you sure you want destroy this line? new: - title: "Add a new line" + title: Add a new line edit: - title: "Update line %{line}" + title: Update line %{line} show: - title: "Line %{line}" + title: Line %{line} index: title: Lines - name_or_number: "Name or number" + name_or_number: Name or number selection: Selection selection_all: All activerecord: @@ -21,14 +21,14 @@ en: line: Line attributes: line: - network: "Network" - company: "Company" - registration_number: "Registration number" - name: "Name" - published_name: "Public name" - number: "Number" - transport_mode_name: "Transport mode" - comment: "Comments" + network: Network + company: Company + registration_number: Registration number + name: Name + published_name: Published name + number: Number + transport_mode_name: Transport mode + comment: Comments objectid: Neptune identifier object_version: Version creation_time: Created on @@ -40,7 +40,7 @@ fr: new: Ajouter une ligne edit: Modifier cette ligne destroy: Supprimer cette ligne - destroy_confirm: "Etes vous sûr de détruire cette ligne ?" + destroy_confirm: Etes vous sûr de détruire cette ligne ? new: title: Ajouter une ligne edit: @@ -48,7 +48,7 @@ fr: show: title: Ligne %{line} index: - name_or_number: "Nom ou indice" + name_or_number: Nom ou indice title: Lignes selection: Sélection selection_all: Tous @@ -57,16 +57,16 @@ fr: line: Ligne attributes: line: - network: "Réseau" - company: "Transporteur" + network: Réseau + company: Transporteur registration_number: "Numéro d'enregistrement" - name: "Nom" - published_name: "Nom publié" - number: "Indice" - transport_mode_name: "Mode de transport" - comment: "Commentaire" - objectid: "Identifiant Neptune" - object_version: "Version" - creation_time: "Créé le" - creator_id: "Créé par" + name: Nom + published_name: Nom public + number: Indice + transport_mode_name: Mode de transport + comment: Commentaire + objectid: Identifiant Neptune + object_version: Version + creation_time: Créé le + creator_id: Créé par diff --git a/config/locales/networks.yml b/config/locales/networks.yml index 1ca90b35e..cae65fc71 100644 --- a/config/locales/networks.yml +++ b/config/locales/networks.yml @@ -13,6 +13,8 @@ en: title: "Network" index: title: "Networks" + name: Name + activerecord: models: network: Networks @@ -21,12 +23,12 @@ en: registration_number: "Registration number" name: "Name" comment: "Comments" - version_date: Version date + version_date: "Date of this network's version" description: Description - source_type: Origin system date - source_name: Origin system name - source_identifier: Origin system identifier - object_id: Neptune identifier + source_type: Source type + source_name: Source name + source_identifier: Source identifier + objectid: Neptune identifier object_version: Version creation_time: Created on creator_id: Created by @@ -37,7 +39,7 @@ fr: new: Ajouter un réseau edit: Modifier ce réseau destroy: Supprimer ce réseau - destroy_confirm: "Etes vous sûr de détruire cette réseau ?" + destroy_confirm: "Etes vous sûr de détruire ce réseau ?" new: title: "Ajouter un réseau" edit: @@ -46,6 +48,8 @@ fr: title: Réseau %{network} index: title: "Réseaux" + name: Nom + activerecord: models: network: Réseau @@ -54,12 +58,12 @@ fr: registration_number: "Numéro d'enregistrement" name: "Nom" comment: "Commentaire" - version_date: Date de cette version + version_date: Date de cette version du réseau description: Description - source_type: "Type de système d'origine" + source_type: "Type de système à l'origine du réseau" source_name: "Nom du système à l'origine du réseau" - source_identifier: "Identifiant du système" - object_id: "Identifiant Neptune" + source_identifier: "Identifiant du système à l'origine du réseau" + objectid: "Identifiant Neptune" object_version: "Version" creation_time: "Créé le" creator_id: "Créé par" diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml index 962af34fb..dc0a160ed 100644 --- a/config/locales/referentials.yml +++ b/config/locales/referentials.yml @@ -1,20 +1,20 @@ en: referentials: edit: - title: "Edit the referentiel" + title: "Edit the data space" show: - title: Referential + title: Data space new: - title: Create a new referential - submit: "Create a referential" + title: Create a new data space + submit: "Create a data space" actions: - new: Add a referential - destroy_confirm: "Do you confirm to destroy this referential ?" - destroy: Destroy this referential - edit: Edit this referential + new: Add a data space + destroy_confirm: "Do you confirm to destroy this data space ?" + destroy: Destroy this data space + edit: Edit this data space activerecord: models: - referential: Referential + referential: Data space attributes: referential: name: Name @@ -23,20 +23,20 @@ en: fr: referentials: edit: - title: "Modifier le référentiel" + title: "Modifier l'espace de données" show: - title: Référentiel + title: Espace de données new: - title: Créer un nouveau référentiel - submit: "Créer un référentiel" + title: Créer un nouvel espace de données + submit: "Créer un espace de données" actions: - new: Ajouter un référentiel - destroy_confirm: "Etes vous sûr de vouloir supprimer ce référentiel ?" - destroy: Supprimer ce référentiel - edit: Modifier ce référentiel + new: Ajouter un espace de données + destroy_confirm: "Etes vous sûr de vouloir supprimer cet espace de données ?" + destroy: Supprimer cet espace de données + edit: Modifier cet espace de données activerecord: models: - referential: Référentiel + referential: Espace de données attributes: referential: name: Nom diff --git a/config/locales/transport_modes.yml b/config/locales/transport_modes.yml index 0ed6944a0..49d60f5de 100644 --- a/config/locales/transport_modes.yml +++ b/config/locales/transport_modes.yml @@ -28,18 +28,18 @@ fr: unknown: Inconnu air: Air train: Train - long_distance_train: Train longue distance - local_train: Train local - rapid_transit: Lignes rapides + long_distance_train: Train Grande Ligne + local_train: TER + rapid_transit: RER metro: Métro tramway: Tramway - coach: Voiture + coach: Autocar bus: Bus ferry: Ferry - waterborne: Eau - private_vehicle: Véhicule privé - walk: Piéton - trolley_bus: Trolley bus + waterborne: Bac + private_vehicle: Voiture particulière + walk: Marche à pied + trolley_bus: Trolleybus bicycle: Vélo shuttle: Navette taxi: Taxi diff --git a/config/locales/will_paginate.yml b/config/locales/will_paginate.yml index e03aca81c..4978c358d 100644 --- a/config/locales/will_paginate.yml +++ b/config/locales/will_paginate.yml @@ -1,3 +1,22 @@ +en: + will_paginate: + previous_label: "← Previous" + next_label: "Next →" + page_gap: "…" + + page_entries_info: + single_page: + zero: "No %{model} found" + one: "1 %{model} shown" + other: "%{count} %{model} shown" + single_page_html: + zero: "No %{model} found" + one: "<b>1</b> %{model} shown" + other: "<b>%{count}</b> %{model} shown" + + multi_page: "%{model} %{from} - %{to} of %{count} " + multi_page_html: "%{model} <b>%{from} - %{to}</b> of <b>%{count}</b> " + fr: will_paginate: previous_label: "← Précédent" diff --git a/spec/factories/chouette_companies.rb b/spec/factories/chouette_companies.rb index dacbc5766..f88fbca4a 100644 --- a/spec/factories/chouette_companies.rb +++ b/spec/factories/chouette_companies.rb @@ -1,4 +1,4 @@ Factory.define :company, :class => "Chouette::Company" do |company| company.sequence(:name) { |n| "Company #{n}" } - company.sequence(:objectid) { |n| "Company:#{n}" } + company.sequence(:objectid) { |n| "test:Company:#{n}" } end diff --git a/spec/factories/chouette_lines.rb b/spec/factories/chouette_lines.rb index 2f5b1d2a5..03faeedae 100644 --- a/spec/factories/chouette_lines.rb +++ b/spec/factories/chouette_lines.rb @@ -1,6 +1,7 @@ Factory.define :line, :class => "Chouette::Line" do |line| line.sequence(:name) { |n| "Line #{n}" } line.sequence(:objectid) { |n| "test:Line:#{n}" } + line.sequence(:transport_mode_name) { |n| "Bus" } line.association :network, :factory => :network line.association :company, :factory => :company diff --git a/spec/factories/chouette_networks.rb b/spec/factories/chouette_networks.rb index dbcdab9ed..227835d25 100644 --- a/spec/factories/chouette_networks.rb +++ b/spec/factories/chouette_networks.rb @@ -1,4 +1,4 @@ Factory.define :network, :class => "Chouette::Network" do |network| network.sequence(:name) { |n| "Network #{n}" } - network.sequence(:objectid) { |n| "Network:#{n}" } + network.sequence(:objectid) { |n| "test:GroupOfLine:#{n}" } end diff --git a/spec/requests/referentials_spec.rb b/spec/requests/referentials_spec.rb index 4dc378780..d120f609b 100644 --- a/spec/requests/referentials_spec.rb +++ b/spec/requests/referentials_spec.rb @@ -20,7 +20,7 @@ describe "Referentials" do visit new_referential_path fill_in "Nom", :with => "Test" fill_in "Code", :with => "test" - click_button "Créer Référentiel" + click_button "Créer Espace de données" Referential.where(:name => "Test").should_not be_nil # CREATE SCHEMA |
