diff options
Diffstat (limited to 'app')
28 files changed, 212 insertions, 68 deletions
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js b/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js index 54d62f999..0ed961f44 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js @@ -84,6 +84,10 @@ const actions = { resetValidation: (target) => { $(target).parent().removeClass('has-error').children('.help-block').remove() }, + humanOID : (oid) => { + var a = oid.split(':') + return a[a.length - 1] + }, validateFields : (fields) => { const test = [] diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js index d9f6d5550..14ddf2b99 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js @@ -14,7 +14,7 @@ class JourneyPattern extends Component{ let vjURL = routeURL + '/vehicle_journeys?jp=' + jpOid return ( - <a data-no-turbolink="true" href={vjURL}>Horaires des courses</a> + <a data-turbolinks="false" href={vjURL}>Horaires des courses</a> ) } @@ -62,7 +62,7 @@ class JourneyPattern extends Component{ )} <div className='th'> - <div className='strong mb-xs'>{this.props.value.object_id ? this.props.value.object_id : '-'}</div> + <div className='strong mb-xs'>{this.props.value.object_id ? actions.humanOID(this.props.value.object_id) : '-'}</div> <div>{this.props.value.registration_number}</div> <div>{actions.getChecked(this.props.value.stop_points).length} arrêt(s)</div> diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js index cef9bc75d..3f15b7f01 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js @@ -45,7 +45,7 @@ const actions = { pagination, nextPage : true }), - changePage : (dispatch, pagination, val) => ({ + changePage : (dispatch, val) => ({ type: 'CHANGE_PAGE', dispatch, page: val @@ -104,16 +104,14 @@ const actions = { timeTablePeriods, metas }), - includeDateInPeriod: (index, day, dayTypes) => ({ + includeDateInPeriod: (index, dayTypes) => ({ type: 'INCLUDE_DATE_IN_PERIOD', index, - day, dayTypes }), - excludeDateFromPeriod: (index, day, dayTypes) => ({ + excludeDateFromPeriod: (index, dayTypes) => ({ type: 'EXCLUDE_DATE_FROM_PERIOD', index, - day, dayTypes }), openConfirmModal : (callback) => ({ @@ -140,6 +138,10 @@ const actions = { return (D + ' ' + M + ' ' + Y) }, + getLocaleDate(strDate) { + let date = new Date(strDate) + return date.toLocaleDateString() + }, updateSynthesis: (state, daytypes) => { let periods = state.time_table_periods diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js b/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js index 13615a6ef..e90099283 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js @@ -21,7 +21,7 @@ class ExceptionsInDay extends Component { data-actiontype='remove' onClick={(e) => { $(e.currentTarget).toggleClass('active') - this.props.onExcludeDateFromPeriod(this.props.index, this.props.value.current_month[this.props.index], this.props.metas.day_types) + this.props.onExcludeDateFromPeriod(this.props.index, this.props.metas.day_types) }} > <span className='fa fa-times'></span> @@ -37,7 +37,7 @@ class ExceptionsInDay extends Component { data-actiontype='add' onClick={(e) => { $(e.currentTarget).toggleClass('active') - this.props.onIncludeDateInPeriod(this.props.index, this.props.value.current_month[this.props.index], this.props.metas.day_types) + this.props.onIncludeDateInPeriod(this.props.index, this.props.metas.day_types) }} > <span className='fa fa-plus'></span> diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js b/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js index c43cd025a..74ca36ea6 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js @@ -39,7 +39,7 @@ let Navigate = ({ dispatch, metas, timetable, pagination, status, filters}) => { value={month} onClick={e => { e.preventDefault() - dispatch(actions.checkConfirmModal(e, actions.changePage(dispatch, pagination, e.currentTarget.value), pagination.stateChanged, dispatch)) + dispatch(actions.checkConfirmModal(e, actions.changePage(dispatch, e.currentTarget.value), pagination.stateChanged, dispatch)) }} > {actions.monthName(month) + ' ' + new Date(month).getFullYear()} diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js index de3f31ee0..cf4cbfb32 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js @@ -8,14 +8,33 @@ class PeriodManager extends Component { super(props) } + toEndPeriod(curr, end) { + let diff + + let startCurrM = curr.split('-')[1] + let endPeriodM = end.split('-')[1] + + let lastDayInM = new Date(curr.split('-')[2], startCurrM + 1, 0) + lastDayInM = lastDayInM.toJSON().substr(0, 10).split('-')[2] + + if(startCurrM === endPeriodM) { + diff = (end.split('-')[2] - curr.split('-')[2]) + } else { + diff = (lastDayInM - curr.split('-')[2]) + } + + return diff + } + render() { return ( <div className='period_manager' id={this.props.value.id} + data-toendperiod={this.toEndPeriod(this.props.currentDate.toJSON().substr(0, 10), this.props.value.period_end)} > <p className='strong'> - {actions.getHumanDate(this.props.value.period_start, 3).substr(0, 7) + ' > ' + actions.getHumanDate(this.props.value.period_end, 3)} + {actions.getLocaleDate(this.props.value.period_start) + ' > ' + actions.getLocaleDate(this.props.value.period_end)} </p> <div className='dropdown'> @@ -58,6 +77,7 @@ class PeriodManager extends Component { PeriodManager.propTypes = { value: PropTypes.object.isRequired, + currentDate: PropTypes.object.isRequired, onDeletePeriod: PropTypes.func.isRequired, onOpenEditPeriodForm: PropTypes.func.isRequired } diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js index 93a8fe433..ca44d3a07 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js @@ -50,9 +50,10 @@ class PeriodsInDay extends Component { key={i} index={i} value={p} + metas={this.props.metas} + currentDate={this.props.currentDate} onDeletePeriod={this.props.onDeletePeriod} onOpenEditPeriodForm={this.props.onOpenEditPeriodForm} - metas={this.props.metas} /> ) } else { diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js index 2a17d3dea..c6b5fcc6b 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js @@ -15,11 +15,11 @@ const mapDispatchToProps = (dispatch) => { onDeletePeriod: (index, dayTypes) =>{ dispatch(actions.deletePeriod(index, dayTypes)) }, - onExcludeDateFromPeriod: (index, day, dayTypes) => { - dispatch(actions.excludeDateFromPeriod(index, day, dayTypes)) + onExcludeDateFromPeriod: (index, dayTypes) => { + dispatch(actions.excludeDateFromPeriod(index, dayTypes)) }, - onIncludeDateInPeriod: (index, day, dayTypes) => { - dispatch(actions.includeDateInPeriod(index, day, dayTypes)) + onIncludeDateInPeriod: (index, dayTypes) => { + dispatch(actions.includeDateInPeriod(index, dayTypes)) }, onOpenEditPeriodForm: (period, index) => { dispatch(actions.openEditPeriodForm(period, index)) diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js index ea03694bd..0e6f5ed12 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js @@ -248,6 +248,10 @@ const actions = { type: 'RECEIVE_TOTAL_COUNT', total }), + humanOID : (oid) => { + var a = oid.split(':') + return a[a.length - 1] + }, fetchVehicleJourneys : (dispatch, currentPage, nextPage, queryString) => { if(currentPage == undefined){ currentPage = 1 diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js index d795d76e3..6f338f747 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js @@ -1,6 +1,7 @@ var React = require('react') var Component = require('react').Component var PropTypes = require('react').PropTypes +var actions = require('../actions') class VehicleJourney extends Component { constructor(props) { @@ -48,8 +49,8 @@ class VehicleJourney extends Component { return ( <div className={'t2e-item' + (this.props.value.deletable ? ' disabled' : '') + (this.props.value.errors ? ' has-error': '')}> <div className='th'> - <div className='strong mb-xs'>{this.props.value.objectid ? this.props.value.objectid : '-'}</div> - <div>{this.props.value.journey_pattern.objectid}</div> + <div className='strong mb-xs'>{this.props.value.objectid ? actions.humanOID(this.props.value.objectid) : '-'}</div> + <div>{actions.humanOID(this.props.value.journey_pattern.objectid)}</div> {this.props.value.time_tables.map((tt, i)=> <div key={i}>{this.timeTableURL(tt)}</div> )} diff --git a/app/assets/stylesheets/modules/_jp_collection.sass b/app/assets/stylesheets/modules/_jp_collection.sass index d1f864e5c..c109fc71a 100644 --- a/app/assets/stylesheets/modules/_jp_collection.sass +++ b/app/assets/stylesheets/modules/_jp_collection.sass @@ -82,3 +82,19 @@ .t2e-head > .td:last-child > div > span &:after bottom: 50% + + .t2e-head > .td:nth-child(2) > div, + .t2e-head > .td:last-child > div + > span:before + content: '•' + color: $blue + text-align: center + font-size: 28px + letter-spacing: 0 + text-indent: -0.01em + line-height: 12px + width: 15px + height: 15px + left: -23px + top: 50% + margin-top: -8px diff --git a/app/assets/stylesheets/modules/_routes_stopoints.sass b/app/assets/stylesheets/modules/_routes_stopoints.sass index 735e91df7..88e662849 100644 --- a/app/assets/stylesheets/modules/_routes_stopoints.sass +++ b/app/assets/stylesheets/modules/_routes_stopoints.sass @@ -12,7 +12,7 @@ height: 100% > div:first-child position: relative - padding-left: 20px /* intial value is 10 */ + padding-left: 25px /* intial value is 10 */ overflow: hidden span @@ -70,3 +70,19 @@ .nested-head + .nested-fields > .wrapper > div:first-child span:after top: 5px + + .nested-head + .nested-fields > .wrapper > div:first-child, + .nested-fields:last-child > .wrapper:last-child > div:first-child + span:before + content: '•' + color: $blue + text-align: center + font-size: 28px + letter-spacing: 0 + text-indent: -0.01em + line-height: 12px + width: 15px + height: 15px + left: -23px + top: 50% + margin-top: -8px diff --git a/app/assets/stylesheets/modules/_timetables.sass b/app/assets/stylesheets/modules/_timetables.sass index 03dba3e23..84f1af043 100644 --- a/app/assets/stylesheets/modules/_timetables.sass +++ b/app/assets/stylesheets/modules/_timetables.sass @@ -125,21 +125,35 @@ display: block height: auto word-wrap: normal - white-space: nowrap + white-space: normal position: absolute - left: 8px + left: 0 top: 50% transform: translateY(-50%) z-index: 5 + padding: 0 8px + + @for $i from 0 through 31 + &[data-toendperiod='#{$i}'] + width: 40px * ($i + 1) > * display: inline-block vertical-align: middle margin: 0 + max-width: calc(100% - 30px) &.dropdown margin-left: 5px + &[data-toendperiod='0'], &[data-toendperiod='1'], &[data-toendperiod='2'] + max-width: none + > * + display: none + + &.dropdown + display: inline-block + .btn.dropdown-toggle color: $blue background-color: rgba(#fff, 0) diff --git a/app/assets/stylesheets/modules/_vj_collection.sass b/app/assets/stylesheets/modules/_vj_collection.sass index 50ad1cd54..8ff983310 100644 --- a/app/assets/stylesheets/modules/_vj_collection.sass +++ b/app/assets/stylesheets/modules/_vj_collection.sass @@ -79,6 +79,27 @@ &:after bottom: -6px + .t2e-head > .td:last-child > div > span + &:after + bottom: 50% + + .table-2entries .t2e-head > .td:nth-child(2) > div, + .table-2entries .t2e-head > .td:last-child > div, + .table-2entries.no_result .t2e-head > .td:last-child > div + > span:before + content: '•' + color: $blue + text-align: center + font-size: 28px + letter-spacing: 0 + text-indent: -0.01em + line-height: 12px + width: 15px + height: 15px + left: -23px + top: 50% + margin-top: -8px + // Errors .table-2entries .t2e-item-list .t2e-item @@ -92,7 +113,6 @@ left: 0 right: 0 bottom: 0 - z-index: 5 border: 2px solid $red > .th diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f2c9b4c6f..42b7c2a25 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,7 +12,10 @@ class ApplicationController < ActionController::Base helper LanguageEngine::Engine.helpers def set_locale - I18n.locale = session[:language] || I18n.default_locale + # I18n.locale = session[:language] || I18n.default_locale + # For testing different locales w/o restarting the server + I18n.locale = (params['lang'] || session[:language] || I18n.default_locale).to_sym + logger.info "locale set to #{I18n.locale.inspect}" end def pundit_user diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index d18e165d2..5370d9cbb 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -45,14 +45,13 @@ class CalendarsController < BreadcrumbController end def ransack_contains_date - # 3 parts to date object, in order to use in ransackable_scopes + date =[] if params[:q] && !params[:q]['contains_date(1i)'].empty? - date =[] ['contains_date(1i)', 'contains_date(2i)', 'contains_date(3i)'].each do |key| - date << params[:q][key] + date << params[:q][key].to_i params[:q].delete(key) end - params[:q]['contains_date'] = Date.parse(date.join('-')) + params[:q]['contains_date'] = Date.new(*date) end end diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index a1aadf883..73febc4b9 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -46,12 +46,6 @@ class RoutesController < ChouetteController end end - # overwrite inherited resources to use delete instead of destroy - # foreign keys will propagate deletion) - def destroy_resource(object) - object.delete - end - def destroy destroy! do |success, failure| success.html { redirect_to referential_line_path(@referential,@line) } diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index c084b592a..316652ca2 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -77,14 +77,14 @@ class VehicleJourneysController < ChouetteController protected def collection - scope = route.vehicle_journeys.joins(:journey_pattern).joins('LEFT JOIN "vehicle_journey_at_stops" ON "vehicle_journey_at_stops"."vehicle_journey_id" = "vehicle_journeys"."id"') + scope = route.vehicle_journeys.with_stops @q = scope.search filtered_ransack_params grouping = ransack_periode_filter @q.build_grouping(grouping) if grouping @ppage = 20 - @vehicle_journeys = @q.result(distinct: true).paginate(:page => params[:page], :per_page => @ppage) + @vehicle_journeys = @q.result.paginate(:page => params[:page], :per_page => @ppage) @footnotes = route.line.footnotes.to_json @matrix = resource_class.matrix(@vehicle_journeys) @vehicle_journeys diff --git a/app/models/calendar.rb b/app/models/calendar.rb index cd945a67f..91a17e853 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -118,9 +118,18 @@ class Calendar < ActiveRecord::Base end end + def flatten_date_array attributes, key + date_int = %w(1 2 3).map {|e| attributes["#{key}(#{e}i)"].to_i } + Date.new(*date_int) + end + def periods_attributes=(attributes = {}) @periods = [] attributes.each do |index, period_attribute| + # Convert date_select to date + ['begin', 'end'].map do |attr| + period_attribute[attr] = flatten_date_array(period_attribute, attr) + end period = Period.new(period_attribute.merge(id: index)) @periods << period unless period.marked_for_destruction? end @@ -223,6 +232,7 @@ class Calendar < ActiveRecord::Base def date_values_attributes=(attributes = {}) @date_values = [] attributes.each do |index, date_value_attribute| + date_value_attribute['value'] = flatten_date_array(date_value_attribute, 'value') date_value = DateValue.new(date_value_attribute.merge(id: index)) @date_values << date_value unless date_value.marked_for_destruction? end diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index 429189ff5..9f6344055 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -105,7 +105,7 @@ class Chouette::Route < Chouette::TridentActiveRecord end def time_tables - self.vehicle_journeys.joins(:time_tables).map(&:"time_tables").flatten.uniq + vehicle_journeys.joins(:time_tables).map(&:"time_tables").flatten.uniq end def sorted_vehicle_journeys(journey_category_model) diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb index 798fa81b4..37f609163 100644 --- a/app/models/chouette/time_table.rb +++ b/app/models/chouette/time_table.rb @@ -33,6 +33,31 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord validates_associated :dates validates_associated :periods + def continuous_dates + chunk = {} + group = nil + self.dates.where(in_out: true).each_with_index do |date, index| + group ||= index + group = (date.date == dates[index - 1].date + 1.day) ? group : group + 1 + chunk[group] ||= [] + chunk[group] << date + end + chunk.values + end + + def convert_continuous_dates_to_periods + chunks = self.continuous_dates + # Remove less than 3 continuous day chunk + chunks.delete_if {|chunk| chunk.count < 3} + + transaction do + chunks.each do |chunk| + self.periods.create!(period_start: chunk.first.date, period_end: chunk.last.date) + chunk.map(&:destroy) + end + end + end + def state_update state update_attributes(self.class.state_permited_attributes(state)) self.tag_list = state['tags'].collect{|t| t['name']}.join(', ') diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb index 4d7d596d8..297e462f0 100644 --- a/app/models/chouette/vehicle_journey.rb +++ b/app/models/chouette/vehicle_journey.rb @@ -209,5 +209,18 @@ module Chouette end end + def self.with_stops + self + .joins(:journey_pattern) + .joins(' + LEFT JOIN "vehicle_journey_at_stops" + ON "vehicle_journey_at_stops"."vehicle_journey_id" = + "vehicle_journeys"."id" + AND "vehicle_journey_at_stops"."stop_point_id" = + "journey_patterns"."departure_stop_point_id" + ') + .order("vehicle_journey_at_stops.departure_time") + end + end end diff --git a/app/models/route_observer.rb b/app/models/route_observer.rb index 71578c6da..1848bbc85 100644 --- a/app/models/route_observer.rb +++ b/app/models/route_observer.rb @@ -14,8 +14,8 @@ class RouteObserver < ActiveRecord::Observer end end - def after_destroy(route) + def before_destroy(route) Rails.logger.debug "after_destroy(#{route.inspect})" - line.routes.where(opposite_route: route).update_all(opposite_route: nil) + route.line.routes.where(opposite_route: route).update_all(opposite_route_id: nil) end end diff --git a/app/models/time_table_combination.rb b/app/models/time_table_combination.rb index 783ef53ef..519c02f2b 100644 --- a/app/models/time_table_combination.rb +++ b/app/models/time_table_combination.rb @@ -1,33 +1,33 @@ class TimeTableCombination - include ActiveModel::Validations - include ActiveModel::Conversion + include ActiveModel::Validations + include ActiveModel::Conversion extend ActiveModel::Naming - - attr_accessor :source_id, :combined_id, :operation - - validates_presence_of :source_id, :combined_id, :operation + + attr_accessor :source_id, :combined_id, :operation + + validates_presence_of :source_id, :combined_id, :operation validates_inclusion_of :operation, :in => %w( union intersection disjunction), :allow_nil => true - + def clean self.source_id = nil self.combined_id = nil self.operation = nil self.errors.clear - end - + end + def self.operations %w( union intersection disjunction) end - def initialize(attributes = {}) - attributes.each do |name, value| - send("#{name}=", value) - end - end - - def persisted? - false - end + def initialize(attributes = {}) + attributes.each do |name, value| + send("#{name}=", value) + end + end + + def persisted? + false + end def combine source = Chouette::TimeTable.find( source_id) @@ -38,10 +38,10 @@ class TimeTableCombination source.intersect! combined elsif operation == "disjunction" source.disjoin! combined - else + else raise "unknown operation" end source end - + end diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim index 5c0df1a71..95c2c02b0 100644 --- a/app/views/line_referentials/show.html.slim +++ b/app/views/line_referentials/show.html.slim @@ -27,9 +27,9 @@ table.table thead tr - th Synchronisé - th Statut - th Message + th = t('.synchronized') + th = t('.status') + th = t('.message') tbody - @line_referential.line_referential_syncs.each_with_index do |sync, i| @@ -39,8 +39,9 @@ - sync.line_referential_sync_messages.last.tap do |log| - if log.criticity = log.criticity tr - td = l(log.created_at, format: :short) - td + td style='width: 150px' + = l(log.created_at, format: :short_with_time) + td.text-center .fa.fa-circle class="text-#{criticity_class(log.criticity)}" td - data = log.message_attributs.symbolize_keys! diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 45fffe6a1..befa851ab 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -50,8 +50,8 @@ { 'ID Codif' => Proc.new { |n| n.objectid.local_id }, :number => 'number', :name => 'name', - :deactivated => Proc.new{|n| n.deactivated? ? t('false') : t('true')}, - :transport_mode => 'transport_mode', + :deactivated => Proc.new{ |n| n.deactivated? ? t('false') : t('true') }, + :transport_mode => Proc.new{ |n| n.transport_mode ? t("enumerize.line.transport_mode.#{n.transport_mode}") : '' }, 'networks.name' => Proc.new { |n| n.try(:network).try(:name) }, 'companies.name' => Proc.new { |n| n.try(:company).try(:name) } }, [:show], diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim index 24428eea4..56ecbf6da 100644 --- a/app/views/stop_area_referentials/show.html.slim +++ b/app/views/stop_area_referentials/show.html.slim @@ -32,8 +32,9 @@ - sync.stop_area_referential_sync_messages.last.tap do |log| - if log.criticity = log.criticity tr - td = l(log.created_at, format: :short) - td + td style='width:150px' + = l(log.created_at, format: :short_with_time) + td.text-center .fa.fa-circle class="text-#{criticity_class(log.criticity)}" td - data = log.message_attributs.symbolize_keys! diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index 01b65653c..c17f96c85 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -15,7 +15,7 @@ .row .col-lg-12 = table_builder @time_tables, - { :color => Proc.new{|tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }, :comment => 'comment', + { 'OiD' => Proc.new { |n| n.objectid.local_id }, :color => Proc.new{|tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }, :comment => 'comment', "Période englobante" => Proc.new{ |tt| tt.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(tt.bounding_dates.min), end: l(tt.bounding_dates.max)) }, "Nombre de courses associées" => Proc.new{ |tt| tt.vehicle_journeys.count }, "Journées d'application" => Proc.new{ |tt| (%w(monday tuesday wednesday thursday friday saturday sunday).collect{|d| tt.send(d) ? t("calendars.days.#{d}") : '' }).reject{|a| a.empty?}.join(', ').html_safe }, |
