diff options
28 files changed, 61 insertions, 67 deletions
@@ -1 +1 @@ -6.12.0 +6.13.0 diff --git a/app/javascript/routes/components/App.js b/app/javascript/routes/components/App.js index 26e69bf53..6f8cdf749 100644 --- a/app/javascript/routes/components/App.js +++ b/app/javascript/routes/components/App.js @@ -3,14 +3,9 @@ import PropTypes from 'prop-types' import AddStopPoint from '../containers/AddStopPoint' import VisibleStopPoints from'../containers/VisibleStopPoints' import clone from '../../helpers/clone' -const I18n = clone(window , "I18n", true) export default class App extends Component { - getChildContext() { - return { I18n } - } - render() { return ( <div> @@ -20,7 +15,3 @@ export default class App extends Component { ) } } - -App.childContextTypes = { - I18n: PropTypes.object -} diff --git a/app/javascript/routes/components/BSelect2.js b/app/javascript/routes/components/BSelect2.js index 89e1b6cfa..90f288944 100644 --- a/app/javascript/routes/components/BSelect2.js +++ b/app/javascript/routes/components/BSelect2.js @@ -10,8 +10,8 @@ var path = window.location.pathname.split('/', 3).join('/') export default class BSelect3 extends Component { - constructor(props, context) { - super(props, context) + constructor(props) { + super(props) } onChange(e) { this.props.onChange(this.props.index, { @@ -86,7 +86,7 @@ class BSelect2 extends Component{ onSelect={ this.props.onSelect } ref='newSelect' options={{ - placeholder: this.context.I18n.t("routes.edit.select2.placeholder"), + placeholder: I18n.t("routes.edit.select2.placeholder"), allowClear: true, language: 'fr', /* Doesn't seem to work... :( */ theme: 'bootstrap', @@ -129,8 +129,4 @@ class BSelect2 extends Component{ /> ) } -} - -BSelect2.contextTypes = { - I18n: PropTypes.object -} +}
\ No newline at end of file diff --git a/app/javascript/routes/components/OlMap.js b/app/javascript/routes/components/OlMap.js index 4beb02872..16fec0e87 100644 --- a/app/javascript/routes/components/OlMap.js +++ b/app/javascript/routes/components/OlMap.js @@ -3,8 +3,8 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' export default class OlMap extends Component{ - constructor(props, context){ - super(props, context) + constructor(props){ + super(props) } fetchApiURL(id){ @@ -115,40 +115,40 @@ export default class OlMap extends Component{ <strong>{this.props.value.olMap.json.name}</strong> </p> <p> - <strong>{this.context.I18n.t('routes.edit.map.stop_point_type')} : </strong> + <strong>{I18n.t('routes.edit.map.stop_point_type')} : </strong> {this.props.value.olMap.json.area_type} </p> <p> - <strong>{this.context.I18n.t('routes.edit.map.short_name')} : </strong> + <strong>{I18n.t('routes.edit.map.short_name')} : </strong> {this.props.value.olMap.json.short_name} </p> <p> - <strong>{this.context.I18n.t('id_reflex')} : </strong> + <strong>{I18n.t('id_reflex')} : </strong> {this.props.value.olMap.json.user_objectid} </p> - <p><strong>{this.context.I18n.t('routes.edit.map.coordinates')} : </strong></p> + <p><strong>{I18n.t('routes.edit.map.coordinates')} : </strong></p> <p style={{paddingLeft: 10, marginTop: 0}}> - <em>{this.context.I18n.t('routes.edit.map.proj')}.: </em>WSG84<br/> - <em>{this.context.I18n.t('routes.edit.map.lat')}.: </em>{this.props.value.olMap.json.latitude} <br/> - <em>{this.context.I18n.t('routes.edit.map.lon')}.: </em>{this.props.value.olMap.json.longitude} + <em>{I18n.t('routes.edit.map.proj')}.: </em>WSG84<br/> + <em>{I18n.t('routes.edit.map.lat')}.: </em>{this.props.value.olMap.json.latitude} <br/> + <em>{I18n.t('routes.edit.map.lon')}.: </em>{this.props.value.olMap.json.longitude} </p> <p> - <strong>{this.context.I18n.t('routes.edit.map.postal_code')} : </strong> + <strong>{I18n.t('routes.edit.map.postal_code')} : </strong> {this.props.value.olMap.json.zip_code} </p> <p> - <strong>{this.context.I18n.t('routes.edit.map.city')} : </strong> + <strong>{I18n.t('routes.edit.map.city')} : </strong> {this.props.value.olMap.json.city_name} </p> <p> - <strong>{this.context.I18n.t('routes.edit.map.comment')} : </strong> + <strong>{I18n.t('routes.edit.map.comment')} : </strong> {this.props.value.olMap.json.comment} </p> {(this.props.value.stoparea_id != this.props.value.olMap.json.stoparea_id) &&( <div className='btn btn-outline-primary btn-sm' onClick= {() => {this.props.onUpdateViaOlMap(this.props.index, this.props.value.olMap.json)}} - >{this.context.I18n.t('actions.select')}</div> + >{I18n.t('actions.select')}</div> )} </div> <div className='map_content'> @@ -164,7 +164,3 @@ export default class OlMap extends Component{ OlMap.propTypes = { } - -OlMap.contextTypes = { - I18n: PropTypes.object -} diff --git a/app/javascript/routes/components/StopPoint.js b/app/javascript/routes/components/StopPoint.js index 908e97263..916052b42 100644 --- a/app/javascript/routes/components/StopPoint.js +++ b/app/javascript/routes/components/StopPoint.js @@ -6,7 +6,7 @@ import OlMap from './OlMap' import { defaultAttribute } from '../actions' -export default function StopPoint(props, {I18n}) { +export default function StopPoint(props) { return ( <div className='nested-fields'> <div className='wrapper'> @@ -92,7 +92,3 @@ StopPoint.propTypes = { index: PropTypes.number, value: PropTypes.object } - -StopPoint.contextTypes = { - I18n: PropTypes.object -} diff --git a/app/javascript/routes/components/StopPointList.js b/app/javascript/routes/components/StopPointList.js index b227abdea..9bc5e02d1 100644 --- a/app/javascript/routes/components/StopPointList.js +++ b/app/javascript/routes/components/StopPointList.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import StopPoint from './StopPoint' -export default function StopPointList({ stopPoints, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange, onSelectChange, onToggleMap, onToggleEdit, onSelectMarker, onUnselectMarker, onUpdateViaOlMap }, {I18n}) { +export default function StopPointList({ stopPoints, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange, onSelectChange, onToggleMap, onToggleEdit, onSelectMarker, onUnselectMarker, onUpdateViaOlMap }) { return ( <div className='subform'> <div className='nested-head'> diff --git a/app/javascript/routes/containers/AddStopPoint.js b/app/javascript/routes/containers/AddStopPoint.js index fd9227ff3..4b169807d 100644 --- a/app/javascript/routes/containers/AddStopPoint.js +++ b/app/javascript/routes/containers/AddStopPoint.js @@ -11,7 +11,7 @@ let AddStopPoint = ({ dispatch }) => { dispatch(actions.addStop()) }}> <button type="submit" className="btn btn-outline-primary"> - Ajouter un arrêt + {I18n.t('stop_areas.actions.new')} </button> </form> </div> diff --git a/app/javascript/vehicle_journeys/components/Filters.js b/app/javascript/vehicle_journeys/components/Filters.js index 93fe015a8..1e43a490e 100644 --- a/app/javascript/vehicle_journeys/components/Filters.js +++ b/app/javascript/vehicle_journeys/components/Filters.js @@ -33,6 +33,7 @@ export default function Filters({filters, pagination, missions, onFilter, onRese {/* Calendriers */} <div className='form-group w33'> <TimetableSelect2 + placeholder={I18n.t('vehicle_journeys.vehicle_journeys_matrix.filters.timetable')} onSelect2Timetable={onSelect2Timetable} hasRoute={true} chunkURL={("/autocomplete_time_tables.json?route_id=" + String(window.route_id))} diff --git a/app/javascript/vehicle_journeys/components/tools/CreateModal.js b/app/javascript/vehicle_journeys/components/tools/CreateModal.js index 1d470cd43..2806708f4 100644 --- a/app/javascript/vehicle_journeys/components/tools/CreateModal.js +++ b/app/javascript/vehicle_journeys/components/tools/CreateModal.js @@ -14,7 +14,8 @@ export default class CreateModal extends Component { handleSubmit() { if(!this.props.modal.modalProps.selectedJPModal){ let field = $('#NewVehicleJourneyModal').find(".vjCreateSelectJP") - field.parent().parent().addClass('has-error').children('.help-block').remove() + field.parent().parent().addClass('has-error') + field.parent().children('.help-block').remove() field.parent().append("<span class='small help-block'>" + I18n.t("simple_form.required.text") + "</span>") return } diff --git a/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js index 5d300f70c..ef58916f4 100644 --- a/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js @@ -31,13 +31,13 @@ export default class NotesEditVehicleJourney extends Component { type='button' className='btn btn-outline-danger btn-xs' onClick={() => this.props.onToggleFootnoteModal(lf, false)} - ><span className="fa fa-trash"></span> Retirer</button> + ><span className="fa fa-trash"></span>{I18n.t('actions.remove')}</button> } else { return <button type='button' className='btn btn-outline-primary btn-xs' onClick={() => this.props.onToggleFootnoteModal(lf, true)} - ><span className="fa fa-plus"></span> Ajouter</button> + ><span className="fa fa-plus"></span>{I18n.t('actions.add')}</button> } } diff --git a/app/javascript/vehicle_journeys/components/tools/PurchaseWindowsEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/PurchaseWindowsEditVehicleJourney.js index 30c511302..5fc925f4c 100644 --- a/app/javascript/vehicle_journeys/components/tools/PurchaseWindowsEditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/PurchaseWindowsEditVehicleJourney.js @@ -44,7 +44,7 @@ export default class PurchaseWindowsEditVehicleJourney extends Component { <div className='modal-dialog'> <div className='modal-content'> <div className='modal-header'> - <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.purchase_windows')}s</h4> + <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.purchase_windows')}</h4> <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> @@ -95,6 +95,7 @@ export default class PurchaseWindowsEditVehicleJourney extends Component { <div className='wrapper'> <div> <TimetableSelect2 + placeholder={I18n.t('vehicle_journeys.vehicle_journeys_matrix.filters.purchase_window')} onSelect2Timetable={this.props.onSelect2Timetable} chunkURL={'/autocomplete_purchase_windows.json'} searchKey={"name_or_objectid_cont_any"} diff --git a/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js index 9ee2e1849..594140c76 100644 --- a/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js @@ -97,6 +97,7 @@ export default class TimetablesEditVehicleJourney extends Component { <div className='wrapper'> <div> <TimetableSelect2 + placeholder={I18n.t('vehicle_journeys.vehicle_journeys_matrix.filters.timetable')} onSelect2Timetable={this.props.onSelect2Timetable} chunkURL={'/autocomplete_time_tables.json'} searchKey={"unaccented_comment_or_objectid_cont_any"} diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js index d5aad20d0..919853a71 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js @@ -26,7 +26,7 @@ export default class BSelect4 extends Component { allowClear: false, theme: 'bootstrap', width: '100%', - placeholder: I18n.t('vehicle_journeys.vehicle_journeys_matrix.filters.timetable'), + placeholder: this.props.placeholder, language: require('./language'), ajax: { url: origin + path + this.props.chunkURL, diff --git a/app/javascript/vehicle_journeys/reducers/modal.js b/app/javascript/vehicle_journeys/reducers/modal.js index bcfc6ea0b..84567ec0d 100644 --- a/app/javascript/vehicle_journeys/reducers/modal.js +++ b/app/javascript/vehicle_journeys/reducers/modal.js @@ -164,7 +164,9 @@ export default function modal(state = {}, action) { confirmModal: {} } case 'SELECT_JP_CREATE_MODAL': - newModalProps = _.assign({}, state.modalProps, {selectedJPModal : action.selectedItem}) + let selected = action.selectedItem + delete selected["element"] + newModalProps = _.assign({}, state.modalProps, {selectedJPModal : selected}) return _.assign({}, state, {modalProps: newModalProps}) case 'SHIFT_VEHICLEJOURNEY_MODAL': return { diff --git a/config/environments/development.rb b/config/environments/development.rb index 7bd049979..d08077769 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -96,9 +96,11 @@ Rails.application.configure do config.i18n.available_locales = [:fr, :en] + config.serve_static_files = true + config.middleware.insert_after(ActionDispatch::Static, Rack::LiveReload) if ENV['LIVERELOAD'] config.middleware.use I18n::JS::Middleware - config.middleware.use CacheSettings, { + config.middleware.insert_before ActionDispatch::Static, CacheSettings, { /\/assets\/.*/ => { cache_control: "max-age=86400, public", expires: 86400 diff --git a/config/environments/production.rb b/config/environments/production.rb index eb44e1ab1..89b74154f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -138,7 +138,7 @@ Rails.application.configure do config.iev_url = ENV.fetch('IEV_URL',"http://iev:8080") config.rails_host = ENV.fetch('RAILS_HOST','http://front:3000') - config.middleware.use CacheSettings, { + config.middleware.insert_before ActionDispatch::Static, CacheSettings, { /\/assets\/.*/ => { cache_control: "max-age=#{1.year.to_i}, public", expires: 1.year.to_i diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml index c349b709f..faf0dcec2 100644 --- a/config/locales/actions.en.yml +++ b/config/locales/actions.en.yml @@ -9,7 +9,8 @@ en: search: "Search" submit: "Submit" processing: "Processing…" - add: "Add new" + add: "Add" + remove: Remove new: "Add new" show: "See" archive: "Archive" diff --git a/config/locales/actions.fr.yml b/config/locales/actions.fr.yml index 88e08aaef..ed1a86189 100644 --- a/config/locales/actions.fr.yml +++ b/config/locales/actions.fr.yml @@ -9,7 +9,8 @@ fr: search: "Chercher" submit: "Valider" processing: "En cours…" - add: 'Créer' + add: 'Ajouter' + remove: Retirer new: 'Créer' show: 'Consulter' archive: 'Conserver' diff --git a/config/locales/compliance_controls.en.yml b/config/locales/compliance_controls.en.yml index 18069f2f7..cb370c5df 100644 --- a/config/locales/compliance_controls.en.yml +++ b/config/locales/compliance_controls.en.yml @@ -217,7 +217,7 @@ en: line_control/lines_scope: one: "Lines must be included in the lines scope of the organization" generic_attribute_control/pattern: - one: "Attribute pattern of an object in a line" + one: "Attribute regular expression of an object in a line" generic_attribute_control/min_max: one: "Min, max values of numeric fields" generic_attribute_control/uniqueness: @@ -235,3 +235,4 @@ en: target: "Target" prerequisite: "Prerequisite" predicate: "Predicate" + pattern: Regular expression diff --git a/config/locales/compliance_controls.fr.yml b/config/locales/compliance_controls.fr.yml index 7dc6eeeb3..0b0555b6d 100644 --- a/config/locales/compliance_controls.fr.yml +++ b/config/locales/compliance_controls.fr.yml @@ -214,7 +214,7 @@ fr: line_control/lines_scope: one: "Les lignes doivent appartenir au périmètre de lignes de l'organisation" generic_attribute_control/pattern: - one: "Contrôle du contenu selon un pattern" + one: "Contrôle du contenu selon une expression régulière" generic_attribute_control/min_max: one: "Valeur min, max de champs numériques" generic_attribute_control/uniqueness: @@ -232,3 +232,4 @@ fr: target: "Cible" prerequisite: "Prérequis" predicate: "Prédicat" + pattern: Expression régulière diff --git a/config/locales/routes.en.yml b/config/locales/routes.en.yml index 66805e050..c1bacf7f0 100644 --- a/config/locales/routes.en.yml +++ b/config/locales/routes.en.yml @@ -4,7 +4,7 @@ en: placeholder: Search by name or ID no_results: "No route matching your query" actions: - new: "Add a new route" + new: "Add a route" edit: "Edit this route" edit_boarding_alighting: "Stop alighting and boarding" destroy: "Remove this route" @@ -17,7 +17,7 @@ en: new_stop_point: "Create new stop" reversed_vehicle_journey: "Reversed vehicle journeys" new: - title: "Add a new route" + title: "Add a route" edit: title: "Update route %{name}" select2: diff --git a/config/locales/stop_areas.en.yml b/config/locales/stop_areas.en.yml index 1da4b58b4..4d19a77e9 100644 --- a/config/locales/stop_areas.en.yml +++ b/config/locales/stop_areas.en.yml @@ -20,8 +20,8 @@ en: accessibility: "Accessibility" custom_fields: "Custom fields" actions: - new: "Add a new stop area" - create: "Add a new stop area" + new: "Add a stop area" + create: "Add a stop area" edit: "Edit stop area" update: "Edit stop area" destroy: "Delete stop area" diff --git a/config/locales/stop_points.en.yml b/config/locales/stop_points.en.yml index 76e142ba1..bcdb56de8 100644 --- a/config/locales/stop_points.en.yml +++ b/config/locales/stop_points.en.yml @@ -52,7 +52,7 @@ en: simple_form: labels: stop_point: - name: Stop Point - for_boarding: "Pickup" - for_alighting: "Drop off" + name: Stop Area + for_boarding: Boarding + for_alighting: Alighting reflex_id: ID diff --git a/config/locales/vehicle_journeys.en.yml b/config/locales/vehicle_journeys.en.yml index 8bc268197..c0d6f74d4 100644 --- a/config/locales/vehicle_journeys.en.yml +++ b/config/locales/vehicle_journeys.en.yml @@ -5,6 +5,8 @@ en: id: Filter by ID... journey_pattern: Filter by journey pattern... timetable: Filter by timetable... + + purchase_window: Filter by purchase window cancel_selection: "Cancel Selection" fetching_error: "There has been a problem fetching the data. Please reload the page to try again." line_routes: "Line's routes" diff --git a/config/locales/vehicle_journeys.fr.yml b/config/locales/vehicle_journeys.fr.yml index 18703be9b..b17e102a8 100644 --- a/config/locales/vehicle_journeys.fr.yml +++ b/config/locales/vehicle_journeys.fr.yml @@ -5,6 +5,7 @@ fr: id: Filtrer par ID course... journey_pattern: 'Filtrer par code, nom ou OID de mission...' timetable: Filtrer par calendrier... + purchase_windows: Filtrer par calendrier commercial... cancel_selection: "Annuler la sélection" fetching_error: "La récupération des missions a rencontré un problème. Rechargez la page pour tenter de corriger le problème." line_routes: "Séquences d'arrêts de la ligne" diff --git a/spec/features/calendars_permissions_spec.rb b/spec/features/calendars_permissions_spec.rb index 656c0dd78..6b0b782db 100644 --- a/spec/features/calendars_permissions_spec.rb +++ b/spec/features/calendars_permissions_spec.rb @@ -57,14 +57,14 @@ RSpec.describe 'Calendars', type: :feature do context 'if present → ' do let( :permission ){ true } it 'index shows an edit button' do - expect(page).to have_css('a.btn.btn-default', text: 'Créer') + expect(page).to have_css('a.btn.btn-default', text: I18n.t('actions.add')) end end context 'if absent → ' do let( :permission ){ false } it 'index does not show any edit button' do - expect(page).not_to have_css('a.btn.btn-default', text: 'Créer') + expect(page).not_to have_css('a.btn.btn-default', text: I18n.t('actions.add')) end end end diff --git a/spec/features/routing_constraint_zones_spec.rb b/spec/features/routing_constraint_zones_spec.rb index b116b38bd..b3286af82 100644 --- a/spec/features/routing_constraint_zones_spec.rb +++ b/spec/features/routing_constraint_zones_spec.rb @@ -20,7 +20,7 @@ describe 'RoutingConstraintZones', type: :feature do context 'user has permission to create routing_constraint_zones' do it 'shows a create link for routing_constraint_zones' do - expect(page).to have_content(I18n.t('actions.new')) + expect(page).to have_content(I18n.t('actions.add')) end end @@ -28,7 +28,7 @@ describe 'RoutingConstraintZones', type: :feature do it 'does not show a create link for routing_constraint_zones' do @user.update_attribute(:permissions, []) visit referential_line_routing_constraint_zones_path(referential, line) - expect(page).not_to have_content(I18n.t('actions.new')) + expect(page).not_to have_content(I18n.t('actions.add')) end end diff --git a/spec/features/workbenches/workbenches_permissions_spec.rb b/spec/features/workbenches/workbenches_permissions_spec.rb index 1c073a4c5..a48a6dc64 100644 --- a/spec/features/workbenches/workbenches_permissions_spec.rb +++ b/spec/features/workbenches/workbenches_permissions_spec.rb @@ -23,7 +23,7 @@ describe 'Workbenches', type: :feature do it 'shows the corresponding button' do expected_href = new_workbench_referential_path(workbench) - expect( page ).to have_link('Créer', href: expected_href) + expect( page ).to have_link(I18n.t('actions.add'), href: expected_href) end end @@ -31,7 +31,7 @@ describe 'Workbenches', type: :feature do let( :permission ){ false } it 'does not show the corresponding button' do - expect( page ).not_to have_link('Créer') + expect( page ).not_to have_link(I18n.t('actions.add')) end end # let!(:ready_referential) { create :referential, workbench: workbench, metadatas: referential_metadatas, ready: true, organisation: @user.organisation } |
