diff options
87 files changed, 363 insertions, 186 deletions
diff --git a/app/assets/stylesheets/components/_pagination.sass b/app/assets/stylesheets/components/_pagination.sass index 88ba61c3c..b811a559c 100644 --- a/app/assets/stylesheets/components/_pagination.sass +++ b/app/assets/stylesheets/components/_pagination.sass @@ -7,6 +7,9 @@ border-radius: 0 line-height: 34px + &:first-letter + text-transform: capitalize + .page_links display: inline-block vertical-align: top diff --git a/app/decorators/referential_decorator.rb b/app/decorators/referential_decorator.rb index 41cad237d..cce14d160 100644 --- a/app/decorators/referential_decorator.rb +++ b/app/decorators/referential_decorator.rb @@ -43,7 +43,7 @@ class ReferentialDecorator < AF83::Decorator end instance_decorator.action_link policy: :edit, secondary: :show, on: :show do |l| - l.content 'Purger' + l.content t('actions.clean_up') l.href '#' l.type 'button' l.data {{ diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 356c7e69e..479b661c8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -14,14 +14,17 @@ module ApplicationHelper def page_header_title(object) # Unwrap from decorator, we want to know the object model name object = object.object if object.try(:object) - + if Referential === object return object.full_name end local = "#{object.model_name.name.underscore.pluralize}.#{params[:action]}.title" + + arg = object.organisation.name if Workbench === object + if object.try(:name) - t(local, name: object.name || object.id) + t(local, name: arg || object.name || object.id) else t(local) end diff --git a/app/helpers/multiple_selection_toolbox_helper.rb b/app/helpers/multiple_selection_toolbox_helper.rb index e0a1d2dd4..7e02c6d73 100644 --- a/app/helpers/multiple_selection_toolbox_helper.rb +++ b/app/helpers/multiple_selection_toolbox_helper.rb @@ -20,7 +20,7 @@ module MultipleSelectionToolboxHelper data: { path: delete_path, # #5206 Missing Translations - confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?' + confirm: t('actions.are_you_sure') }, title: t("actions.#{action}") ) do @@ -34,7 +34,7 @@ module MultipleSelectionToolboxHelper label = content_tag( :span, - ("<span>0</span> élément(s) sélectionné(s)").html_safe, + ("<span>0</span> #{t('table_builders.selected_elements')}").html_safe, class: 'info-msg' ) diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb index 61714a066..84b4015a2 100644 --- a/app/helpers/routes_helper.rb +++ b/app/helpers/routes_helper.rb @@ -24,7 +24,7 @@ module RoutesHelper stop_area_attributes = stop_point.stop_area.attributes.slice("name","city_name", "zip_code", "registration_number", "longitude", "latitude", "area_type", "comment") stop_area_attributes["short_name"] = truncate(stop_area_attributes["name"], :length => 30) || "" stop_point_attributes = stop_point.attributes.slice("for_boarding","for_alighting") - stop_area_attributes.merge(stop_point_attributes).merge(stoppoint_id: stop_point.id, stoparea_id: stop_point.stop_area.id).merge(user_objectid: stop_point.stop_area.user_objectid) + stop_area_attributes.merge(stop_point_attributes).merge(stoppoint_id: stop_point.id, stoparea_id: stop_point.stop_area.id, stoparea_kind: stop_point.stop_area.kind).merge(user_objectid: stop_point.stop_area.user_objectid) end data = data.to_json if serialize data diff --git a/app/javascript/helpers/save_button.js b/app/javascript/helpers/save_button.js index 7e0bd5bbe..af5ee54a8 100644 --- a/app/javascript/helpers/save_button.js +++ b/app/javascript/helpers/save_button.js @@ -35,7 +35,7 @@ export default class SaveButton extends Component{ this.props.editMode ? this.submitForm() : this.props.onEnterEditMode() }} > - {this.props.editMode ? "Valider" : "Editer"} + {this.props.editMode ? I18n.t('actions.submit') : I18n.t('actions.edit')} </button> </div> </form> diff --git a/app/javascript/journey_patterns/actions/index.js b/app/javascript/journey_patterns/actions/index.js index b90908264..666157ea4 100644 --- a/app/javascript/journey_patterns/actions/index.js +++ b/app/javascript/journey_patterns/actions/index.js @@ -220,7 +220,16 @@ const actions = { }) }, fetchRouteCosts: (dispatch, key, index) => { - if (actions.routeCostsCache) { + if(actions.fetchingRouteCosts){ + // A request is already sent, wait for it + if(!actions.waitingForRouteCosts){ + actions.waitingForRouteCosts = [] + } + actions.waitingForRouteCosts.push([key, index]) + return + } + + if(actions.routeCostsCache) { // Dispatch asynchronously to prevent warning when // this executes during `render()` requestAnimationFrame(() => { @@ -231,6 +240,7 @@ const actions = { )) }) } else { + actions.fetchingRouteCosts = true fetch(window.routeCostsUrl, { credentials: 'same-origin', }).then(response => { @@ -240,6 +250,12 @@ const actions = { actions.routeCostsCache = costs dispatch(actions.receiveRouteCosts(costs, key, index)) + if(actions.waitingForRouteCosts){ + actions.waitingForRouteCosts.map(function(item, i) { + dispatch(actions.receiveRouteCosts(costs, item[0], item[1])) + }) + } + actions.fetchingRouteCosts = false }) } }, diff --git a/app/javascript/journey_patterns/components/JourneyPattern.js b/app/javascript/journey_patterns/components/JourneyPattern.js index e912b7660..d381b0d50 100644 --- a/app/javascript/journey_patterns/components/JourneyPattern.js +++ b/app/javascript/journey_patterns/components/JourneyPattern.js @@ -80,7 +80,6 @@ export default class JourneyPattern extends Component{ let from = null this.props.value.stop_points.map((stopPoint, i) =>{ let usePoint = stopPoint.checked - console.log(stopPoint) if(onlyCommercial && (i == 0 || i == this.props.value.stop_points.length - 1) && stopPoint.kind == "non_commercial"){ usePoint = false } @@ -131,12 +130,9 @@ export default class JourneyPattern extends Component{ } } - componentWillUpdate() { - [this.totalTime, this.totalDistance] = this.totals(false) - } - render() { this.previousSpId = undefined + let [totalTime, totalDistance] = this.totals(false) let [commercialTotalTime, commercialTotalDistance] = this.totals(true) return ( <div className={'t2e-item' + (this.props.value.deletable ? ' disabled' : '') + (this.props.value.object_id ? '' : ' to_record') + (this.props.value.errors ? ' has-error': '') + (this.hasFeature('costs_in_journey_patterns') ? ' with-costs' : '')}> @@ -146,8 +142,8 @@ export default class JourneyPattern extends Component{ <div>{I18n.t('journey_patterns.show.stop_points_count', {count: actions.getChecked(this.props.value.stop_points).length})}</div> {this.hasFeature('costs_in_journey_patterns') && <div className="small row totals"> - <span className="col-md-6"><i className="fa fa-arrows-h"></i>{this.totalDistance}</span> - <span className="col-md-6"><i className="fa fa-clock-o"></i>{this.totalTime}</span> + <span className="col-md-6"><i className="fa fa-arrows-h"></i>{totalDistance}</span> + <span className="col-md-6"><i className="fa fa-clock-o"></i>{totalTime}</span> </div> } {this.hasFeature('costs_in_journey_patterns') && diff --git a/app/javascript/packs/routes/edit.js b/app/javascript/packs/routes/edit.js index b787bec97..fc7aa203d 100644 --- a/app/javascript/packs/routes/edit.js +++ b/app/javascript/packs/routes/edit.js @@ -29,6 +29,7 @@ const getInitialState = () => { state.push({ stoppoint_id: v.stoppoint_id, stoparea_id: v.stoparea_id, + stoparea_kind: v.stoparea_kind, user_objectid: v.user_objectid, short_name: v.short_name ? v.short_name.replace("'", "\'") : '', area_type: v.area_type, @@ -39,8 +40,8 @@ const getInitialState = () => { name: v.name ? v.name.replace("'", "\'") : '', registration_number: v.registration_number, text: fancyText, - for_boarding: v.for_boarding || "normal", - for_alighting: v.for_alighting || "normal", + for_boarding: v.for_boarding, + for_alighting: v.for_alighting, longitude: v.longitude || 0, latitude: v.latitude || 0, comment: v.comment ? v.comment.replace("'", "\'") : '', diff --git a/app/javascript/routes/actions/index.js b/app/javascript/routes/actions/index.js index 13b2d60b2..5fbf5bce9 100644 --- a/app/javascript/routes/actions/index.js +++ b/app/javascript/routes/actions/index.js @@ -56,7 +56,12 @@ const actions = { unselectMarker: (index) => ({ type: 'UNSELECT_MARKER', index - }) + }), + defaultAttribute: (attribute, stopAreaKind) => { + if (attribute !== '') return attribute + if (stopAreaKind === undefined) return '' + return stopAreaKind === "commercial" ? "normal" : "forbidden" + } } module.exports = actions diff --git a/app/javascript/routes/components/BSelect2.js b/app/javascript/routes/components/BSelect2.js index 035bce155..89e1b6cfa 100644 --- a/app/javascript/routes/components/BSelect2.js +++ b/app/javascript/routes/components/BSelect2.js @@ -17,6 +17,7 @@ export default class BSelect3 extends Component { this.props.onChange(this.props.index, { text: e.currentTarget.textContent, stoparea_id: e.currentTarget.value, + stoparea_kind: e.params.data.kind, user_objectid: e.params.data.user_objectid, longitude: e.params.data.longitude, latitude: e.params.data.latitude, diff --git a/app/javascript/routes/components/StopPoint.js b/app/javascript/routes/components/StopPoint.js index af51a6bb4..368ec8261 100644 --- a/app/javascript/routes/components/StopPoint.js +++ b/app/javascript/routes/components/StopPoint.js @@ -4,6 +4,8 @@ import PropTypes from 'prop-types' import BSelect2 from './BSelect2' import OlMap from './OlMap' +import { defaultAttribute } from '../actions' + export default function StopPoint(props, {I18n}) { return ( <div className='nested-fields'> @@ -17,14 +19,14 @@ export default function StopPoint(props, {I18n}) { </div> <div> - <select className='form-control' value={props.value.for_boarding} id="for_boarding" onChange={props.onSelectChange}> + <select className='form-control' value={defaultAttribute(props.value.for_boarding, props.value.stoparea_kind)} id="for_boarding" onChange={props.onSelectChange}> <option value="normal">{I18n.t('routes.edit.stop_point.boarding.normal')}</option> <option value="forbidden">{I18n.t('routes.edit.stop_point.boarding.forbidden')}</option> </select> </div> <div> - <select className='form-control' value={props.value.for_alighting} id="for_alighting" onChange={props.onSelectChange}> + <select className='form-control' value={defaultAttribute(props.value.for_alighting, props.value.stoparea_kind)} id="for_alighting" onChange={props.onSelectChange}> <option value="normal">{I18n.t('routes.edit.stop_point.alighting.normal')}</option> <option value="forbidden">{I18n.t('routes.edit.stop_point.alighting.forbidden')}</option> </select> diff --git a/app/javascript/routes/index.js b/app/javascript/routes/index.js index febae7d54..3c7322953 100644 --- a/app/javascript/routes/index.js +++ b/app/javascript/routes/index.js @@ -26,6 +26,7 @@ const getInitialState = () => { state.push({ stoppoint_id: v.stoppoint_id, stoparea_id: v.stoparea_id, + stoparea_kind: v.stoparea_kind, user_objectid: v.user_objectid, short_name: v.short_name ? v.short_name.replace("'", "\'") : '', area_type: v.area_type, @@ -36,8 +37,8 @@ const getInitialState = () => { name: v.name ? v.name.replace("'", "\'") : '', registration_number: v.registration_number, text: fancyText, - for_boarding: v.for_boarding || "normal", - for_alighting: v.for_alighting || "normal", + for_boarding: v.for_boarding || '', + for_alighting: v.for_alighting || '', longitude: v.longitude || 0, latitude: v.latitude || 0, comment: v.comment ? v.comment.replace("'", "\'") : '', diff --git a/app/javascript/routes/reducers/stopPoints.js b/app/javascript/routes/reducers/stopPoints.js index 0b42b504f..ba183d002 100644 --- a/app/javascript/routes/reducers/stopPoints.js +++ b/app/javascript/routes/reducers/stopPoints.js @@ -8,8 +8,8 @@ const stopPoint = (state = {}, action, length) => { text: '', index: length, edit: true, - for_boarding: 'normal', - for_alighting: 'normal', + for_boarding: '', + for_alighting: '', olMap: { isOpened: false, json: {} @@ -68,6 +68,7 @@ const stopPoints = (state = [], action) => { stoppoint_id: t.stoppoint_id, text: action.text.text, stoparea_id: action.text.stoparea_id, + stoparea_kind: action.text.stoparea_kind, user_objectid: action.text.user_objectid, latitude: action.text.latitude, longitude: action.text.longitude, diff --git a/app/javascript/time_tables/components/SaveTimetable.js b/app/javascript/time_tables/components/SaveTimetable.js index 704590abd..468f1773b 100644 --- a/app/javascript/time_tables/components/SaveTimetable.js +++ b/app/javascript/time_tables/components/SaveTimetable.js @@ -26,7 +26,7 @@ export default class SaveTimetable extends Component{ } }} > - Valider + {I18n.t('actions.submit')} </button> </form> </div> diff --git a/app/javascript/vehicle_journeys/components/ConfirmModal.js b/app/javascript/vehicle_journeys/components/ConfirmModal.js index 75e8a3932..330b4e02f 100644 --- a/app/javascript/vehicle_journeys/components/ConfirmModal.js +++ b/app/javascript/vehicle_journeys/components/ConfirmModal.js @@ -16,7 +16,7 @@ export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCan type='button' onClick={() => { onModalCancel(modal.confirmModal.callback) }} > - Ne pas valider + {I18n.t('cancel')} </button> <button className='btn btn-danger' @@ -24,7 +24,7 @@ export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCan type='button' onClick={() => { onModalAccept(modal.confirmModal.callback, vehicleJourneys) }} > - Valider + {I18n.t('actions.submit')} </button> </div> </div> diff --git a/app/javascript/vehicle_journeys/components/Navigate.js b/app/javascript/vehicle_journeys/components/Navigate.js index 24843babc..e79823e49 100644 --- a/app/javascript/vehicle_journeys/components/Navigate.js +++ b/app/javascript/vehicle_journeys/components/Navigate.js @@ -1,5 +1,6 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' +import capitalize from 'lodash/capitalize' import actions from'../actions' export default function Navigate({ dispatch, vehicleJourneys, pagination, status, filters}) { @@ -17,7 +18,7 @@ export default function Navigate({ dispatch, vehicleJourneys, pagination, status if(status.fetchSuccess == true) { return ( <div className="pagination"> - {I18n.t("vehicle_journeys.vehicle_journeys_matrix.pagination", {minVJ, maxVJ, total:pagination.totalCount})} + {I18n.t('will_paginate.page_entries_info.multi_page', { model: capitalize(I18n.model_name('vehicle_journey', { plural: true })), from: minVJ, to: maxVJ, count: pagination.totalCount })} <form className='page_links' onSubmit={e => {e.preventDefault()}}> <button onClick={e => { diff --git a/app/javascript/vehicle_journeys/components/tools/CreateModal.js b/app/javascript/vehicle_journeys/components/tools/CreateModal.js index a60429765..f49b51f08 100644 --- a/app/javascript/vehicle_journeys/components/tools/CreateModal.js +++ b/app/javascript/vehicle_journeys/components/tools/CreateModal.js @@ -47,7 +47,7 @@ export default class CreateModal extends Component { <div className='modal-dialog'> <div className='modal-content'> <div className='modal-header'> - <h4 className='modal-title'>Ajouter une course</h4> + <h4 className='modal-title'>{I18n.t('vehicle_journeys.actions.new')}</h4> <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> @@ -57,7 +57,7 @@ export default class CreateModal extends Component { <div className='row'> <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'> <div className='form-group'> - <label className='control-label'>Nom de la course</label> + <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'journey_name')}</label> <input type='text' ref='published_journey_name' @@ -68,7 +68,7 @@ export default class CreateModal extends Component { </div> <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'> <div className='form-group'> - <label className='control-label'>Nom du transporteur</label> + <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'company_name')}</label> <CompanySelect2 company = {this.props.modal.modalProps.vehicleJourney && this.props.modal.modalProps.vehicleJourney.company || undefined} onSelect2Company = {(e) => this.props.onSelect2Company(e)} @@ -78,7 +78,7 @@ export default class CreateModal extends Component { </div> <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'> <div className='form-group'> - <label className='control-label is-required'>Nom public de la mission</label> + <label className='control-label is-required'>{I18n.attribute_name('vehicle_journey', 'journey_pattern_published_name')}</label> <MissionSelect2 selection={this.props.modal.modalProps} onSelect2JourneyPattern={this.props.onSelect2JourneyPattern} @@ -89,7 +89,7 @@ export default class CreateModal extends Component { </div> <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'> <div className='form-group'> - <label className='control-label'>Numéro de train</label> + <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'published_journey_identifier')}</label> <input type='text' ref='published_journey_identifier' @@ -105,7 +105,7 @@ export default class CreateModal extends Component { /> { this.props.modal.modalProps.selectedJPModal && this.props.modal.modalProps.selectedJPModal.full_schedule && <div className='col-lg-6 col-md-6 col-sm-6 col-xs-12'> <div className='form-group'> - <label className='control-label'>Heure de départ</label> + <label className='control-label'>{I18n.attribute_name('vehicle_journey', 'start_time')}</label> <div className='input-group time'> <input type='number' @@ -142,14 +142,14 @@ export default class CreateModal extends Component { type='button' onClick={this.props.onModalClose} > - Annuler + {I18n.t('cancel')} </button> <button className='btn btn-primary' type='button' onClick={this.handleSubmit.bind(this)} > - Valider + {I18n.t('actions.submit')} </button> </div> </form> diff --git a/app/javascript/vehicle_journeys/components/tools/DeleteVehicleJourneys.js b/app/javascript/vehicle_journeys/components/tools/DeleteVehicleJourneys.js index 4815003d3..b1ce3786b 100644 --- a/app/javascript/vehicle_journeys/components/tools/DeleteVehicleJourneys.js +++ b/app/javascript/vehicle_journeys/components/tools/DeleteVehicleJourneys.js @@ -13,7 +13,7 @@ export default function DeleteVehicleJourneys({onDeleteVehicleJourneys, vehicleJ e.preventDefault() onDeleteVehicleJourneys() }} - title='Supprimer' + title={ I18n.t('actions.delete') } > <span className='fa fa-trash'></span> </button> diff --git a/app/javascript/vehicle_journeys/components/tools/DuplicateVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/DuplicateVehicleJourney.js index 102a87d85..d7e48bf08 100644 --- a/app/javascript/vehicle_journeys/components/tools/DuplicateVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/DuplicateVehicleJourney.js @@ -93,7 +93,7 @@ export default class DuplicateVehicleJourney extends Component { <div className='modal-content'> <div className='modal-header'> <h4 className='modal-title'> - Dupliquer { actions.getSelected(this.props.vehicleJourneys).length > 1 ? 'plusieurs courses' : 'une course' } + {I18n.t('vehicle_journeys.vehicle_journeys_matrix.duplicate', { count: actions.getSelected(this.props.vehicleJourneys).length })} </h4> <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> @@ -102,7 +102,7 @@ export default class DuplicateVehicleJourney extends Component { <form className='form-horizontal'> <div className='modal-body'> <div className={'form-group ' + (actions.getSelected(this.props.vehicleJourneys).length > 1 ? 'hidden' : '' )}> - <label className='control-label is-required col-sm-8'>Horaire de départ indicatif</label> + <label className='control-label is-required col-sm-8'>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.duplicate.start_time')}</label> <span className="col-sm-4"> <span className={'input-group time' + (actions.getSelected(this.props.vehicleJourneys).length > 1 ? ' disabled' : '')}> <input @@ -133,7 +133,7 @@ export default class DuplicateVehicleJourney extends Component { </div> <div className='form-group'> - <label className='control-label is-required col-sm-8'>Nombre de courses à créer et dupliquer</label> + <label className='control-label is-required col-sm-8'>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.duplicate.number')}</label> <div className="col-sm-4"> <input type='number' @@ -152,7 +152,7 @@ export default class DuplicateVehicleJourney extends Component { </div> <div className='form-group'> - <label className='control-label is-required col-sm-8'>Décalage à partir duquel on créé les courses</label> + <label className='control-label is-required col-sm-8'>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.duplicate.delta')}</label> <span className="col-sm-4"> <input type='number' @@ -178,7 +178,7 @@ export default class DuplicateVehicleJourney extends Component { type='button' onClick={this.props.onModalClose} > - Annuler + {I18n.t('cancel')} </button> <button className={'btn btn-primary ' + (this.state.additional_time == 0 && this.state.originalDT.hour == this.state.duplicate_time_hh && this.state.originalDT.minute == this.state.duplicate_time_mm ? 'disabled' : '')} @@ -186,7 +186,7 @@ export default class DuplicateVehicleJourney extends Component { onClick={this.handleSubmit} disabled={this.disableValidateButton()} > - Valider + {I18n.t('actions.submit')} </button> </div> </form> diff --git a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js index 795c2ecff..e4e266c79 100644 --- a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js @@ -173,14 +173,14 @@ export default class EditVehicleJourney extends Component { type='button' onClick={this.props.onModalClose} > - Annuler + {I18n.t('cancel')} </button> <button className='btn btn-primary' type='button' onClick={this.handleSubmit.bind(this)} > - Valider + {I18n.t('actions.submit')} </button> </div> } diff --git a/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js index 880542216..5d300f70c 100644 --- a/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js @@ -43,11 +43,11 @@ export default class NotesEditVehicleJourney extends Component { renderAssociatedFN() { if (this.footnotes().associated.length == 0) { - return <h3>Aucune note associée</h3> + return <h3>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.no_associated_footnotes')}</h3> } else { return ( <div> - <h3>Notes associées :</h3> + <h3>{I18n.t('vehicle_journeys.form.purchase_windows')} :</h3> {this.footnotes().associated.map((lf, i) => <div key={i} @@ -68,13 +68,13 @@ export default class NotesEditVehicleJourney extends Component { } renderToAssociateFN() { - if (window.line_footnotes.length == 0) return <h3>La ligne ne possède pas de notes</h3> + if (window.line_footnotes.length == 0) return <h3>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.no_line_footnotes')}</h3> if (this.footnotes().to_associate.length == 0) return false return ( <div> - <h3 className='mt-lg'>Sélectionnez les notes à associer à cette course :</h3> + <h3 className='mt-lg'>{I18n.t('vehicle_journeys.vehicle_journeys_matrix.select_footnotes')} :</h3> {this.footnotes().to_associate.map((lf, i) => <div key={i} className='panel panel-default'> <div className='panel-heading'> @@ -111,7 +111,7 @@ export default class NotesEditVehicleJourney extends Component { <div className='modal-dialog'> <div className='modal-content'> <div className='modal-header'> - <h4 className='modal-title'>Notes</h4> + <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.footnotes')}</h4> <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> @@ -130,14 +130,14 @@ export default class NotesEditVehicleJourney extends Component { type='button' onClick={this.props.onModalClose} > - Annuler + {I18n.t('cancel')} </button> <button className='btn btn-primary' type='button' onClick={this.handleSubmit.bind(this)} > - Valider + {I18n.t('actions.submit')} </button> </div> } diff --git a/app/javascript/vehicle_journeys/components/tools/PurchaseWindowsEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/PurchaseWindowsEditVehicleJourney.js index ce9a4cde9..30c511302 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'>Calendriers commerciaux associés</h4> + <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.purchase_windows')}s</h4> <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> @@ -58,7 +58,7 @@ export default class PurchaseWindowsEditVehicleJourney extends Component { <div className='wrapper'> <div> <div className='form-group'> - <label className='control-label'>{this.props.modal.modalProps.purchase_windows.length == 0 ? "Aucun calendrier commercial associé" : "Calendriers commerciaux associés"}</label> + <label className='control-label'>{this.props.modal.modalProps.purchase_windows.length == 0 ? I18n.t('vehicle_journeys.vehicle_journeys_matrix.no_associated_purchase_windows') : I18n.t('vehicle_journeys.form.purchase_windows')}</label> </div> </div> <div></div> @@ -117,14 +117,14 @@ export default class PurchaseWindowsEditVehicleJourney extends Component { type='button' onClick={this.props.onModalClose} > - Annuler + {I18n.t('cancel')} </button> <button className='btn btn-primary' type='button' onClick={this.handleSubmit} > - Valider + {I18n.t('actions.submit')} </button> </div> } diff --git a/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js index 6574bfa2d..bc3d8db34 100644 --- a/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js @@ -27,6 +27,7 @@ export default class ShiftVehicleJourney extends Component { } render() { + let id = this.props.modal.type == 'shift' && actions.getSelected(this.props.vehicleJourneys)[0].short_id if(this.props.status.isFetching == true) { return false } @@ -48,10 +49,7 @@ export default class ShiftVehicleJourney extends Component { <div className='modal-dialog'> <div className='modal-content'> <div className='modal-header'> - <h4 className='modal-title'>Mettre à jour une course</h4> - {(this.props.modal.type == 'shift') && ( - <em>Mettre à jour les horaires de la course {actions.getSelected(this.props.vehicleJourneys)[0].short_id}</em> - )} + <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.slide_title', {id: id})}</h4> <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> @@ -61,7 +59,7 @@ export default class ShiftVehicleJourney extends Component { <div className='row'> <div className='col-lg-4 col-lg-offset-4 col-md-4 col-md-offset-4 col-sm-4 col-sm-offset-4 col-xs-12'> <div className='form-group'> - <label className='control-label is-required'>Avec un décalage de</label> + <label className='control-label is-required'>{I18n.t('vehicle_journeys.form.slide_delta')}</label> <input type='number' style={{'width': 104}} @@ -85,14 +83,14 @@ export default class ShiftVehicleJourney extends Component { type='button' onClick={this.props.onModalClose} > - Annuler + {I18n.t('cancel')} </button> <button className={'btn btn-primary ' + (this.state.additional_time == 0 ? 'disabled' : '')} type='button' onClick={this.handleSubmit.bind(this)} > - Valider + {I18n.t('actions.submit')} </button> </div> </form> diff --git a/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js index f21480563..7a2686c13 100644 --- a/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js @@ -44,7 +44,7 @@ export default class TimetablesEditVehicleJourney extends Component { <div className='modal-dialog'> <div className='modal-content'> <div className='modal-header'> - <h4 className='modal-title'>Calendriers associés</h4> + <h4 className='modal-title'>{I18n.t('vehicle_journeys.form.time_tables')}</h4> <span type="button" className="close modal-close" data-dismiss="modal">×</span> </div> @@ -58,7 +58,7 @@ export default class TimetablesEditVehicleJourney extends Component { <div className='wrapper'> <div> <div className='form-group'> - <label className='control-label'>{this.props.modal.modalProps.timetables.length == 0 ? "Aucun calendrier associé" : "Calendriers associés"}</label> + <label className='control-label'>{this.props.modal.modalProps.timetables.length == 0 ? I18n.t('vehicle_journeys.vehicle_journeys_matrix.no_associated_timetables'): I18n.t('vehicle_journeys.form.timetables')}</label> </div> </div> <div></div> @@ -119,14 +119,14 @@ export default class TimetablesEditVehicleJourney extends Component { type='button' onClick={this.props.onModalClose} > - Annuler + {I18n.t('cancel')} </button> <button className='btn btn-primary' type='button' onClick={this.handleSubmit} > - Valider + {I18n.t('actions.submit')} </button> </div> } diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/CompanySelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/CompanySelect2.js index 5c7f75d99..b7e9691c1 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/CompanySelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/CompanySelect2.js @@ -16,6 +16,7 @@ export default class BSelect4 extends Component { } render() { + let placeHolder = I18n.t('') return ( <Select2 data={(this.props.company) ? [this.props.company.name] : undefined} @@ -29,7 +30,7 @@ export default class BSelect4 extends Component { allowClear: true, theme: 'bootstrap', width: '100%', - placeholder: 'Filtrer par transporteur...', + placeholder: I18n.t('vehicle_journeys.vehicle_journeys_matrix.affect_company'), language: require('./fr'), ajax: { url: origin + path + '/companies.json' + '?line_id=' + line, diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js index 72dbd0152..96b34125d 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js @@ -74,7 +74,7 @@ export default class BSelect4 extends Component { width: '100%', escapeMarkup: function (markup) { return markup; }, templateResult: formatRepo, - placeholder: 'Filtrer par code, nom ou OID de mission...', + placeholder: I18n.t('vehicle_journeys.vehicle_journeys_matrix.filters.journey_pattern'), language: require('./fr'), allowClear: false, escapeMarkup: function (markup) { return markup; }, diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js index 0339455ca..9a345b464 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: 'Filtrer par calendrier...', + placeholder: I18n.t('vehicle_journeys.vehicle_journeys_matrix.filters.timetable'), language: require('./fr'), ajax: { url: origin + path + this.props.chunkURL, diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js index ccb4c9595..f5881cef7 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js @@ -25,7 +25,7 @@ export default class BSelect4b extends Component { options={{ allowClear: false, theme: 'bootstrap', - placeholder: 'Filtrer par ID course...', + placeholder: I18n.t('vehicle_journeys.vehicle_journeys_matrix.filters.id'), width: '100%', language: require('./fr'), ajax: { diff --git a/app/models/calendar_observer.rb b/app/models/calendar_observer.rb index c81addff4..0414d01d2 100644 --- a/app/models/calendar_observer.rb +++ b/app/models/calendar_observer.rb @@ -3,7 +3,7 @@ class CalendarObserver < ActiveRecord::Observer def after_update calendar return unless calendar.shared - User.with_organisation.each do |user| + User.from_workgroup(calendar.workgroup_id).each do |user| MailerJob.perform_later('CalendarMailer', 'updated', [calendar.id, user.id]) end end @@ -11,7 +11,7 @@ class CalendarObserver < ActiveRecord::Observer def after_create calendar return unless calendar.shared - User.with_organisation.each do |user| + User.from_workgroup(calendar.workgroup_id).each do |user| MailerJob.perform_later('CalendarMailer', 'created', [calendar.id, user.id]) end end diff --git a/app/models/concerns/min_max_values_validation.rb b/app/models/concerns/min_max_values_validation.rb index eff779d81..a79f5ec85 100644 --- a/app/models/concerns/min_max_values_validation.rb +++ b/app/models/concerns/min_max_values_validation.rb @@ -3,11 +3,13 @@ module MinMaxValuesValidation included do validates_presence_of :minimum, :maximum + validates_numericality_of :minimum, :maximum, allow_nil: true, greater_than_or_equal_to: 0 + validates_format_of :minimum, :maximum, with: %r{\A\d+(\.\d+)?\Z} validate :min_max_values_validation end def min_max_values_validation - return true if (minimum && maximum) && (minimum.to_i < maximum.to_i) + return true if (minimum && maximum) && (minimum.to_f < maximum.to_f) errors.add(:minimum, I18n.t('compliance_controls.min_max_values', min: minimum, max: maximum)) end end diff --git a/app/models/generic_attribute_control/min_max.rb b/app/models/generic_attribute_control/min_max.rb index 18873b683..bab900f0e 100644 --- a/app/models/generic_attribute_control/min_max.rb +++ b/app/models/generic_attribute_control/min_max.rb @@ -1,9 +1,7 @@ module GenericAttributeControl class MinMax < ComplianceControl store_accessor :control_attributes, :minimum, :maximum, :target - - validates_numericality_of :minimum, allow_nil: true, greater_than_or_equal_to: 0 - validates_numericality_of :maximum, allow_nil: true, greater_than_or_equal_to: 0 + validates :target, presence: true include MinMaxValuesValidation diff --git a/app/models/user.rb b/app/models/user.rb index d2fdf8f05..eca7ede0c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,6 +30,8 @@ class User < ActiveRecord::Base scope :with_organisation, -> { where.not(organisation_id: nil) } + scope :from_workgroup, ->(workgroup_id) { joins(:workbenches).where(workbenches: {workgroup_id: workgroup_id}) } + # Callback invoked by DeviseCasAuthenticable::Model#authernticate_with_cas_ticket def cas_extra_attributes=(extra_attributes) diff --git a/app/models/vehicle_journey_control/speed.rb b/app/models/vehicle_journey_control/speed.rb index e5e331b50..c9775e7a3 100644 --- a/app/models/vehicle_journey_control/speed.rb +++ b/app/models/vehicle_journey_control/speed.rb @@ -2,8 +2,6 @@ module VehicleJourneyControl class Speed < ComplianceControl store_accessor :control_attributes, :minimum, :maximum - validates_numericality_of :minimum, allow_nil: true, greater_than_or_equal_to: 0 - validates_numericality_of :maximum, allow_nil: true, greater_than_or_equal_to: 0 include MinMaxValuesValidation def self.default_code; "3-VehicleJourney-2" end diff --git a/app/views/autocomplete_stop_areas/around.rabl b/app/views/autocomplete_stop_areas/around.rabl index d067dc4d0..116038639 100644 --- a/app/views/autocomplete_stop_areas/around.rabl +++ b/app/views/autocomplete_stop_areas/around.rabl @@ -15,6 +15,7 @@ child @stop_areas, root: :features, object_root: false do area_type: Chouette::AreaType.find(s.area_type).label, registration_number: s.registration_number, stoparea_id: s.id, + stoparea_kind: s.kind, text: "#{s.name}, #{s.zip_code} #{s.city_name}", user_objectid: s.user_objectid, zip_code: s.zip_code, diff --git a/app/views/autocomplete_stop_areas/index.rabl b/app/views/autocomplete_stop_areas/index.rabl index c92b708f4..786f942d6 100644 --- a/app/views/autocomplete_stop_areas/index.rabl +++ b/app/views/autocomplete_stop_areas/index.rabl @@ -15,7 +15,8 @@ node do |stop_area| :latitude => stop_area.latitude, :area_type => Chouette::AreaType.find(stop_area.area_type).label, :comment => stop_area.comment, - :text => stop_area.full_name + :text => stop_area.full_name, + :kind => stop_area.kind } end diff --git a/app/views/autocomplete_stop_areas/show.rabl b/app/views/autocomplete_stop_areas/show.rabl index 73ce277cf..6ebf38900 100644 --- a/app/views/autocomplete_stop_areas/show.rabl +++ b/app/views/autocomplete_stop_areas/show.rabl @@ -9,7 +9,8 @@ node do |stop_area| :short_name => truncate(stop_area.name, :length => 30) || "", :zip_code => stop_area.zip_code || "", :city_name => stop_area.city_name || "", - :short_city_name => truncate(stop_area.city_name, :length => 15) || "" + :short_city_name => truncate(stop_area.city_name, :length => 15) || "", + :kind => stop_area.kind } end diff --git a/app/views/calendars/_filters.html.slim b/app/views/calendars/_filters.html.slim index 4d664c358..d7e2a927e 100644 --- a/app/views/calendars/_filters.html.slim +++ b/app/views/calendars/_filters.html.slim @@ -1,7 +1,7 @@ = search_form_for @q, url: workgroup_calendars_path(@workgroup), builder: SimpleForm::FormBuilder, html: { method: :get, class: 'form form-filter' } do |f| .ffg-row - .input-group.search_bar class=filter_item_class(params[:q], :name_cont) - = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom/nom court de calendrier...' + .input-group.search_bar class=filter_item_class(params[:q], :name_or_short_name_cont) + = f.search_field :name_cont, class: 'form-control', placeholder: I18n.t('calendars.filters.name_cont') span.input-group-btn button.btn.btn-default#search_btn type='submit' span.fa.fa-search @@ -10,13 +10,13 @@ .form-group.togglable class=filter_item_class(params[:q], :shared_true) = f.label Calendar.human_attribute_name(:shared), required: false, class: 'control-label' .form-group.checkbox_list - = f.input :shared_true, as: :boolean, label: ("<span>Oui</span>").html_safe, wrapper_html: { class: 'checkbox-wrapper' } - = f.input :shared_false, as: :boolean, label: ("<span>Non</span>").html_safe, wrapper_html: { class: 'checkbox-wrapper' } + = f.input :shared_true, as: :boolean, label: ("<span>#{I18n.t('yes')}</span>").html_safe, wrapper_html: { class: 'checkbox-wrapper' } + = f.input :shared_false, as: :boolean, label: ("<span>#{I18n.t('no')}</span>").html_safe, wrapper_html: { class: 'checkbox-wrapper' } .form-group class=filter_item_class(params[:q], :contains_date) = f.label Calendar.human_attribute_name(:date), class: 'control-label' = f.input :contains_date, as: :date, label: false, wrapper_html: { class: 'date smart_date' }, class: 'form-control', include_blank: true .actions - = link_to 'Effacer', workgroup_calendars_path(@workgroup), class: 'btn btn-link' - = f.submit 'Filtrer', id: 'calendar_filter_btn', class: 'btn btn-default' + = link_to I18n.t('actions.erase'), workgroup_calendars_path(@workgroup), class: 'btn btn-link' + = f.submit I18n.t('actions.filter'), id: 'calendar_filter_btn', class: 'btn btn-default' diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim index d4b84fe82..2c87a6f7a 100644 --- a/app/views/calendars/index.html.slim +++ b/app/views/calendars/index.html.slim @@ -35,6 +35,6 @@ - unless @calendars.any? .row.mt-xs .col-lg-12 - = replacement_msg t('calendars.search_no_results') + = replacement_msg t('.search_no_results') = javascript_pack_tag 'date_filters' diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim index fa1ab3b71..648c98928 100644 --- a/app/views/calendars/show.html.slim +++ b/app/views/calendars/show.html.slim @@ -6,10 +6,11 @@ .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 = definition_list t('metadatas'), - { Calendar.human_attribute_name(:shared) => t("#{resource.shared}"), - 'Organisation' => resource.organisation.name, - Calendar.human_attribute_name(:dates) => resource.dates.collect{|d| l(d, format: :short)}.join(', ').html_safe, - Calendar.human_attribute_name(:date_ranges) => resource.periods.map{|d| t('validity_range', debut: l(d.begin, format: :short), end: l(d.end, format: :short))}.join('<br>').html_safe } + { Calendar.tmf('short_name') => resource.try(:short_name), + Calendar.tmf('shared') => t("#{resource.shared}"), + Calendar.tmf('organisation') => resource.organisation.name, + Calendar.tmf('dates') => resource.dates.collect{|d| l(d, format: :short)}.join(', ').html_safe, + Calendar.tmf('date_ranges') => resource.periods.map{|d| t('validity_range', debut: l(d.begin, format: :short), end: l(d.end, format: :short))}.join('<br>').html_safe } - if has_feature?('application_days_on_calendars') .row diff --git a/app/views/compliance_check_sets/show.html.slim b/app/views/compliance_check_sets/show.html.slim index b54bf6c5c..4e1a8e2f9 100644 --- a/app/views/compliance_check_sets/show.html.slim +++ b/app/views/compliance_check_sets/show.html.slim @@ -39,7 +39,7 @@ attribute: Proc.new { |n| I18n.t('compliance_check_sets.show.metrics', n.metrics.deep_symbolize_keys) } \ ), \ TableBuilderHelper::Column.new( \ - name: 'Téléchargement' , \ + key: :download , \ attribute: Proc.new { |n| '<i class="fa fa-download" aria-hidden="true"></i>'.html_safe }, \ sortable: false, \ link_to: lambda do |compliance_check_resource| \ diff --git a/app/views/compliance_checks/show.html.slim b/app/views/compliance_checks/show.html.slim index 3b3861e0c..535fce67d 100644 --- a/app/views/compliance_checks/show.html.slim +++ b/app/views/compliance_checks/show.html.slim @@ -9,5 +9,5 @@ = render partial: "shared/controls/metadatas" - if resource.compliance_check_block = definition_list t('compliance_controls.show.metadatas.compliance_check_block'), - I18n.t('activerecord.attributes.compliance_control_blocks.transport_mode') => I18n.t("enumerize.transport_mode.#{resource.compliance_check_block.transport_mode}"), - I18n.t('activerecord.attributes.compliance_control_blocks.transport_submode') => resource.compliance_check_block.transport_submode.empty? ? I18n.t("enumerize.transport_submode.undefined") : I18n.t("enumerize.transport_submode.#{resource.compliance_check_block.transport_submode}") + ComplianceCheckBlock.tmf('transport_mode') => I18n.t("enumerize.transport_mode.#{resource.compliance_check_block.transport_mode}"), + ComplianceCheckBlock.tmf('transport_submode') => resource.compliance_check_block.transport_submode.empty? ? I18n.t("enumerize.transport_submode.undefined") : I18n.t("enumerize.transport_submode.#{resource.compliance_check_block.transport_submode}") diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim index 59100681d..729c1ce43 100644 --- a/app/views/compliance_control_sets/show.html.slim +++ b/app/views/compliance_control_sets/show.html.slim @@ -6,8 +6,8 @@ .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 = definition_list t('metadatas'), - ComplianceControlSet.human_attribute_name(:name) => @compliance_control_set.name, - I18n.t('activerecord.attributes.compliance_control_set.owner_jdc') => @compliance_control_set.organisation.name + ComplianceControlSet.tmf('name') => @compliance_control_set.name, + ComplianceControlSet.tmf('owner_jdc') => @compliance_control_set.organisation.name - if params[:q].present? || @blocks_to_compliance_controls_map.any? || @direct_compliance_controls .row diff --git a/app/views/dashboards/_dashboard.html.slim b/app/views/dashboards/_dashboard.html.slim index 2f0791f50..e1be3df4a 100644 --- a/app/views/dashboards/_dashboard.html.slim +++ b/app/views/dashboards/_dashboard.html.slim @@ -5,7 +5,7 @@ .panel-heading h3.panel-title.with_actions div - = link_to workbench.name, workbench_path(workbench) + = link_to t('dashboards.workbench.title', organisation: workbench.organisation.name), workbench_path(workbench) span.badge.ml-xs = workbench.referentials.count if workbench.referentials.present? div @@ -23,6 +23,7 @@ .panel-heading h3.panel-title.with_actions = link_to I18n.t("activerecord.models.calendar", count: workbench.calendars.size), workgroup_calendars_path(workbench.workgroup) + span.badge.ml-xs = workbench.calendars.count if workbench.calendars.present? div = link_to '', workgroup_calendars_path(workbench.workgroup), class: ' fa fa-chevron-right pull-right' - if workbench.calendars.present? @@ -39,7 +40,7 @@ - @dashboard.current_organisation.stop_area_referentials.each do |referential| .panel-heading h3.panel-title - = referential.name + = t('dashboards.stop_area_referentials.title') .list-group = link_to Chouette::StopArea.model_name.human.pluralize.capitalize, stop_area_referential_stop_areas_path(referential), class: 'list-group-item' @@ -47,7 +48,7 @@ - @dashboard.current_organisation.line_referentials.all.each do |referential| .panel-heading h3.panel-title - = referential.name + = t('dashboards.line_referentials.title') .list-group = link_to Chouette::Line.model_name.human.pluralize.capitalize, line_referential_lines_path(referential), class: 'list-group-item' = link_to Chouette::Company.model_name.human.pluralize.capitalize, line_referential_companies_path(referential), class: 'list-group-item' diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim index 48a4f334c..9d0a6423d 100644 --- a/app/views/imports/show.html.slim +++ b/app/views/imports/show.html.slim @@ -6,7 +6,7 @@ .container-fluid .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 - = definition_list t('metadatas'), { 'Récupération des données' => '-', "Nom de l'archive" => @import.try(:file_identifier)} + = definition_list t('metadatas'), { t('.data_recovery') => '-', t('.filename') => @import.try(:file_identifier)} .row .col-lg-12 @@ -19,7 +19,7 @@ = table_builder_2 @import.children, [ \ TableBuilderHelper::Column.new( \ - name: 'Nom du jeu de données', \ + name: t('.referential_name'), \ attribute: 'name', \ sortable: false, \ link_to: lambda do |import| \ @@ -35,12 +35,12 @@ end \ ), \ TableBuilderHelper::Column.new( \ - name: 'Contrôle STIF', \ + name: t('.stif_control'), \ attribute: '', \ sortable: false, \ ), \ TableBuilderHelper::Column.new( \ - name: 'Contrôle organisation', \ + name: t('.organisation_control'), \ attribute: '', \ sortable: false, \ ) \ @@ -49,11 +49,11 @@ overhead: [ \ {}, \ { \ - title: "#{@import.children_succeedeed} jeu de données validé sur #{@import.children.count} présent(s) dans l'archive", \ + title: I18n.t('imports.show.results', count: @import.children_succeedeed, total: @import.children.count), \ width: 1, \ cls: "#{@import.import_status_css_class} full-border" \ }, { \ - title: 'Bilan des jeux de contrôles d\'import <span title="Lorem ipsum..." class="fa fa-lg fa-info-circle text-info"></span>', \ + title: I18n.t('imports.show.summary').html_safe, \ width: 2, \ cls: 'overheaded-default colspan="2"' \ } \ diff --git a/app/views/layouts/navigation/_nav_panel_operations.html.slim b/app/views/layouts/navigation/_nav_panel_operations.html.slim index 8dce829cd..1c5a1f14b 100644 --- a/app/views/layouts/navigation/_nav_panel_operations.html.slim +++ b/app/views/layouts/navigation/_nav_panel_operations.html.slim @@ -1,5 +1,5 @@ #operations_panel.nav_panel .panel-title - h2 Opérations + h2 = t('layouts.operations') .panel-body p = "Lorem ipsum dolor sit amet..." diff --git a/app/views/layouts/navigation/_nav_panel_profile.html.slim b/app/views/layouts/navigation/_nav_panel_profile.html.slim index bcbf89e67..b0dee5d53 100644 --- a/app/views/layouts/navigation/_nav_panel_profile.html.slim +++ b/app/views/layouts/navigation/_nav_panel_profile.html.slim @@ -1,6 +1,6 @@ #profile_panel.nav_panel .panel-title - h2 Mon Profil + h2 = t('layouts.user.profile') .panel-body p = current_user.name p = current_organisation.name diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim index ef32ef6b0..91868a002 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -7,16 +7,16 @@ .col-lg-6.col-md-6.col-sm-12.col-xs-12 = definition_list t('metadatas'), { t('id_codif') => @line.get_objectid.short_id, - 'Activé' => (@line.deactivated? ? t('false') : t('true')), - @line.human_attribute_name(:network) => (@line.network.nil? ? t('lines.index.unset') : link_to(@line.network.name, [@referential, @line.network]) ), - @line.human_attribute_name(:company) => (@line.company.nil? ? t('lines.index.unset') : link_to(@line.company.name, [@referential, @line.company]) ), - 'Transporteur(s) secondaire(s)' => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')), - 'Nom court' => @line.number, - 'Code public' => (@line.registration_number ? @line.registration_number : '-'), - @line.human_attribute_name(:transport_mode) => (@line.transport_mode.present? ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'), - @line.human_attribute_name(:transport_submode) => (@line.transport_submode.present? ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'), - @line.human_attribute_name(:url) => (@line.url ? @line.url : '-'), - @line.human_attribute_name(:seasonal) => (@line.seasonal? ? t('true') : t('false')),} + Chouette::Line.tmf('activated') => (@line.deactivated? ? t('false') : t('true')), + Chouette::Line.tmf('network_id') => (@line.network.nil? ? t('lines.index.unset') : link_to(@line.network.name, [@referential, @line.network]) ), + Chouette::Line.tmf('company') => (@line.company.nil? ? t('lines.index.unset') : link_to(@line.company.name, [@referential, @line.company]) ), + Chouette::Line.tmf('secondary_company') => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')), + Chouette::Line.tmf('registration_number') => @line.number, + Chouette::Line.tmf('published_name') => (@line.registration_number ? @line.registration_number : '-'), + Chouette::Line.tmf('transport_mode') => (@line.transport_mode.present? ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'), + Chouette::Line.tmf('transport_submode') => (@line.transport_submode.present? ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'), + Chouette::Line.tmf('url') => (@line.url ? @line.url : '-'), + Chouette::Line.tmf('seasonal') => (@line.seasonal? ? t('true') : t('false')),} .col-lg-6.col-md-6.col-sm-12.col-xs-12 #routes_map.map.mb-lg .row @@ -53,12 +53,12 @@ attribute: 'wayback_text' \ ), \ TableBuilderHelper::Column.new( \ - name: 'Arrêt de départ', \ + name: Chouette::Route.tmf('stop_area_departure'), \ attribute: Proc.new { |r| r.try(:stop_points).first.try(:stop_area).try(:name) }, \ sortable: false \ ), \ TableBuilderHelper::Column.new( \ - name: "Arrêt d'arrivée", \ + name: Chouette::Route.tmf('stop_area_arrival'), \ attribute: Proc.new{ |r| r.try(:stop_points).last.try(:stop_area).try(:name) }, \ sortable: false \ ), \ @@ -79,7 +79,7 @@ - unless @routes.any? .row.mt-xs .col-lg-12 - = replacement_msg t('routes.search_no_results') + = replacement_msg t('routes.filters.no_results') = javascript_tag do | window.routes = "#{URI.escape(@routes.select{|r| r.wayback == :outbound}.map{|r| {name: r.name, id: r.id, stops: route_json_for_edit(r, serialize: false)}}.to_json)}" diff --git a/app/views/referentials/_overview.html.slim b/app/views/referentials/_overview.html.slim index 6bed5f282..b3258ffd1 100644 --- a/app/views/referentials/_overview.html.slim +++ b/app/views/referentials/_overview.html.slim @@ -16,8 +16,8 @@ = f.input :transport_mode_eq_any, collection: overview.referential_lines.map(&:transport_mode).compact.uniq.sort, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} .actions - = link_to 'Effacer', url_for() + "##{overview.pagination_param_name}", class: 'btn btn-link' - = f.submit 'Filtrer', class: 'btn btn-default' + = link_to t('actions.erase'), url_for() + "##{overview.pagination_param_name}", class: 'btn btn-link' + = f.submit t('actions.filter'), class: 'btn btn-default' .time-travel .btn-group diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index 375d7c57b..d2e750fb0 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -59,7 +59,7 @@ action: :index - else - = replacement_msg t('stop_areas.search_no_results') + = replacement_msg t('stop_areas.filters.search_no_results') = javascript_tag do | window.route = "#{URI.escape(route_json_for_edit(@route))}" diff --git a/app/views/routing_constraint_zones/_filters.html.slim b/app/views/routing_constraint_zones/_filters.html.slim index 74e299a8b..561359943 100644 --- a/app/views/routing_constraint_zones/_filters.html.slim +++ b/app/views/routing_constraint_zones/_filters.html.slim @@ -1,16 +1,16 @@ = search_form_for @q, url: referential_line_routing_constraint_zones_path(@referential, @line), class: 'form form-filter' do |f| .ffg-row .input-group.search_bar class=filter_item_class(params[:q], :name_or_objectid_cont) - = f.search_field :name_or_objectid_cont, class: 'form-control', placeholder: "Indiquez un nom d'ITL ou un ID..." + = f.search_field :name_or_objectid_cont, class: 'form-control', placeholder: t('.name_or_objectid_cont') span.input-group-btn button.btn.btn-default#search-btn type='submit' span.fa.fa-search .ffg-row .form-group class=filter_item_class(params[:q], :route_id_eq) - = f.label 'Itinéraire associé', required: false, class: 'control-label' - = f.input :route_id_eq, as: :select, collection: @line.routing_constraint_zones.pluck(:route_id).uniq, label: false, label_method: lambda { |r| @line.routing_constraint_zones.find_by(route_id: r).route_name }, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez un itinéraire...' }, wrapper_html: { class: 'select2ed'} + = f.label t('.associated_route.title'), required: false, class: 'control-label' + = f.input :route_id_eq, as: :select, collection: @line.routing_constraint_zones.pluck(:route_id).uniq, label: false, label_method: lambda { |r| @line.routing_constraint_zones.find_by(route_id: r).route_name }, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('.associated_route.placeholder') }, wrapper_html: { class: 'select2ed'} .actions - = link_to 'Effacer', referential_line_routing_constraint_zones_path(@referential, @line), class: 'btn btn-link' - = f.submit 'Filtrer', class: 'btn btn-default' + = link_to t('actions.erase'), referential_line_routing_constraint_zones_path(@referential, @line), class: 'btn btn-link' + = f.submit t('actions.filter'), class: 'btn btn-default' diff --git a/app/views/routing_constraint_zones/index.html.slim b/app/views/routing_constraint_zones/index.html.slim index 2f67b467e..7e9fb12a3 100644 --- a/app/views/routing_constraint_zones/index.html.slim +++ b/app/views/routing_constraint_zones/index.html.slim @@ -13,7 +13,7 @@ = table_builder_2 @routing_constraint_zones, [ \ TableBuilderHelper::Column.new( \ - name: 'ID', \ + name: t('objectid'), \ attribute: Proc.new { |n| n.get_objectid.local_id }, \ sortable: false \ ), \ @@ -43,4 +43,4 @@ - unless @routing_constraint_zones.any? .row.mt-xs .col-lg-12 - = replacement_msg t('routing_constraint_zones.search_no_results') + = replacement_msg t('.search_no_results') diff --git a/app/views/stif/dashboards/_dashboard.html.slim b/app/views/stif/dashboards/_dashboard.html.slim index e0f754fd4..7538c7fc7 100644 --- a/app/views/stif/dashboards/_dashboard.html.slim +++ b/app/views/stif/dashboards/_dashboard.html.slim @@ -1,8 +1,4 @@ .row - .col-lg-12 - h2.content_header = t('.subtitle') - -.row .col-lg-6.col-md-6.col-sm-6.col-xs-12 .panel.panel-default .panel-heading diff --git a/app/views/stop_areas/autocomplete.rabl b/app/views/stop_areas/autocomplete.rabl index a5f0bd5ec..26fca36b2 100644 --- a/app/views/stop_areas/autocomplete.rabl +++ b/app/views/stop_areas/autocomplete.rabl @@ -15,7 +15,8 @@ node do |stop_area| :latitude => stop_area.latitude, :area_type => stop_area.area_type, :comment => stop_area.comment, - :text => "<span class='small label label-info'>#{I18n.t("area_types.label.#{stop_area.area_type}")}</span>#{stop_area.full_name}" + :text => "<span class='small label label-info'>#{I18n.t("area_types.label.#{stop_area.area_type}")}</span>#{stop_area.full_name}", + :kind => stop_area.kind } end diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml index 04f4aca6b..c349b709f 100644 --- a/config/locales/actions.en.yml +++ b/config/locales/actions.en.yml @@ -16,7 +16,7 @@ en: unarchive: "Unarchive" clone: 'Clone' duplicate: 'Clone' - clean_up: 'Clean up' + clean_up: 'Purge' sync: 'Synchronize' combine: 'Combine' actualize: 'Actualize' diff --git a/config/locales/calendars.en.yml b/config/locales/calendars.en.yml index b9540d124..3d16e7c05 100644 --- a/config/locales/calendars.en.yml +++ b/config/locales/calendars.en.yml @@ -1,6 +1,8 @@ en: calendars: - search_no_results: 'No calendar matching your query' + filters: + name_cont: Search by name + search_no_results: 'No calendar template matching your query' days: monday: M tuesday: Tu @@ -37,7 +39,7 @@ en: all: All shared: Shared not_shared: Not shared - search_no_results: No calendar matching your query + search_no_results: No calendar templates matching your query date: Date new: title: Add a new calendar @@ -59,8 +61,8 @@ en: activerecord: models: calendar: - one: calendar - other: calendars + one: calendar template + other: calendar templates attributes: calendar: name: Name diff --git a/config/locales/calendars.fr.yml b/config/locales/calendars.fr.yml index 6a87a889a..8c933f168 100644 --- a/config/locales/calendars.fr.yml +++ b/config/locales/calendars.fr.yml @@ -1,6 +1,8 @@ fr: calendars: - search_no_results: 'Aucun calendrier ne correspond à votre recherche' + filters: + name_cont: 'Indiquez un nom de calendrier...' + no_results: 'Aucun calendrier ne correspond à votre recherche' days: monday: L tuesday: Ma diff --git a/config/locales/clean_ups.en.yml b/config/locales/clean_ups.en.yml index 876694592..6cbb2c453 100644 --- a/config/locales/clean_ups.en.yml +++ b/config/locales/clean_ups.en.yml @@ -5,7 +5,7 @@ en: success_jp: "%{count} journey patterns deleted" failure: "Fail when clean_up : %{error_message}" actions: - clean_up: "clean up" + clean_up: "Clean up" confirm: "Clean up will destroy time tables which ended on requested date\nand next recursively all object without any time table\nPlease confirm this action" activemodel: attributes: diff --git a/config/locales/compliance_check_resource.en.yml b/config/locales/compliance_check_resource.en.yml new file mode 100644 index 000000000..f8a31b81a --- /dev/null +++ b/config/locales/compliance_check_resource.en.yml @@ -0,0 +1,8 @@ +en: + activerecord: + attributes: + compliance_check_resource: + name: Name + status: Status + metrics: Metrics + download: Download
\ No newline at end of file diff --git a/config/locales/compliance_check_resources.fr.yml b/config/locales/compliance_check_resources.fr.yml new file mode 100644 index 000000000..0fe4b83ed --- /dev/null +++ b/config/locales/compliance_check_resources.fr.yml @@ -0,0 +1,8 @@ +fr: + activerecord: + attributes: + compliance_check_resource: + name: Nom + status: Statut + metrics: Métriques + download: Téléchargement
\ No newline at end of file diff --git a/config/locales/compliance_check_sets.en.yml b/config/locales/compliance_check_sets.en.yml index 5e8c3b24f..63708328b 100644 --- a/config/locales/compliance_check_sets.en.yml +++ b/config/locales/compliance_check_sets.en.yml @@ -20,7 +20,7 @@ en: title: Executed control report %{name} show: title: Compliance check set report - table_state: "%{lines_status} lines imported on %{lines_in_compliance_check_set} in the archive" + table_state: "%{lines_status} lines imported out of %{lines_in_compliance_check_set} in the archive" table_explanation: "These controls apply to all imported data and condition the construction of your organization's offer." table_title: Analysed lines state metrics: "%{ok_count} ok, %{error_count} errors, %{warning_count} warnings, %{uncheck_count} n/a" diff --git a/config/locales/compliance_control_blocks.en.yml b/config/locales/compliance_control_blocks.en.yml index b9c01278c..275f05106 100644 --- a/config/locales/compliance_control_blocks.en.yml +++ b/config/locales/compliance_control_blocks.en.yml @@ -1,4 +1,4 @@ -fr: +en: activerecord: models: compliance_control_block: diff --git a/config/locales/compliance_control_sets.en.yml b/config/locales/compliance_control_sets.en.yml index 10c4f5e9a..c69689390 100644 --- a/config/locales/compliance_control_sets.en.yml +++ b/config/locales/compliance_control_sets.en.yml @@ -10,6 +10,12 @@ en: new_control: Creating a Control select_types: Control Type Selection edit: Edit compliance control set + new: + title: New compliance control set %{name} + show: + title: Consult compliance control set %{name} + edit: + title: Edit compliance control set %{name} actions: new: Add edit: Edit @@ -18,6 +24,7 @@ en: add_compliance_control: Compliance Control add_compliance_control_block: Compliance Control Block destroy_confirm: Are you sure ? + loaded: Load the control filters: name: 'Enter name ...' search_no_results: 'No compliance control set found' diff --git a/config/locales/compliance_controls.en.yml b/config/locales/compliance_controls.en.yml index f7d461fdb..d8dc44ecc 100644 --- a/config/locales/compliance_controls.en.yml +++ b/config/locales/compliance_controls.en.yml @@ -29,6 +29,8 @@ en: title: "Add a new compliance control" edit: title: "Update compliance control" + select_type: + title: "Select a control type" actions: new: Add edit: Edit diff --git a/config/locales/dashboard.en.yml b/config/locales/dashboard.en.yml index 8d46ff7aa..361a3cf2b 100644 --- a/config/locales/dashboard.en.yml +++ b/config/locales/dashboard.en.yml @@ -2,6 +2,8 @@ en: dashboards: show: title: "Dashboard %{organisation}" + workbench: + title: Transport offer %{organisation} calendars: title: Calendars none: No calendar created diff --git a/config/locales/dashboard.fr.yml b/config/locales/dashboard.fr.yml index d0aa36d61..1e1c095b1 100644 --- a/config/locales/dashboard.fr.yml +++ b/config/locales/dashboard.fr.yml @@ -2,6 +2,8 @@ fr: dashboards: show: title: "Tableau de bord %{organisation}" + workbench: + title: Offre de transport %{organisation} calendars: title: Modèles de calendrier none: Aucun calendrier défini diff --git a/config/locales/imports.en.yml b/config/locales/imports.en.yml index d0db87fb1..c8683a2a7 100644 --- a/config/locales/imports.en.yml +++ b/config/locales/imports.en.yml @@ -26,6 +26,13 @@ en: compliance_check: "Validation report" compliance_check_of: "Validation of import: " import_of_validation: "Import of the validation" + data_recovery: Data recovery + filename: Filename + referential_name: Referential name + stif_control: STIF Control + organisation_control: Organization control + results: "%{count} validated referential(s) out of %{total} in the file" + summary: Summay of import compliance check sets <span title="Lorem ipsum..." class="fa fa-lg fa-info-circle text-info"></span> compliance_check_task: "Validate Report" severities: info: "Information" diff --git a/config/locales/imports.fr.yml b/config/locales/imports.fr.yml index 40272889a..733254fa4 100644 --- a/config/locales/imports.fr.yml +++ b/config/locales/imports.fr.yml @@ -26,6 +26,13 @@ fr: compliance_check: "Test de conformité" compliance_check_of: "Validation de l'import : " import_of_validation: "L'import de la validation" + data_recorvery: Récupération des données + filename: Nom de l'archive + referential_name: Nom du référentiel + stif_control: Contrôle STIF + organisation_control: Contrôle organisation + results: "%{count} jeu(x) de données validé(s) sur %{total}" + summary: Bilan des jeux de contrôles d'import <span title="Lorem ipsum..." class="fa fa-lg fa-info-circle text-info"></span> compliance_check_task: "Validation" severities: info: "Information" diff --git a/config/locales/layouts.en.yml b/config/locales/layouts.en.yml index debff05e5..d5717b400 100644 --- a/config/locales/layouts.en.yml +++ b/config/locales/layouts.en.yml @@ -3,6 +3,7 @@ en: back_to_dashboard: "Back to Dashboard" help: "Help" home: "Home" + operations: Operations user: profile: "My Profile" sign_out: "Sign out" diff --git a/config/locales/layouts.fr.yml b/config/locales/layouts.fr.yml index 5e835bcf7..17d23c756 100644 --- a/config/locales/layouts.fr.yml +++ b/config/locales/layouts.fr.yml @@ -3,6 +3,7 @@ fr: back_to_dashboard: "Retour au Tableau de Bord" help: "Aide" home: "Accueil" + operations: Opérations user: profile: "Mon Profil" sign_out: "Déconnexion" diff --git a/config/locales/purchase_windows.en.yml b/config/locales/purchase_windows.en.yml index 9ce05a1b9..9ff1576cd 100644 --- a/config/locales/purchase_windows.en.yml +++ b/config/locales/purchase_windows.en.yml @@ -63,7 +63,7 @@ en: one: purchase window other: purchase windows attributes: - purchase_windows: + purchase_window: name: Name date_ranges: Date ranges referential: Referential @@ -71,7 +71,7 @@ en: bounding_dates: Bounding Dates errors: models: - purchase_windows: + purchase_window: attributes: dates: date_in_date_ranges: A date can not be in Dates and in Date ranges. diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index b7483c0aa..1381d5ddd 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -3,7 +3,7 @@ en: filters: name_or_number_or_objectid: 'Search by name, number or objectid' name: 'Search by name' - line: 'Seach by associated lines' + line: 'Search by associated lines' search_no_results: 'No data space matching your query' error_period_filter: "The period filter must have valid bounding dates" index: @@ -51,7 +51,7 @@ en: overview: head: dates: Dates - lines: Lignes + lines: Lines today: Today prev_page: Prev. page next_page: Next page @@ -64,7 +64,7 @@ en: other: "data spaces" attributes: referential: - name: "Data space name" + name: "Name" status: "Status" slug: "Code" prefix: "Neptune Object Id prefix" @@ -105,7 +105,7 @@ en: created_from: 'Created from' updated_at: "Updated" created_at: "Created" - organisation: 'Organisation' + organisation: 'Organization' number_of_lines: 'No. of lines' formtastic: titles: diff --git a/config/locales/routes.en.yml b/config/locales/routes.en.yml index bd8358bdd..58869b895 100644 --- a/config/locales/routes.en.yml +++ b/config/locales/routes.en.yml @@ -1,6 +1,8 @@ en: routes: - search_no_results: "No route matching your query" + filters: + placeholder: Search by name or ID + no_results: "No route matching your query" actions: new: "Add a new route" edit: "Edit this route" @@ -55,7 +57,7 @@ en: for_boarding: "Boarding" for_alighting: "Alighting" duplicate: - title: "Duplicate route" + title: "Clone route" success: "Route cloned with success" route: no_journey_pattern: "No Journey pattern" @@ -82,7 +84,7 @@ en: number: "Number" direction: "Direction" wayback: "Direction" - stop_points: "Nb Stop points" + stop_points: "Nb Stop areas" opposite_route: "Reversed route" opposite_route_id: "Reversed route" objectid: "Neptune identifier" @@ -91,6 +93,8 @@ en: updated_at: Updated at creator_id: "Created by" no_journey_pattern: "No journey pattern" + stop_area_departure: Stop area departure + stop_area_arrival: Stop area arrival formtastic: titles: route: diff --git a/config/locales/routes.fr.yml b/config/locales/routes.fr.yml index c08e64cfd..ddf706794 100644 --- a/config/locales/routes.fr.yml +++ b/config/locales/routes.fr.yml @@ -1,6 +1,8 @@ fr: routes: - search_no_results: "Aucun itinéraire ne correspond à votre recherche" + filters: + placeholder: Indiquez un nom d'itinéraire ou un ID... + no_results: "Aucun itinéraire ne correspond à votre recherche" actions: new: "Ajouter un itinéraire" edit: "Editer cet itinéraire" @@ -95,6 +97,8 @@ fr: updated_at: "Edité le" creator_id: "Créé par" no_journey_pattern: "Pas de mission" + stop_area_departure: Arrêt de départ + stop_area_arrival: Arrêt d'arrivée formtastic: titles: route: diff --git a/config/locales/routing_constraint_zones.en.yml b/config/locales/routing_constraint_zones.en.yml index 5675fd5db..2143ce1e1 100644 --- a/config/locales/routing_constraint_zones.en.yml +++ b/config/locales/routing_constraint_zones.en.yml @@ -26,7 +26,11 @@ en: stop_points_not_from_route: 'Stop point does not belong to the Route of this Routing constraint zone.' all_stop_points_selected: 'All stop points from route cannot be selected.' routing_constraint_zones: - search_no_results: "No ITL matches your query" + filters: + associated_route: + title: Associated route + placeholder: Put the name of a route... + name_or_objectid_cont: Search by name or ID... actions: destroy_confirm: Are you sure you want to delete this routing constraint zone? new: @@ -36,4 +40,5 @@ en: show: title: "Routing constraint zone %{name}" index: - title: "Interdictions of local trafficous" + title: "Routing constraint zones" + search_no_results: "No ITL matches your query" diff --git a/config/locales/routing_constraint_zones.fr.yml b/config/locales/routing_constraint_zones.fr.yml index d4b97fff2..b5e0fa7fb 100644 --- a/config/locales/routing_constraint_zones.fr.yml +++ b/config/locales/routing_constraint_zones.fr.yml @@ -26,7 +26,11 @@ fr: stop_points_not_from_route: "Arrêt sur séquence d'arrêts n'appartient pas à la Route de cette Zone de contrainte." all_stop_points_selected: "Une ITL ne peut pas couvrir tous les arrêts d'un itinéraire." routing_constraint_zones: - search_no_results: "Aucune ITL ne correspond à votre recherche" + filters: + associated_route: + title: Itinéraire associé + placeholder: Indiquez un itinéraire... + name_or_objectid_cont: Indiquez un nom d'ITL ou un ID... actions: destroy_confirm: Etes vous sûr de supprimer cette ITL ? new: @@ -37,3 +41,4 @@ fr: title: "Zone de contrainte %{name}" index: title: "Interdictions de trafic local" + search_no_results: "Aucune ITL ne correspond à votre recherche" diff --git a/config/locales/stop_areas.en.yml b/config/locales/stop_areas.en.yml index 9e70993aa..37d39b76c 100644 --- a/config/locales/stop_areas.en.yml +++ b/config/locales/stop_areas.en.yml @@ -19,11 +19,11 @@ en: localisation: "Localisation" accessibility: "Accessibility" actions: - new: "Add a new stop" - create: "Add a new stop" - edit: "Edit this stop" - update: "Edit this stop" - destroy: "Remove" + new: "Add a new stop area" + create: "Add a new stop area" + edit: "Edit stop area" + update: "Edit stop area" + destroy: "Delete stop area" activate: "Activate this stop" deactivate: "Deactivate this stop" activate_confirm: "Are you sure you want to activate this stop ?" diff --git a/config/locales/table_builders.en.yml b/config/locales/table_builders.en.yml new file mode 100644 index 000000000..9ee59a1e1 --- /dev/null +++ b/config/locales/table_builders.en.yml @@ -0,0 +1,3 @@ +en: + table_builders: + selected_elements: "selected element(s)"
\ No newline at end of file diff --git a/config/locales/table_builders.fr.yml b/config/locales/table_builders.fr.yml new file mode 100644 index 000000000..3c92640fc --- /dev/null +++ b/config/locales/table_builders.fr.yml @@ -0,0 +1,3 @@ +fr: + table_builders: + selected_elements: "élement(s) sélectionné(s)"
\ No newline at end of file diff --git a/config/locales/vehicle_journey_exports.en.yml b/config/locales/vehicle_journey_exports.en.yml index 93a782026..4e658353e 100644 --- a/config/locales/vehicle_journey_exports.en.yml +++ b/config/locales/vehicle_journey_exports.en.yml @@ -1,7 +1,7 @@ en: vehicle_journey_exports: new: - title: "Export existing vehicle journey at stops" + title: Vehicle journeys export basename: "vehicle_journeys" label: vehicle_journey_id: "vj id (empty for new vj)" diff --git a/config/locales/vehicle_journeys.en.yml b/config/locales/vehicle_journeys.en.yml index f1ba96dc5..79e805ee8 100644 --- a/config/locales/vehicle_journeys.en.yml +++ b/config/locales/vehicle_journeys.en.yml @@ -1,14 +1,29 @@ en: vehicle_journeys: vehicle_journeys_matrix: + filters: + id: Filter by ID... + timetable: Filter by journey pattern... + timetable: Filter by timetable... 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" modal_confirm: 'Do you want to save mofications before moving on to the next page ?' - pagination: "Schedules %{minVJ} to %{maxVJ} over %{total}" selected_journeys: "%{count} selected journeys" show_purchase_window: 'Show the purchase window' show_timetable: 'Show calendar' + no_associated_timetables: No associated timetables + no_associated_purchase_windows: No associated purchase windows + no_associated_footnotes: No associated footnotes + duplicate: + one: Clone %{count} vehicle journey + other: Clone %{count} vehicle journeys + start_time: Indicative start time + number: Number of vehicle journeys to create and clone + delta: Delta from which vehicle journeys are created + affect_company: Affect company + no_line_footnotes: The line doesn't have any footnotes + select_footnotes: Select footnotes to associate with the vehicle journey vehicle_journey: title_stopless: "Vehicle journey %{name}" title: "Vehicle journey leaving from %{stop} at %{time}" @@ -17,10 +32,10 @@ en: title: "Vehicle journey frequency leaving from %{stop} at %{time}" title_frequency: "Vehicle journey frequency with %{interval}min leaving from %{stop} at %{time_first} to %{time_last}" actions: - index: "Vehicle time's board" - new: "Add a new timed vehicle journey" + index: "Vehicle journeys" + new: "Add a new vehicle journey" new_frequency: "Add a new frequency vehicle journey" - edit: "Edit this timed vehicle journey" + edit: "Edit this vehicle journey" edit_frequency: "Edit this frequency vehicle journey" destroy: "Remove this vehicle journey" destroy_confirm: "Are you sure you want destroy this vehicle journey?" @@ -48,15 +63,18 @@ en: show_journeys_without_schedule: "Show journeys without schedule" slide_arrival: "arrival time at first stop" slide_departure: "departure time at first stop" - slide_title: "Shift all vehicle passing times" + slide_title: "Shift all the vehicle journey passing times : %{id}" slide: "Shift" + slide_delta: "Shift of" starting_stop: "Departure" stop_title: "Stop" submit_frequency_edit: "Edit frequency vehicle journey" submit_frequency: "Create frequency vehicle journey" submit_timed_edit: "Edit vehicle journey" submit_timed: "Create vehicle journey" - time_tables: "Associated calendars to vehicle journey" + time_tables: "Associated timetables" + purchase_windows: Associated purchase windows + footnotes: Associated footnotes to_arrivals: "Copy departures to arrivals" to_departures: "Copy arrivals to departures" to: "at" @@ -102,6 +120,7 @@ en: checksum: "Checksum" comment: "Comments" company: "Company" + company_name: "Company name" created_at: Created at creator_id: "Created by" departure_time: "Departure" @@ -110,9 +129,10 @@ en: footnote_ids: "Footnotes" id: "Journey ID" journey_frequency_ids: "Timeband" - journey_name: "Name of the journey" + journey_name: "Name of the vehicle journey" journey_pattern_id: "Pattern ID" journey_pattern: "Journey Pattern" + journey_pattern_published_name: "Journey Pattern published name" line: "Line" mobility_restricted_suitability: "PRM accessibility" name: "Journey Name" @@ -137,6 +157,7 @@ en: updated_at: Updated at vehicle_journey_at_stop_ids: "Time list" vehicle_type_identifier: "Vehicle Type Identifier" + start_time: Start time errors: models: vehicle_journey: diff --git a/config/locales/vehicle_journeys.fr.yml b/config/locales/vehicle_journeys.fr.yml index d144e580f..4336bc6dc 100644 --- a/config/locales/vehicle_journeys.fr.yml +++ b/config/locales/vehicle_journeys.fr.yml @@ -1,14 +1,29 @@ fr: vehicle_journeys: vehicle_journeys_matrix: + filters: + id: Filtrer par ID course... + journey_pattern: 'Filtrer par code, nom ou OID de mission...' + timetable: Filter by timetable... 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" modal_confirm: 'Voulez-vous valider vos modifications avant de changer de page?' - pagination: "Liste des horaires %{minVJ} à %{maxVJ} sur %{total}" selected_journeys: "%{count} course(s) sélectionnée(s)" show_purchase_window: 'Voir le calendrier commercial' show_timetable: 'Voir le calendrier' + no_associated_timetables: Aucun calendrier associé + no_associated_purchase_windows: Aucun calendrier commercial associé + no_associated_footnotes: Aucune note associée + duplicate: + one: Dupliquer %{count} course + other: Dupliquer %{count} courses + start_time: Horaire de départ indicatif + number: Nombre de courses à créer et dupliquer + delta: Décalage à partir duquel on créé les courses + affect_company: Indiquez un nom de transporteur... + no_line_footnotes: La ligne ne possède pas de notes + select_footnotes: Sélectionnez les notes à associer à cette course vehicle_journey: title_stopless: "Course %{name}" title: "Course partant de %{stop} à %{time}" @@ -48,8 +63,9 @@ fr: show_journeys_without_schedule: "Afficher les courses sans horaires" slide_arrival: "horaire d'arrivée au 1° arrêt à" slide_departure: "horaire de départ au 1° arrêt à" - slide_title: "Décaler l'ensemble des horaires de course" + slide_title: "Décaler l'ensemble des horaires de la course : %{id}" slide: "Décaler" + slide_delta: "Avec un décalage de" starting_stop: "Origine" stop_title: "Arrêt" submit_frequency_edit: "Editer course en fréquence" @@ -57,6 +73,8 @@ fr: submit_timed_edit: "Editer course" submit_timed: "Créer course" time_tables: "Calendriers associés à la course" + purchase_windows: "Calendriers commerciaux associés à la course" + footnotes: "Notes associés à la course" to_arrivals: "Copie départs vers arrivées" to_arrivals: "Copie départs vers arrivées" to_departures: "Copie arrivées vers départs" @@ -103,6 +121,7 @@ fr: checksum: "Signature métier" comment: "Commentaires" company: "Transporteur" + company|_name: "Nom du transporteur" created_at: "Créé le" creator_id: "Créé par" departure_time: "Départ" @@ -114,6 +133,7 @@ fr: journey_name: "Nom de la course" journey_pattern_id: "ID Mission" journey_pattern: "Mission" + journey_pattern_published_name: "Nom public de la mission" line: "Ligne" mobility_restricted_suitability: "Accessibilité PMR" name: "Nom Course" @@ -129,7 +149,7 @@ fr: route: "Itinéraire" time_slot: "Fréquence" time_table_ids: "Liste des calendriers" - time_tables: "Calendriers" + time_tables: "Calendriers associés" train_number: "Numéro de train" transport_mode: "Mode de transport" transport_submode: "Sous-mode de transport" @@ -138,6 +158,7 @@ fr: updated_at: "Edité le" vehicle_journey_at_stop_ids: "Liste des horaires" vehicle_type_identifier: "Type d'identifiant du véhicule" + start_time: Heure de départ errors: models: vehicle_journey: diff --git a/config/locales/workbenches.en.yml b/config/locales/workbenches.en.yml index b11f35049..876f18766 100644 --- a/config/locales/workbenches.en.yml +++ b/config/locales/workbenches.en.yml @@ -1,7 +1,7 @@ en: workbenches: show: - title: "%{name}" + title: "Transport offer %{name}" edit: title: "Configure the workbench" update: @@ -21,7 +21,7 @@ en: see: "See the list" no_content: "No content yet." actions: - show_output: "Merge offer" + show_output: "Merge Transport Offer" affect_ccset: "Configure" activerecord: models: diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml index d7e3327ac..f857bfcd1 100644 --- a/config/locales/workbenches.fr.yml +++ b/config/locales/workbenches.fr.yml @@ -1,7 +1,7 @@ fr: workbenches: show: - title: "%{name}" + title: "Offre de transport %{name}" edit: title: "Configurer l'espace de travail" update: diff --git a/spec/models/calendar_observer_spec.rb b/spec/models/calendar_observer_spec.rb index 4fba02bef..dd7034af4 100644 --- a/spec/models/calendar_observer_spec.rb +++ b/spec/models/calendar_observer_spec.rb @@ -1,8 +1,13 @@ require 'rails_helper' RSpec.describe CalendarObserver, type: :observer do - let(:calendar) { create(:calendar, shared: true) } - let(:user) { create(:user, organisation: create(:organisation)) } + let(:workgroup_1) { create :workgroup } + let(:workgroup_2) { create :workgroup } + + let(:calendar) { create(:calendar, shared: true, workgroup_id: workgroup_1.id) } + + let(:user_1) { create(:user, organisation: create(:organisation, workbenches: [create(:workbench, workgroup_id: workgroup_1.id)] )) } + let(:user_2) { create(:user, organisation: create(:organisation, workbenches: [create(:workbench, workgroup_id: workgroup_2.id)] )) } context 'after_update' do it 'should observe calendar updates' do @@ -12,14 +17,21 @@ RSpec.describe CalendarObserver, type: :observer do it 'should schedule mailer on calendar update' do calendar.name = 'edited_name' - expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user.id] + expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user_1.id] calendar.save end it 'should not schedule mailer for none shared calendar on update' do calendar = create(:calendar, shared: false) calendar.name = 'edited_name' - expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user.id] + expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user_1.id] + calendar.save + end + + it "should only send mail to user from the same workgroup" do + calendar.name = 'edited_name' + expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user_1.id] + expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user_2.id] calendar.save end end @@ -31,13 +43,13 @@ RSpec.describe CalendarObserver, type: :observer do end it 'should schedule mailer on calendar create' do - expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'created', [anything, user.id] - build(:calendar, shared: true).save + expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'created', [anything, user_1.id] + build(:calendar, shared: true, workgroup_id: workgroup_1.id).save end it 'should not schedule mailer for none shared calendar on create' do - expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'created', [anything, user.id] - build(:calendar, shared: false).save + expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'created', [anything, user_1.id] + build(:calendar, shared: false, workgroup_id: workgroup_1.id).save end end end diff --git a/spec/models/chouette/route/route_stop_points_spec.rb b/spec/models/chouette/route/route_stop_points_spec.rb index 03c53b4cf..af26f017a 100644 --- a/spec/models/chouette/route/route_stop_points_spec.rb +++ b/spec/models/chouette/route/route_stop_points_spec.rb @@ -78,15 +78,16 @@ RSpec.describe Chouette::Route, :type => :model do end describe "#stop_points" do + let(:first_stop_point) { subject.stop_points.first} context "#find_by_stop_area" do context "when arg is first quay id" do - let(:first_stop_point) { subject.stop_points.first} it "should return first quay" do expect(subject.stop_points.find_by_stop_area( first_stop_point.stop_area_id)).to eq( first_stop_point) end end end end + describe "#stop_areas" do let(:line){ create(:line)} let(:route_1){ create(:route, :line => line)} diff --git a/spec/support/shared_examples/compliance_control_validation.rb b/spec/support/shared_examples/compliance_control_validation.rb index b23c2984f..3a8232193 100644 --- a/spec/support/shared_examples/compliance_control_validation.rb +++ b/spec/support/shared_examples/compliance_control_validation.rb @@ -12,7 +12,25 @@ RSpec.shared_examples_for 'has min_max_values' do end end + context "is valid" do + it 'if minimum is well formatted' do + subject.minimum = "12" + expect_it.to be_valid + subject.minimum = "12.0" + expect_it.to be_valid + subject.minimum = "12.01" + expect_it.to be_valid + end + end + context "is invalid" do + it 'if minimum is not well formatted' do + subject.minimum = "AA" + expect_it.not_to be_valid + subject.minimum = "12." + expect_it.not_to be_valid + end + it 'if no value is provided' do subject.minimum = nil subject.maximum = nil |
