diff options
| author | Teddy Wing | 2017-07-20 12:21:35 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-07-20 12:21:35 +0200 |
| commit | 9b3778f8d2afe93486ea8e49ec7730cb1ec2be1e (patch) | |
| tree | f00016286e5af968c0b6efa3d7969cfa1dc8bdba | |
| parent | 42a51eef7d242583726c4942583b4ab567c4d293 (diff) | |
| parent | 4fd4fa0fd24c9cd86161358f2e36cff64f3712d7 (diff) | |
| download | chouette-core-9b3778f8d2afe93486ea8e49ec7730cb1ec2be1e.tar.bz2 | |
Merge remote-tracking branch 'origin/master' into 1726-WorkbenchImport-for-multi-Netex-import
52 files changed, 410 insertions, 193 deletions
diff --git a/.erdconfig b/.erdconfig new file mode 100644 index 000000000..9d1618ffd --- /dev/null +++ b/.erdconfig @@ -0,0 +1,23 @@ +attributes: + - content + - foreign_key + - primary_key + - inheritance + - timestamps +disconnected: true +filename: erd +filetype: png +indirect: true +inheritance: false +markup: true +notation: uml +orientation: vertical +polymorphism: false +sort: true +warn: true +title: sample title +exclude: null +only: null +only_recursion_depth: null +prepend_primary: true +cluster: false diff --git a/Gemfile.lock b/Gemfile.lock index 41ae70f56..2239cf853 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -267,8 +267,8 @@ GEM htmlbeautifier (1.3.1) httparty (0.14.0) multi_xml (>= 0.5.2) - i18n (0.8.1) - i18n-tasks (0.9.13) + i18n (0.8.6) + i18n-tasks (0.9.15) activesupport (>= 4.0.2) ast (>= 2.1.0) easy_translate (>= 0.5.0) @@ -313,7 +313,7 @@ GEM mime-types-data (3.2016.0521) mimemagic (0.3.2) mini_portile2 (2.2.0) - minitest (5.10.1) + minitest (5.10.2) multi_json (1.12.1) multi_test (0.1.2) multi_xml (0.6.0) @@ -406,7 +406,8 @@ GEM activesupport (= 4.2.8) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (2.2.1) + rainbow (2.2.2) + rake rake (12.0.0) ransack (1.6.5) actionpack (>= 3.0) @@ -515,8 +516,8 @@ GEM teaspoon-jasmine (2.3.4) teaspoon (>= 1.0.0) temple (0.7.7) - terminal-table (1.7.3) - unicode-display_width (~> 1.1.1) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref @@ -536,7 +537,7 @@ GEM uglifier (2.7.2) execjs (>= 0.3.0) json (>= 1.8.0) - unicode-display_width (1.1.3) + unicode-display_width (1.3.0) warden (1.2.7) rack (>= 1.0) webmock (3.0.1) diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js index a6b8dcfa1..d277be003 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js @@ -51,7 +51,7 @@ class BSelect4 extends React.Component{ }, cache: true }, - minimumInputLength: 3, + minimumInputLength: 1, templateResult: formatRepo }} /> diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js index b3df767ab..c04a1d642 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js @@ -43,14 +43,14 @@ class BSelect4 extends React.Component{ item => _.assign( {}, item, - { text: '<small><em>Nom: </em></small>' + item.published_name + '<br/><small><em>Code: </em></small>' + item.registration_number + '<br/><small><em>ID: </em></small>' + _.last(_.split(item.object_id, ':')) } + { text: "<strong>" + item.published_name + _.last(_.split(item.object_id, ':')) + "</strong><br/><small>" + item.registration_number + "</small>" } ) ) }; }, cache: true }, - minimumInputLength: 0, + minimumInputLength: 1, escapeMarkup: function (markup) { return markup; }, templateResult: formatRepo }} diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js index b236e7d94..3e81290f5 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js @@ -2,6 +2,7 @@ var _ = require('lodash') var React = require('react') var PropTypes = require('react').PropTypes var Select2 = require('react-select2') +var actions = require('../../../actions') // get JSON full path var origin = window.location.origin @@ -37,20 +38,20 @@ class BSelect4 extends React.Component{ }; }, processResults: function(data, params) { - return { results: data.map( item => _.assign( {}, item, - {text: item.comment} + {text: '<strong>' + (item.color ? "<span class='fa fa-circle' style='color:" + item.color + "'></span> " : '') + item.comment + ' - ' + item.short_id + '</strong><br/><small>' + item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') + '</small>'} ) ) }; }, cache: true }, - minimumInputLength: 3, + minimumInputLength: 1, + escapeMarkup: function (markup) { return markup; }, templateResult: formatRepo }} /> diff --git a/app/assets/stylesheets/_layout.sass b/app/assets/stylesheets/_layout.sass index c19d9b054..b6b91b2a5 100644 --- a/app/assets/stylesheets/_layout.sass +++ b/app/assets/stylesheets/_layout.sass @@ -28,3 +28,13 @@ body // width: 75% border-bottom: 1px solid rgba($blue, 0.5) margin: 30px auto 45px auto + +.content_header + font-size: 2.2rem + font-weight: normal + margin: 40px 0 + padding: 0px 15px 9px 15px + border-bottom: 1px solid #eee + + &:first-child + margin-top: 0 diff --git a/app/assets/stylesheets/components/_panels.sass b/app/assets/stylesheets/components/_panels.sass index ff384faf9..e9f615081 100644 --- a/app/assets/stylesheets/components/_panels.sass +++ b/app/assets/stylesheets/components/_panels.sass @@ -17,9 +17,31 @@ border-bottom: 2px solid $darkgrey padding: 5px 15px + .badge + color: #fff + background-color: $grey + > h3, > h4 margin: 0 + > .panel-title.with_actions + display: table + width: 100% + + .badge + vertical-align: top + + a + text-decoration: none + color: $blue + + &:hover, &:focus + color: $darkblue + + > div + display: table-cell + vertical-align: middle + .panel-footer padding: 5px 15px background-color: transparent diff --git a/app/assets/stylesheets/components/_select2.sass b/app/assets/stylesheets/components/_select2.sass index 960e8b10b..332af16cd 100644 --- a/app/assets/stylesheets/components/_select2.sass +++ b/app/assets/stylesheets/components/_select2.sass @@ -7,6 +7,10 @@ // .select2-results__message, .loading-results // display: none +.select2-container, .select2-container--bootstrap + .select2-selection--single .select2-selection__rendered + height: 100% + .select2-selection__placeholder color: rgba($grey, 0.65) font-style: italic diff --git a/app/assets/stylesheets/old_application.sass.erb b/app/assets/stylesheets/old_application.sass.erb deleted file mode 100644 index 3443a035d..000000000 --- a/app/assets/stylesheets/old_application.sass.erb +++ /dev/null @@ -1,62 +0,0 @@ -// First import journal variables -$brand-primary: <%= ChouetteIhm::Application.config.company_theme %> -$navbar-default-bg: $brand-primary -$navbar-default-link-color: white -$body-bg: #eee - -// Then bootstrap itself -@import 'bootstrap-sass-official/_bootstrap-sprockets.scss' -@import 'bootstrap-sass-official' - -// Whatever application styles you have go last -// Modules and Variables -@import 'modules/search' -@import 'modules/index_item' -@import 'modules/icons' -@import 'modules/devise' -@import 'modules/progress_bars' - -// Partials -@import 'partials/base' -@import 'partials/header' -@import 'partials/footer' - -// Third-party -@import 'tagmanager/tagmanager' -@import 'font-awesome-sprockets' -@import 'font-awesome' -@import 'jquery-ui' -@import 'formtastic' -@import 'eonasdan-bootstrap-datetimepicker' -@import 'footable' -@import 'OpenLayers/ol' -@import 'OpenLayers/custom' - -// Select2, themed w. Bootstrap -@import 'select2' -@import 'select2-bootstrap' - -@import 'vendor/openlayers_style' -@import 'vendor/openlayers_ie6-style' -@import 'vendor/openlayers_google' -@import 'vendor/openlayers_framedCloud' -@import 'vendor/formtastic_changes' -@import 'vendor/pagination' -@import 'vendor/map_layers' -@import 'vendor/token-input' -@import 'vendor/typeahead' -@import 'vendor/bootstrap_changes' -@import 'vendor/simple_form' -// Select2 -@import 'vendor/select2' -@import 'vendor/select2-bootstrap' - -// Main css -@import 'main/*' - -// Components -@import 'components/*' - -// Hack to make li simple -li - list-style: none diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 07a732fc9..cf27c39cf 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -16,14 +16,13 @@ class CompaniesController < BreadcrumbController redirect_to params.merge(:page => 1) end - @companies = ModelDecorator.decorate( - @companies, - with: CompanyDecorator, - context: { - referential: line_referential - } - ) + @companies = decorate_companies(@companies) } + + format.json { + @companies = decorate_companies(@companies) + } + build_breadcrumb :index end end @@ -77,4 +76,14 @@ class CompaniesController < BreadcrumbController %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc' end + def decorate_companies(companies) + ModelDecorator.decorate( + companies, + with: CompanyDecorator, + context: { + referential: line_referential + } + ) + end + end diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index d1f83340e..5dae1ba3f 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -37,14 +37,13 @@ class NetworksController < BreadcrumbController redirect_to params.merge(:page => 1) end - @networks = ModelDecorator.decorate( - @networks, - with: NetworkDecorator, - context: { - line_referential: line_referential - } - ) + @networks = decorate_networks(@networks) } + + format.js { + @networks = decorate_networks(@networks) + } + build_breadcrumb :index end end @@ -87,4 +86,14 @@ class NetworksController < BreadcrumbController %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc' end + def decorate_networks(networks) + ModelDecorator.decorate( + networks, + with: NetworkDecorator, + context: { + line_referential: line_referential + } + ) + end + end diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb index 53dde93bb..482f74ea0 100644 --- a/app/controllers/referential_companies_controller.rb +++ b/app/controllers/referential_companies_controller.rb @@ -14,14 +14,13 @@ class ReferentialCompaniesController < ChouetteController redirect_to params.merge(:page => 1) end - @companies = ModelDecorator.decorate( - @companies, - with: CompanyDecorator, - context: { - referential: referential - } - ) + @companies = decorate_companies(@companies) } + + format.js { + @companies = decorate_companies(@companies) + } + build_breadcrumb :index end end @@ -70,4 +69,14 @@ class ReferentialCompaniesController < ChouetteController %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc' end + def decorate_companies(companies) + ModelDecorator.decorate( + companies, + with: CompanyDecorator, + context: { + referential: referential + } + ) + end + end diff --git a/app/controllers/referential_networks_controller.rb b/app/controllers/referential_networks_controller.rb index e0ce71ce4..ee2db8008 100644 --- a/app/controllers/referential_networks_controller.rb +++ b/app/controllers/referential_networks_controller.rb @@ -30,14 +30,13 @@ class ReferentialNetworksController < ChouetteController redirect_to params.merge(:page => 1) end - @networks = ModelDecorator.decorate( - @networks, - with: ReferentialNetworkDecorator, - context: { - referential: referential - } - ) + @networks = decorate_networks(@networks) } + + format.js { + @networks = decorate_networks(@networks) + } + build_breadcrumb :index end end @@ -81,4 +80,14 @@ class ReferentialNetworksController < ChouetteController %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc' end + def decorate_networks(networks) + ModelDecorator.decorate( + networks, + with: ReferentialNetworkDecorator, + context: { + referential: referential + } + ) + end + end diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 20d500ea9..edeb5a32f 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -37,7 +37,7 @@ class TimeTablesController < ChouetteController tt_params = time_table_params if tt_params[:calendar_id] %i(monday tuesday wednesday thursday friday saturday sunday).map { |d| tt_params[d] = true } - calendar = current_organisation.calendars.find_by_id(tt_params[:calendar_id]) + calendar = Calendar.find(tt_params[:calendar_id]) tt_params[:calendar_id] = nil if tt_params.has_key?(:dates_attributes) || tt_params.has_key?(:periods_attributes) end @@ -86,16 +86,14 @@ class TimeTablesController < ChouetteController redirect_to params.merge(:page => 1) end - @time_tables = ModelDecorator.decorate( - @time_tables, - with: TimeTableDecorator, - context: { - referential: @referential - } - ) + @time_tables = decorate_time_tables(@time_tables) build_breadcrumb :index } + + format.js { + @time_tables = decorate_time_tables(@time_tables) + } end end @@ -195,6 +193,16 @@ class TimeTablesController < ChouetteController Chouette::TimeTable.find(from_id) if from_id end + def decorate_time_tables(time_tables) + ModelDecorator.decorate( + time_tables, + with: TimeTableDecorator, + context: { + referential: @referential + } + ) + end + def time_table_params params.require(:time_table).permit( :objectid, diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb index 22a71863a..171db6a07 100644 --- a/app/controllers/workbenches_controller.rb +++ b/app/controllers/workbenches_controller.rb @@ -2,7 +2,13 @@ class WorkbenchesController < BreadcrumbController before_action :query_params, only: [:show] defaults resource_class: Workbench - respond_to :html, only: [:show] + respond_to :html, only: [:show, :index] + + def index + # Only display Wb with selected name, according to #4108 + @workbench = current_organisation.workbenches.find_by(name: "Gestion de l'offre") + @calendars = Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true) + end def show scope = resource.all_referentials diff --git a/app/jobs/mailer_job.rb b/app/jobs/mailer_job.rb index 761a29cd6..3918745b8 100644 --- a/app/jobs/mailer_job.rb +++ b/app/jobs/mailer_job.rb @@ -1,5 +1,5 @@ class MailerJob < ActiveJob::Base - queue_as :mail + # No need to specify queue it's already used mailers queue def perform klass, action, params klass.constantize.public_send(action, *params).deliver_later diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb index 3dbf6be0d..8fe79dc0c 100644 --- a/app/models/chouette/stop_point.rb +++ b/app/models/chouette/stop_point.rb @@ -36,12 +36,12 @@ module Chouette def stop_area_id_validation if stop_area_id.nil? - errors.add(:stop_area_id, I18n.t("errors.messages.empty")) + errors.add(:stop_area_id, I18n.t("stop_areas.errors.empty")) end end def self.area_candidates - Chouette::StopArea.where( :area_type => ['Quay', 'BoardingPosition']) + Chouette::StopArea.where(:area_type => ['Quay', 'BoardingPosition']) end end diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb index 71c339780..19299d098 100644 --- a/app/models/chouette/vehicle_journey.rb +++ b/app/models/chouette/vehicle_journey.rb @@ -142,7 +142,7 @@ module Chouette vj.update_attributes(state_permited_attributes(item)) vj.update_has_and_belongs_to_many_from_state(item) - item['errors'] = vj.errors if vj.errors.any? + item['errors'] = vj.errors.full_messages.uniq if vj.errors.any? end # Delete ids of new object from state if we had to rollback diff --git a/app/models/concerns/default_attributes_support.rb b/app/models/concerns/default_attributes_support.rb index 7928093e6..e85a59160 100644 --- a/app/models/concerns/default_attributes_support.rb +++ b/app/models/concerns/default_attributes_support.rb @@ -77,7 +77,8 @@ module DefaultAttributesSupport def build_objectid if objectid.include? ':__pending_id__' fix_uniq_objectid - update_attributes( :objectid => objectid, :object_version => (object_version - 1) ) + self.object_version = object_version - 1 + self.save(validate: false) end end diff --git a/app/models/referential.rb b/app/models/referential.rb index ed23e2e51..e65d6a33b 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -186,7 +186,7 @@ class Referential < ActiveRecord::Base before_validation :clone_associations, :on => :create, if: :created_from before_validation :assign_slug, :on => :create before_validation :assign_prefix, :on => :create - before_create :create_schema, unless: :created_from + before_create :create_schema after_create :clone_schema, if: :created_from diff --git a/app/policies/referential_policy.rb b/app/policies/referential_policy.rb index 9d0a92093..fdc80516c 100644 --- a/app/policies/referential_policy.rb +++ b/app/policies/referential_policy.rb @@ -20,7 +20,7 @@ class ReferentialPolicy < ApplicationPolicy def clone? - !archived? && organisation_match? && create? + !archived? && create? end def archive? @@ -37,7 +37,3 @@ class ReferentialPolicy < ApplicationPolicy end end - - - - diff --git a/app/views/compliance_checks/detailed_errors_index.csv.slim b/app/views/compliance_checks/detailed_errors_index.csv.slim index 0b2c3f24f..7fe20e282 100644 --- a/app/views/compliance_checks/detailed_errors_index.csv.slim +++ b/app/views/compliance_checks/detailed_errors_index.csv.slim @@ -29,7 +29,7 @@ = error["source"]["file"]["line_number"] - else - = I18n.t("activemodel.attributes.compliance_check_result."+r.test_id); + = I18n.t("activemodel.attributes.compliance_check_result.#{r.test_id}"); = I18n.t("compliance_check_result.details.detail_#{error['error_id']}", object_labels_hash(error) ) = "\n" diff --git a/app/views/compliance_checks/summary_errors_index.csv.slim b/app/views/compliance_checks/summary_errors_index.csv.slim index bbb2c8c88..8c88d5cf6 100644 --- a/app/views/compliance_checks/summary_errors_index.csv.slim +++ b/app/views/compliance_checks/summary_errors_index.csv.slim @@ -16,7 +16,7 @@ = r.result; = r.test_id; - = I18n.t("activemodel.attributes.compliance_check_result." + r.test_id); + = I18n.t("activemodel.attributes.compliance_check_result.#{r.test_id}"); = Rails.application.config.validation_spec + I18n.locale.to_s + "/" + r.test_id + ".html"; = r.error_count diff --git a/app/views/layouts/navigation/_main_nav_left.html.slim b/app/views/layouts/navigation/_main_nav_left.html.slim index 3cf6428af..9dfc828c0 100644 --- a/app/views/layouts/navigation/_main_nav_left.html.slim +++ b/app/views/layouts/navigation/_main_nav_left.html.slim @@ -16,7 +16,7 @@ #miOne.panel-collapse.collapse .list-group - = link_to root_path, class: "list-group-item #{(@localizationUrl == 'referentials#index') ? 'active' : ''}" do + = link_to root_path, class: "list-group-item #{(@localizationUrl == 'workbenches#index') ? 'active' : ''}" do span Tableau de bord = link_to '#', class: 'list-group-item' do span Offre de mon organisation diff --git a/app/views/referential_stop_areas/index.html.slim b/app/views/referential_stop_areas/index.html.slim index 1cbe1945f..7bf39eabd 100644 --- a/app/views/referential_stop_areas/index.html.slim +++ b/app/views/referential_stop_areas/index.html.slim @@ -4,7 +4,7 @@ .panel.panel-default .panel-heading .input-group.col-md-9.col-sm-9 - = f.text_field :name_or_objectid_cont, placeholder: t('.name_or_objectid'), class: 'form-control' + = f.text_field :name_or_objectid_cont, placeholder: t('stop_areas.filters.name_or_objectid'), class: 'form-control' .input-group-btn button.btn.btn-primary#search-btn type="submit" span.fa.fa-search diff --git a/app/views/stop_area_copies/new.html.slim b/app/views/stop_area_copies/new.html.slim index 1a8764cbc..b506d35f4 100644 --- a/app/views/stop_area_copies/new.html.slim +++ b/app/views/stop_area_copies/new.html.slim @@ -1,4 +1,4 @@ -= title_tag t("stop_area_copies.new.title."+@stop_area_copy.hierarchy) += title_tag t("stop_area_copies.new.title.#{@stop_area_copy.hierarchy}") = semantic_form_for [@referential, @stop_area, @stop_area_copy] do |form| br diff --git a/app/views/workbenches/index.html.slim b/app/views/workbenches/index.html.slim new file mode 100644 index 000000000..1bd116a85 --- /dev/null +++ b/app/views/workbenches/index.html.slim @@ -0,0 +1,67 @@ +/ PageHeader += pageheader 'map-marker', + t('.title', organisation: current_organisation.name) + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-12 + h2.content_header = t('.offers.title') + + .row + .col-lg-6.col-md-6.col-sm-6.col-xs-12 + .panel.panel-default + .panel-heading + h3.panel-title + = t('.offers.organisation') + + .panel-body + em.small.text-muted = t('.offers.no_content') + + .panel.panel-default + .panel-heading + h3.panel-title + = t('.offers.idf') + + .panel-body + em.small.text-muted = t('.offers.no_content') + + .col-lg-6.col-md-6.col-sm-6.col-xs-12 + .panel.panel-default + .panel-heading + h3.panel-title.with_actions + div + = t('.offers.referentials') + span.badge.ml-xs = @workbench.referentials.count if @workbench.all_referentials.any? + + div + = link_to '', workbench_path(@workbench), class: ' fa fa-chevron-right pull-right', title: t('.offers.see') + + - if @workbench.all_referentials.any? + .list-group + - @workbench.all_referentials.each_with_index do |referential, i| + = link_to referential.name, referential_path(referential), class: 'list-group-item' if i < 6 + + - else + .panel-body + em.small.text-muted = t('.offers.no_content') + + .panel.panel-default + .panel-heading + h3.panel-title.with_actions + div + = t('.offers.calendars') + span.badge.ml-xs = @calendars.count if @calendars.any? + + div + = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right', title: t('.offers.see') + + - if @calendars.any? + .list-group + - @calendars.each_with_index do |calendar, i| + = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' if i < 6 + + - else + .panel-body + em.small.text-muted = t('.offers.no_content') diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 88c02341b..19a919cc2 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -1,9 +1,9 @@ # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks # The "main" locale. -base_locale: en +base_locale: fr ## All available locales are inferred from the data by default. Alternatively, specify them explicitly: -# locales: [es, fr] +locales: [en, fr] ## Reporting locale, default: en. Available: en, ru. # internal_locale: en @@ -18,7 +18,6 @@ data: ## Default: - config/locales/%{locale}.yml ## More files: - - config/locales/*.%{locale}.yml - config/locales/**/*.%{locale}.yml ## Another gem (replace %#= with %=): # - "<%#= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml" @@ -27,13 +26,12 @@ data: # `i18n-tasks normalize -p` will force move the keys according to these rules write: ## For example, write devise and simple form keys to their respective files: - - ['{devise}.*', 'config/locales/devise.%{locale}.yml'] - - ['{simple_form}.*', 'config/locales/simple_form.%{locale}.yml'] + - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml'] ## Catch-all default: - config/locales/%{locale}.yml ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class. - # router: convervative_router + # router: conservative_router yaml: write: @@ -68,13 +66,18 @@ search: - app/assets/images - app/assets/fonts - app/assets/javascripts + - app/assets/videos ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`: ## If specified, this settings takes priority over `exclude`, but `exclude` still applies. - # include: ["*.rb", "*.html.slim"] + # only: ["*.rb", "*.html.slim"] - ## Default scanner finds t() and I18n.t() calls. - # scanner: I18n::Tasks::Scanners::PatternWithScopeScanner + ## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`. + # strict: true + + ## Multiple scanners can be used. Their results are merged. + ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well. + ## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example ## Google Translate # translation: @@ -104,3 +107,16 @@ search: ## Ignore these keys completely: # ignore: # - kaminari.* + +## Sometimes, it isn't possible for i18n-tasks to match the key correctly, +## e.g. in case of a relative key defined in a helper method. +## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.: +# +# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper', +# only: %w(*.html.haml *.html.slim), +# patterns: [['= title\b', '.page_title']] %> +# +# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.: +# +# <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper', +# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %> diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml index cffd04fcf..f6979136a 100644 --- a/config/locales/actions.en.yml +++ b/config/locales/actions.en.yml @@ -4,6 +4,7 @@ en: destroy: "Destroy" delete: "Delete" search: "Search" + submit: "Submit" add: "Add new" new: "Add new" show: "See" diff --git a/config/locales/calendars.en.yml b/config/locales/calendars.en.yml index f6c5ba852..cb1ede4c7 100644 --- a/config/locales/calendars.en.yml +++ b/config/locales/calendars.en.yml @@ -9,6 +9,19 @@ en: friday: F saturday: Sa sunday: Su + months: + 1: January + 2: February + 3: March + 4: April + 5: May + 6: June + 7: July + 8: August + 9: September + 10: October + 11: November + 12: December standard_calendars: Standard calendars standard_calendar: Standard calendar actions: diff --git a/config/locales/en.yml b/config/locales/en.yml index 0a6002175..b25f5fd7f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -14,6 +14,38 @@ en: formats: short: "%Y/%m/%d" short_with_time: "%Y/%m/%d at %Hh%M" + abbr_day_names: + - Sun + - Mon + - Tue + - Wed + - Thu + - Fri + - Sat + day_names: + - Sunday + - Monday + - Tuesday + - Wednesday + - Thursday + - Friday + - Saturday + month_names: + - + - January + - February + - March + - April + - May + - June + - July + - August + - September + - October + - November + - December + errors: + format: "%{message}" last_update: 'Last update on<br>%{time}' last_sync: 'Last sync on %{time}' diff --git a/config/locales/enumerize.en.yml b/config/locales/enumerize.en.yml index f76237288..0bc3e5edc 100644 --- a/config/locales/enumerize.en.yml +++ b/config/locales/enumerize.en.yml @@ -114,6 +114,7 @@ en: transport_mode: interchange: Interchange unknown: "unknown" + undefined: "undefined" air: "Air" train: "Train" long_distance_train: "Long distance train" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 3d5dc4c2c..8ef183d91 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -14,6 +14,36 @@ fr: formats: short: "%d/%m/%Y" short_with_time: "%d/%m/%Y à %Hh%M" + abbr_day_names: + - dim + - lun + - mar + - mer + - jeu + - ven + - sam + day_names: + - dimanche + - lundi + - mardi + - mercredi + - jeudi + - vendredi + - samedi + month_names: + - + - janvier + - février + - mars + - avril + - mai + - juin + - juillet + - août + - septembre + - octobre + - novembre + - décembre errors: format: "%{message}" @@ -25,3 +55,4 @@ fr: id_codif: 'ID Codifligne' id_reflex: 'ID Reflex' + objectid: 'ID' diff --git a/config/locales/imports.en.yml b/config/locales/imports.en.yml index a5eb0f969..b20f0f1da 100644 --- a/config/locales/imports.en.yml +++ b/config/locales/imports.en.yml @@ -7,6 +7,8 @@ en: index: title: "Imports" warning: "" + new: + title: "Imports" show: report: "Report" imported_file: "Original file" diff --git a/config/locales/imports.fr.yml b/config/locales/imports.fr.yml index 8fe8817f5..933025c82 100644 --- a/config/locales/imports.fr.yml +++ b/config/locales/imports.fr.yml @@ -7,6 +7,8 @@ fr: index: title: "Imports" warning: "" + new: + title: "Imports" show: report: "Rapport" imported_file: "Fichier source" diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index d4bd45129..9f89c9d46 100644 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -4,6 +4,6 @@ en: created: subject: A new shared calendar has been created body: A new shared calendar% {cal_name} has been added by STIF. You can now view it in the list of shared calendars %{cal_index_url} - created: + updated: subject: A shared calendar has been updated body: A new shared calendar% {cal_name} has been updated by STIF. You can now view it in the list of shared calendars %{cal_index_url} diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index 7a4c60869..5f39f03f4 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -1,6 +1,6 @@ en: referentials: - filter: + filters: name_or_number_or_objectid: 'Search by name, number or objectid' search_no_results: 'No data space matching your query' index: @@ -41,6 +41,7 @@ en: user_excluded: "%{user} is a reserved value" overlapped_referential: "%{referential} cover the same perimeter" overlapped_period: "Another period is on the same period" + short_period: Min period length is two days activerecord: models: referential: diff --git a/config/locales/routes.en.yml b/config/locales/routes.en.yml index d8160772f..3099d4ab1 100644 --- a/config/locales/routes.en.yml +++ b/config/locales/routes.en.yml @@ -84,9 +84,3 @@ en: hub: route: objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 8." - - # simpleform - helpers: - submit: - route: - create: 'Create route' diff --git a/config/locales/routing_constraint_zones.en.yml b/config/locales/routing_constraint_zones.en.yml index 59d4484a8..836705a6a 100644 --- a/config/locales/routing_constraint_zones.en.yml +++ b/config/locales/routing_constraint_zones.en.yml @@ -24,9 +24,6 @@ en: routing_constraint_zones: search_no_results: "No ITL matches your query" actions: - new: New routing constraint zone - edit: Edit this routing constraint zone - destroy: Delete this routing constraint zone destroy_confirm: Are you sure you want to delete this routing constraint zone? new: title: Add a new routings constraint zone diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index f6c0079ee..ad722312e 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -7,21 +7,11 @@ en: required: text: 'Required field' mark: '*' - # You can uncomment the line below if you need to overwrite the whole required html. - # When using html, text and mark won't be used. - # html: '<abbr title="required">*</abbr>' error_notification: default_message: "Please review the problems below:" - # Labels and hints examples - # labels: - # defaults: - # password: 'Password' - # user: - # new: - # email: 'E-mail to sign in.' - # edit: - # email: 'E-mail.' - # hints: - # defaults: - # username: 'User name to sign in.' - # password: 'No special characters, please.' + + helpers: + submit: + create: Submit + edit: Edit + update: Edit diff --git a/config/locales/simple_form.fr.yml b/config/locales/simple_form.fr.yml index 2a6893595..cd5dd1fbe 100644 --- a/config/locales/simple_form.fr.yml +++ b/config/locales/simple_form.fr.yml @@ -15,16 +15,3 @@ fr: create: Valider edit: Editer update: Editer - # Labels and hints examples - # labels: - # defaults: - # password: 'Password' - # user: - # new: - # email: 'E-mail to sign in.' - # edit: - # email: 'E-mail.' - # hints: - # defaults: - # username: 'User name to sign in.' - # password: 'No special characters, please.' diff --git a/config/locales/stop_areas.en.yml b/config/locales/stop_areas.en.yml index 3d6b65350..324294892 100644 --- a/config/locales/stop_areas.en.yml +++ b/config/locales/stop_areas.en.yml @@ -1,6 +1,8 @@ en: stop_areas: &en_stop_areas search_no_results: "No stop area matching your query" + errors: + empty: Aucun stop_area_id default_geometry_success: "%{count} modified stop areas" stop_area: no_position: "No Position" @@ -90,6 +92,7 @@ en: registration_number: "Registration number" published_name: "Published name" deleted: "Deleted" + deleted_at: "Deleted at" comment: "Description" stop_area_type: "Area type" area_type: "Area type" @@ -179,5 +182,6 @@ en: comment: "Maximum length = 255." coordinates: "Coordinates are mandatory." projection_xy: "x,y in secondary referential, dot for decimal separator" + referential_stop_areas: <<: *en_stop_areas diff --git a/config/locales/stop_areas.fr.yml b/config/locales/stop_areas.fr.yml index 3e49cdf7c..216516e5b 100644 --- a/config/locales/stop_areas.fr.yml +++ b/config/locales/stop_areas.fr.yml @@ -1,6 +1,8 @@ fr: stop_areas: &fr_stop_areas search_no_results: "Aucun arrêt ne correspond à votre recherche" + errors: + empty: Aucun stop_area_id default_geometry_success: "%{count} arrêts édités" stop_area: no_position: "Pas de position" @@ -14,6 +16,7 @@ fr: new: "Ajouter un arrêt" edit: "Editer cet arrêt" destroy: "Supprimer cet arrêt" + deleted_at: "Activé" destroy_confirm: "Etes vous sûr de supprimer cet arrêt ainsi que tous ses fils?" select_parent: "Créer ou éditer la relation enfant -> parent" add_children: "Créer ou éditer la relation parent -> enfants" diff --git a/config/locales/time_tables.en.yml b/config/locales/time_tables.en.yml index dc6c6d9f4..24750f0af 100644 --- a/config/locales/time_tables.en.yml +++ b/config/locales/time_tables.en.yml @@ -24,6 +24,8 @@ en: success: "Actualize succeded" new: title: "Add a new timetable" + duplicate: + title: "Duplicate timetable" edit: title: "Update timetable %{time_table}" show: diff --git a/config/locales/workbenches.en.yml b/config/locales/workbenches.en.yml new file mode 100644 index 000000000..8525a4b9f --- /dev/null +++ b/config/locales/workbenches.en.yml @@ -0,0 +1,12 @@ +en: + workbenches: + index: + title: "%{organisation} dashboard" + offers: + title: "Transport offers" + organisation: "Organisation offers" + idf: "IDF offers" + referentials: "Referentials" + calendars: "Calendars" + see: "See the list" + no_content: "No content yet." diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml new file mode 100644 index 000000000..1cdc19a13 --- /dev/null +++ b/config/locales/workbenches.fr.yml @@ -0,0 +1,12 @@ +fr: + workbenches: + index: + title: "Tableau de bord %{organisation}" + offers: + title: "Offres de transport" + organisation: "Offres de mon organisation" + idf: "Offres IDF" + referentials: "Jeux de données" + calendars: "Calendriers" + see: "Voir la liste" + no_content: "Aucun contenu pour le moment" diff --git a/config/routes.rb b/config/routes.rb index 686c19eff..0ed401cf5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ require 'sidekiq/web' ChouetteIhm::Application.routes.draw do - resources :workbenches, :only => [:show] do + resources :workbenches, only: [:show, :index] do delete :referentials, on: :member, action: :delete_referentials resources :imports do get :download, on: :member @@ -14,7 +14,7 @@ ChouetteIhm::Application.routes.draw do devise_scope :user do authenticated :user do - root :to => 'referentials#index', as: :authenticated_root + root :to => 'workbenches#index', as: :authenticated_root end unauthenticated :user do @@ -77,7 +77,7 @@ ChouetteIhm::Application.routes.draw do get :autocomplete, on: :collection, controller: 'autocomplete_calendars' end - resources :referentials do + resources :referentials, except: :index do resources :api_keys resources :autocomplete_stop_areas, only: [:show, :index] do get 'around', on: :member @@ -214,7 +214,8 @@ ChouetteIhm::Application.routes.draw do end end end - root :to => "referentials#index" + + root :to => "workbenches#index" get '/help/(*slug)' => 'help#show' diff --git a/config/sidekiq.yml b/config/sidekiq.yml new file mode 100644 index 000000000..be0fceb30 --- /dev/null +++ b/config/sidekiq.yml @@ -0,0 +1,5 @@ +:concurrency: 5 +:pidfile: tmp/pids/sidekiq.pid +:queues: + - default + - mailers diff --git a/lib/tasks/generate.rake b/lib/tasks/generate.rake index 4b1e98ca4..f02a75cc2 100644 --- a/lib/tasks/generate.rake +++ b/lib/tasks/generate.rake @@ -1,12 +1,9 @@ namespace :generate do - + desc "Create model diagrams for Chouette" task :model_diagram => :environment do - sh "bundle exec rake erd orientation=horizontal title='Chouette v2.5.2 model diagram (part 1)' only='Organisation,Referential,Export,Api::V1::ApiKey,ExportLogMessage,Import,RuleParameterSet,Validation,User' filename='model-diagram-part-1'" - - sh "bundle exec rake erd:generate orientation=horizontal title='Chouette v2.5.2 model diagram (part 2)' exclude='Organisation,Referential,Export,Api::V1::ApiKey,ExportLogMessage,Import,RuleParameterSet, Validation,User,NetexImport,NeptuneImport,GtfsImport,CsvImport,Delayed::Backend::ActiveRecord::Job' filename='model-diagram-part-2'" - - sh "bundle exec rake erd:generate orientation=horizontal title='Chouette v2.5.2 model diagram (part 3)' only='NetexImport,NeptuneImport,GtfsImport,CsvImport,Delayed::Backend::ActiveRecord::Job' filename='model-diagram-part-3'" + sh "bundle exec rake erd only='Calendar,Referential,Chouette::Line,Chouette::Route,Chouette::JourneyPattern,Chouette::VehicleJourney,Chouette::VehicleJourneyAtStop,Chouette::TimeTable,Chouette::TimeTableDate,Chouette::TimeTablePeriod,Chouette::Footnote,Chouette::Network,Chouette::Company,Chouette::StopPoint,Chouette::StopArea' filename='offer_datas' title='Offer Datas'" + sh "bundle exec rake erd only='Organisation,Referential,User,Workbench' filename='organisation' title='Organisation'" end - + end diff --git a/spec/decorators/referential_decorator_spec.rb b/spec/decorators/referential_decorator_spec.rb index 5de6b7e95..16da8d30b 100644 --- a/spec/decorators/referential_decorator_spec.rb +++ b/spec/decorators/referential_decorator_spec.rb @@ -25,7 +25,7 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do end end - context 'all rights and different organisation' do + context 'all rights and different organisation' do let( :user ){ build_stubbed :allmighty_user } @@ -33,10 +33,11 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do expect_action_link_elements.to be_empty expect_action_link_hrefs.to eq([ referential_time_tables_path(object), + new_referential_path(from: object), ]) end end - context 'all rights and same organisation' do + context 'all rights and same organisation' do let( :user ){ build_stubbed :allmighty_user, organisation: referential.organisation } diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb index c78ef5b33..c495becac 100644 --- a/spec/models/chouette/vehicle_journey_spec.rb +++ b/spec/models/chouette/vehicle_journey_spec.rb @@ -10,7 +10,7 @@ describe Chouette::VehicleJourney, :type => :model do vehicle_journey.validate expect(vjas[0].errors[:departure_time]).not_to be_blank - expect(vehicle_journey.errors[:vehicle_journey_at_stops].count).to eq(1) + expect(vehicle_journey.errors.count).to eq(1) expect(vehicle_journey).not_to be_valid end @@ -19,7 +19,7 @@ describe Chouette::VehicleJourney, :type => :model do vehicle_journey.validate expect(vjas[0].errors[:departure_time]).to be_blank - expect(vehicle_journey.errors[:vehicle_journey_at_stops]).to be_empty + expect(vehicle_journey.errors).to be_empty expect(vehicle_journey).to be_valid end diff --git a/spec/policies/referential_policy_spec.rb b/spec/policies/referential_policy_spec.rb index 33d8e13e8..69d0eb17b 100644 --- a/spec/policies/referential_policy_spec.rb +++ b/spec/policies/referential_policy_spec.rb @@ -46,7 +46,7 @@ RSpec.describe ReferentialPolicy, type: :policy do # ------------------ permissions :clone? do - it_behaves_like 'permitted policy and same organisation', 'referentials.create', archived: true + it_behaves_like 'permitted policy', 'referentials.create', archived: true end permissions :archive? do |
