diff options
Diffstat (limited to 'app')
30 files changed, 192 insertions, 76 deletions
diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico Binary files differindex ac6bc298d..7029bd04e 100644 --- a/app/assets/images/favicon.ico +++ b/app/assets/images/favicon.ico diff --git a/app/assets/stylesheets/modules/_vj_collection.sass b/app/assets/stylesheets/modules/_vj_collection.sass index e22507dcf..9bb19f75f 100644 --- a/app/assets/stylesheets/modules/_vj_collection.sass +++ b/app/assets/stylesheets/modules/_vj_collection.sass @@ -219,9 +219,17 @@ .form-control border-color: #ccc - .consolidated-view $highlighted: #d4ba32 + .togglable + &.ready + transition: all 0.5s + &:not(.open) + min-height: 0 !important + padding: 0 !important + margin: 0 !important + border: none + .line & > .head font-size: 2em @@ -257,7 +265,6 @@ .vehicle-journeys display: block overflow: hidden - transition: height 0.5s, margin-bottom 0.5s margin-bottom: 0px & > * display: inline-block diff --git a/app/controllers/compliance_check_messages_controller.rb b/app/controllers/compliance_check_messages_controller.rb index 36745981e..db551cca5 100644 --- a/app/controllers/compliance_check_messages_controller.rb +++ b/app/controllers/compliance_check_messages_controller.rb @@ -7,7 +7,7 @@ class ComplianceCheckMessagesController < ChouetteController def index index! do |format| format.csv { - send_data ComplianceCheckMessageExport.new(compliance_check_messages: collection).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true, server_url: request.base_url) , :filename => "compliance_check_set_errors_#{line_code}_#{Date.today.to_s}.csv" + send_data ComplianceCheckMessageExport.new(compliance_check_messages: collection).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true, server_url: request.base_url) , :filename => "#{t('compliance_check_messages.compliance_check_set_errors')}_#{line_code}_#{Time.now.strftime('%d-%m-%Y_%H-%M')}.csv" } end end @@ -22,10 +22,10 @@ class ComplianceCheckMessagesController < ChouetteController end def compliance_check_resource - ComplianceCheckResource.find(params[:compliance_check_resource_id]) + ComplianceCheckResource.find(params[:compliance_check_resource_id]) end - private + private def line_code Chouette::Line.find_by_objectid("#{compliance_check_resource.reference}").get_objectid.local_id diff --git a/app/controllers/import_messages_controller.rb b/app/controllers/import_messages_controller.rb index e9a071177..9f61940a3 100644 --- a/app/controllers/import_messages_controller.rb +++ b/app/controllers/import_messages_controller.rb @@ -9,7 +9,7 @@ class ImportMessagesController < ChouetteController def index index! do |format| format.csv { - send_data Import::MessageExport.new(:import_messages => @import_messages).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true) , :filename => "import_errors_#{@import_resource.name.gsub('.xml', '')}_#{Date.today.to_s}.csv" + send_data Import::MessageExport.new(:import_messages => @import_messages).to_csv(:col_sep => "\;", :quote_char=>'"', force_quotes: true) , :filename => "#{t('import_messages.import_errors')}_#{@import_resource.name.gsub('.xml', '')}_#{Time.now.strftime("%d-%m-%Y_%H-%M")}.csv" } end end diff --git a/app/decorators/stop_point_decorator.rb b/app/decorators/stop_point_decorator.rb index 4ff5bce9c..575938fa2 100644 --- a/app/decorators/stop_point_decorator.rb +++ b/app/decorators/stop_point_decorator.rb @@ -4,8 +4,8 @@ class StopPointDecorator < AF83::Decorator with_instance_decorator do |instance_decorator| instance_decorator.show_action_link do |l| l.href do - h.referential_stop_area_path( - object.referential, + h.stop_area_referential_stop_area_path( + object.stop_area.stop_area_referential, object.stop_area ) end diff --git a/app/javascript/helpers/polyfills.js b/app/javascript/helpers/polyfills.js index 93e3e9846..691fe04af 100644 --- a/app/javascript/helpers/polyfills.js +++ b/app/javascript/helpers/polyfills.js @@ -1,4 +1,5 @@ import 'promise-polyfill/src/polyfill' import 'es6-symbol/implement' import 'polyfill-array-includes' +import 'babel-polyfill' import 'whatwg-fetch' diff --git a/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js index cec39ab4e..a0438d7c5 100644 --- a/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js +++ b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js @@ -58,7 +58,8 @@ export default class BSelect4 extends Component { this.props.onSelect2JourneyPattern(e) } else{ - let data = JSON.parse(e.currentTarget.selectedOptions[0].dataset.item) + let option = e.currentTarget.options[e.currentTarget.selectedIndex] + let data = JSON.parse(option.dataset.item) this.props.onSelect2JourneyPattern({params: { diff --git a/app/javascript/vehicle_journeys/reducers/vehicleJourneys.js b/app/javascript/vehicle_journeys/reducers/vehicleJourneys.js index ecb58e2ea..4931ab46e 100644 --- a/app/javascript/vehicle_journeys/reducers/vehicleJourneys.js +++ b/app/javascript/vehicle_journeys/reducers/vehicleJourneys.js @@ -66,10 +66,6 @@ const vehicleJourney= (state = {}, action, keep) => { newVjas.departure_day_offset = 1 newVjas.arrival_day_offset = 1 } - if(current_time.hour + offsetHours < 0){ - newVjas.departure_day_offset = -1 - newVjas.arrival_day_offset = -1 - } } else{ newVjas = { diff --git a/app/models/clean_up.rb b/app/models/clean_up.rb index 0f73e07b2..9cf2389c9 100644 --- a/app/models/clean_up.rb +++ b/app/models/clean_up.rb @@ -16,6 +16,8 @@ class CleanUp < ApplicationModel where(referential_id: referential.id) end + attr_accessor :methods + def end_date_must_be_greater_that_begin_date if self.end_date && self.date_type == 'between' && self.begin_date >= self.end_date errors.add(:base, I18n.t('activerecord.errors.models.clean_up.invalid_period')) @@ -43,17 +45,22 @@ class CleanUp < ApplicationModel end end - destroy_vehicle_journeys_outside_referential + destroy_routes_outside_referential # Disabled for the moment. See #5372 # destroy_time_tables_outside_referential - destroy_vehicle_journeys - destroy_journey_patterns - destroy_routes + # Run caller-specified cleanup methods + run_methods end end end + def run_methods + return if methods.nil? + + methods.each { |method| send(method) } + end + def destroy_time_tables_between time_tables = Chouette::TimeTable.where('end_date < ? AND start_date > ?', self.end_date, self.begin_date) self.destroy_time_tables(time_tables) @@ -100,9 +107,9 @@ class CleanUp < ApplicationModel destroy_time_tables(time_tables) end - def destroy_vehicle_journeys_outside_referential + def destroy_routes_outside_referential line_ids = referential.metadatas.pluck(:line_ids).flatten.uniq - Chouette::VehicleJourney.joins(:route).where(["routes.line_id not in (?)", line_ids]).destroy_all + Chouette::Route.where(['line_id not in (?)', line_ids]).destroy_all end def destroy_vehicle_journeys @@ -117,6 +124,12 @@ class CleanUp < ApplicationModel Chouette::Route.where("id not in (select distinct route_id from journey_patterns)").destroy_all end + def destroy_empty + destroy_vehicle_journeys + destroy_journey_patterns + destroy_routes + end + def overlapping_periods self.end_date = self.begin_date if self.date_type != 'between' Chouette::TimeTablePeriod.where('(period_start, period_end) OVERLAPS (?, ?)', self.begin_date, self.end_date) diff --git a/app/models/concerns/checksum_support.rb b/app/models/concerns/checksum_support.rb index fe52604bb..86bbd1d00 100644 --- a/app/models/concerns/checksum_support.rb +++ b/app/models/concerns/checksum_support.rb @@ -10,19 +10,24 @@ module ChecksumSupport end module ClassMethods + def has_checksum_children klass, opts={} parent_class = self belongs_to = opts[:relation] || self.model_name.singular has_many = opts[:relation] || self.model_name.plural Rails.logger.debug "Define callback in #{klass} to update checksums #{self.model_name} (via #{has_many}/#{belongs_to})" - klass.after_save do + + child_update_parent = Proc.new do parents = [] parents << self.send(belongs_to) if klass.reflections[belongs_to].present? parents += self.send(has_many) if klass.reflections[has_many].present? Rails.logger.debug "Request from #{klass.name} checksum updates for #{parents.count} #{parent_class} parent(s)" parents.compact.each &:update_checksum_without_callbacks! end + + klass.after_save &child_update_parent + klass.after_destroy &child_update_parent end end diff --git a/app/models/import/netex.rb b/app/models/import/netex.rb index b4422328c..753f9128d 100644 --- a/app/models/import/netex.rb +++ b/app/models/import/netex.rb @@ -100,7 +100,6 @@ class Import::Netex < Import::Base metadata.periodes = frame.periods line_objectids = frame.line_refs.map { |ref| "STIF:CODIFLIGNE:Line:#{ref}" } - create_message criticity: :info, message_key: "referential_creation_lines_found", message_attributes: {line_objectids: line_objectids.to_sentence} metadata.line_ids = workbench.lines.where(objectid: line_objectids).pluck(:id) end end diff --git a/app/models/merge.rb b/app/models/merge.rb index 2824e1f83..aca2f4d4d 100644 --- a/app/models/merge.rb +++ b/app/models/merge.rb @@ -145,12 +145,19 @@ class Merge < ApplicationModel end end + referential_route_opposite_route_ids = referential.switch do + Hash[referential.routes.where('opposite_route_id is not null').pluck(:id, :opposite_route_id)] + end + referential_routing_constraint_zones_new_ids = {} new.switch do + route_ids_mapping = {} + referential_routes.each do |route| existing_route = new.routes.find_by line_id: route.line_id, checksum: route.checksum if existing_route + route_ids_mapping[route.id] = existing_route.id existing_route.merge_metadata_from route else objectid = Chouette::Route.where(objectid: route.objectid).exists? ? nil : route.objectid @@ -159,7 +166,7 @@ class Merge < ApplicationModel objectid: objectid, # line_id is the same # all other primary must be changed - opposite_route_id: nil #FIXME + opposite_route_id: nil # merged after ) new_route = new.routes.build attributes @@ -179,6 +186,8 @@ class Merge < ApplicationModel # We need to create StopPoints to known new primary keys new_route.save! + route_ids_mapping[route.id] = new_route.id + old_stop_point_ids = route_stop_points.sort_by(&:position).map(&:id) new_stop_point_ids = new_route.stop_points.sort_by(&:position).map(&:id) @@ -225,6 +234,20 @@ class Merge < ApplicationModel end end end + + referential_route_opposite_route_ids.each do |route_id, opposite_route_id| + new_route_id = route_ids_mapping[route_id] + new_opposite_route_id = route_ids_mapping[opposite_route_id] + + new_route = nil + if new_route_id && new_opposite_route_id + if new_route = new.routes.find_by(id: new_route_id) + new_route.update_column :opposite_route_id, new_opposite_route_id + end + end + + Rails.logger.warn "Can't merge opposite route for Route #{route_id}" unless new_route + end end # JourneyPatterns diff --git a/app/services/route_way_cost_calculator.rb b/app/services/route_way_cost_calculator.rb index d41a2e59a..ca47a6772 100644 --- a/app/services/route_way_cost_calculator.rb +++ b/app/services/route_way_cost_calculator.rb @@ -8,5 +8,7 @@ class RouteWayCostCalculator way_costs = TomTom.matrix(way_costs) way_costs = WayCostCollectionJSONSerializer.dump(way_costs) @route.update(costs: way_costs) + rescue TomTom::Errors::MatrixRemoteError => e + Rails.logger.error "TomTom::Matrix server error: #{e}" end end diff --git a/app/views/companies/show.html.slim b/app/views/companies/show.html.slim index 8960b92dd..6335d88da 100644 --- a/app/views/companies/show.html.slim +++ b/app/views/companies/show.html.slim @@ -6,7 +6,7 @@ .container-fluid .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 - - attributes = { t('id_codif') => @company.try(:objectid).try(:local_id), + - attributes = { t('id_codif') => @company.get_objectid.try(:short_id), Chouette::Company.human_attribute_name(:phone) => @company.phone, Chouette::Company.human_attribute_name(:email) => @company.email, Chouette::Company.human_attribute_name(:url) => @company.url } diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim index 729c1ce43..48c03d7c8 100644 --- a/app/views/compliance_control_sets/show.html.slim +++ b/app/views/compliance_control_sets/show.html.slim @@ -15,8 +15,9 @@ = render '/compliance_controls/filters' / compliance controls without block - = render_compliance_control_block - = render_compliance_controls(@direct_compliance_controls) + - unless params[:q].present? && @direct_compliance_controls.nil? + = render_compliance_control_block + = render_compliance_controls(@direct_compliance_controls) / compliance controls with block - if params[:q] && params[:q][:compliance_control_block_id_eq_any].try(:present?) diff --git a/app/views/dashboards/_dashboard.html.slim b/app/views/dashboards/_dashboard.html.slim index ce869ee4a..18105041a 100644 --- a/app/views/dashboards/_dashboard.html.slim +++ b/app/views/dashboards/_dashboard.html.slim @@ -6,6 +6,24 @@ h3.panel-title.with_actions div = link_to t('dashboards.workbench.title', organisation: workbench.organisation.name), workbench_path(workbench) + span.badge.ml-xs = workbench.output.referentials.count if workbench.output.referentials.present? + + div + = link_to '', workbench_path(workbench), class: ' fa fa-chevron-right pull-right', title: t('workbenches.index.offers.see') + + - if workbench.output.referentials.present? + .list-group + - workbench.output.referentials.limit(5).each do |referential| + = link_to referential.name, referential_path(referential), class: 'list-group-item' + - else + .panel-body + em.small.text-muted = t('workbenches.index.offers.no_content') + + .panel.panel-default + .panel-heading + h3.panel-title.with_actions + div + = link_to t('dashboards.workbench.title', organisation: workbench.organisation.name), workbench_path(workbench) span.badge.ml-xs = workbench.all_referentials.uniq.count if workbench.all_referentials.present? div diff --git a/app/views/devise/invitations/edit.html.slim b/app/views/devise/invitations/edit.html.slim index 7a22146c0..20c2f15c8 100644 --- a/app/views/devise/invitations/edit.html.slim +++ b/app/views/devise/invitations/edit.html.slim @@ -1,6 +1,5 @@ / PageHeader - -- content_for :page_header_title, t('.title') +- content_for :page_header_title, t('devise.registrations.edit.title') / PageContent .page_content @@ -16,4 +15,4 @@ = form.input :password, as: :password = form.input :password_confirmation, as: :password - = form.button :submit, value: t('devise.invitations.edit.submit_button'), class: 'btn-info btn-default formSubmitr', form: 'invitation_form' + = form.button :submit, value: t('actions.submit'), class: 'btn-info btn-default formSubmitr', form: 'invitation_form' diff --git a/app/views/devise/invitations/new.html.slim b/app/views/devise/invitations/new.html.slim index 87bfbf750..90f086c2b 100644 --- a/app/views/devise/invitations/new.html.slim +++ b/app/views/devise/invitations/new.html.slim @@ -1,10 +1,15 @@ -h2 = t('devise.invitations.new.header') +- content_for :page_header_title, t('devise.registrations.new.title') -= simple_form_for resource, as: resource_name, :url => invitation_path(resource_name), :html => {:method => :post, class: "form-horizontal"} do |form| - = form.input :organisation_id, :as => :hidden, input_html: { :value => current_organisation.id } +/ PageContent +.page_content + .container-fluid + .row + .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 + = simple_form_for resource, as: resource_name, :url => invitation_path(resource_name), :html => {:method => :post, class: "form-horizontal", id: "new_user_form"} do |form| + = form.input :organisation_id, :as => :hidden, input_html: { :value => current_organisation.id } - - resource.class.invite_key_fields.each do |field| - = form.input field + - resource.class.invite_key_fields.each do |field| + = form.input field - .form-actions - = form.button :submit, value: t('devise.invitations.new.submit_button'), class: 'btn-info'
\ No newline at end of file + .form-actions + = form.button :submit, value: t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'new_user_form'
\ No newline at end of file diff --git a/app/views/imports/import/_gtf.html.slim b/app/views/imports/import/_gtf.html.slim index 8b92f2e92..e50b45888 100644 --- a/app/views/imports/import/_gtf.html.slim +++ b/app/views/imports/import/_gtf.html.slim @@ -1,7 +1,8 @@ +- breadcrumb :gtfs_import, @workbench, @import + .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 - - metadata = { t('.parent') => link_to(@import.parent.name, [@import.parent.workbench, @import.parent]) } - - metadata = metadata.update({t('.status') => import_status(@import.status, verbose: true) }) + - metadata = {t('.status') => import_status(@import.status, verbose: true) } - metadata = metadata.update({t('.referential') => @import.referential ? link_to(@import.referential.name, [@import.referential]) : "-" }) = definition_list t('metadatas'), metadata @@ -14,7 +15,7 @@ = table_builder_2 @import.resources, [ \ TableBuilderHelper::Column.new( \ - name: t('.referential_name'), \ + name: t('imports.show.referential_name'), \ attribute: 'name', \ sortable: false, \ link_to: lambda do |item| \ diff --git a/app/views/imports/import/_netex.html.slim b/app/views/imports/import/_netex.html.slim index 2f341016a..ab0ed20d7 100644 --- a/app/views/imports/import/_netex.html.slim +++ b/app/views/imports/import/_netex.html.slim @@ -1,8 +1,9 @@ +- breadcrumb :netex_import, @workbench, @import + .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 - - metadata = { t('.parent') => link_to(@import.parent.name, [@import.parent.workbench, @import.parent]) } - - metadata = metadata.update({t('.status') => import_status(@import.status, verbose: true) }) - - metadata = metadata.update({t('.referential') => @import.referential ? link_to(@import.referential.name, [@import.referential]) : "-" }) + - metadata = {Import::Base.tmf(:status) => import_status(@import.status, verbose: true) } + - metadata = metadata.update({Import::Base.tmf(:referential) => @import.referential ? link_to(@import.referential.name, [@import.referential]) : "-" }) = definition_list t('metadatas'), metadata .col-lg-12 @@ -11,9 +12,9 @@ - if @import.resources.present? .col-lg-12 - h2 = t('.table_title') + h2 = t('imports.show.netex.table_title') .col-lg-12 - = t('.table_explanation') + = t('imports.show.netex.table_explanation') .col-lg-12 = table_builder_2 @import.resources.where(resource_type: :file), [ \ @@ -28,12 +29,12 @@ sortable: false, \ ), \ TableBuilderHelper::Column.new( \ - name: 'Résultat des tests' , \ + name: t('imports.show.table.test_results') , \ attribute: Proc.new { |n| I18n.t('import_resources.index.metrics', n.metrics.deep_symbolize_keys) }, \ sortable: false, \ ), \ TableBuilderHelper::Column.new( \ - name: 'Téléchargement' , \ + name: t('imports.show.table.download') , \ attribute: Proc.new { |n| '<i class="fa fa-download" aria-hidden="true"></i>'.html_safe }, \ sortable: false, \ link_to: lambda do |import_resource| \ diff --git a/app/views/imports/import/_workbench.html.slim b/app/views/imports/import/_workbench.html.slim index e41ceb0f0..cbdf604c2 100644 --- a/app/views/imports/import/_workbench.html.slim +++ b/app/views/imports/import/_workbench.html.slim @@ -1,7 +1,9 @@ +- breadcrumb :import, @workbench, @import + .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 - - metadata = { t('.data_recovery') => '-', t('.filename') => @import.try(:file_identifier)} - - metadata = metadata.update({t('.status') => import_status(@import.status, verbose: true) }) + - metadata = { t('.data_recovery') => '-', t('imports.show.filename') => @import.try(:file_identifier)} + - metadata = metadata.update({Import::Base.tmf(:status) => import_status(@import.status, verbose: true) }) = definition_list t('metadatas'), metadata .col-lg-12 @@ -25,7 +27,7 @@ ruby: = table_builder_2 @import.resources, [ \ TableBuilderHelper::Column.new( \ - name: t('.referential_name'), \ + name: t('imports.show.referential_name'), \ attribute: 'name', \ sortable: false, \ link_to: lambda do |item| \ diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim index 10552129d..fb83e9a06 100644 --- a/app/views/imports/show.html.slim +++ b/app/views/imports/show.html.slim @@ -1,5 +1,3 @@ -- breadcrumb :import, @workbench, @import - - page_header_content_for @import .page_content diff --git a/app/views/layouts/navigation/_main_nav_left_content.html.slim b/app/views/layouts/navigation/_main_nav_left_content.html.slim index 889f8f944..004ea9050 100644 --- a/app/views/layouts/navigation/_main_nav_left_content.html.slim +++ b/app/views/layouts/navigation/_main_nav_left_content.html.slim @@ -68,3 +68,18 @@ .list-group = link_to stop_area_referential_stop_areas_path(workbench.stop_area_referential), class: "list-group-item" do span = Chouette::StopArea.t.capitalize + + .menu-item.panel + .panel-heading + h4.panel-title + = link_to '#miSix', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do + = t('layouts.navbar.configuration') + + #miSix.panel-collapse.collapse + .list-group + - if policy(workbench).edit? + = link_to [:edit, workbench], class: 'list-group-item' do + span = t('layouts.navbar.workbench_configuration') + - if policy(workbench.workgroup).edit? + = link_to [:edit, workbench.workgroup], class: 'list-group-item' do + span = t('layouts.navbar.workgroup_configuration') diff --git a/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim b/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim index a7bb3f511..7bea0814e 100644 --- a/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim +++ b/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim @@ -14,9 +14,6 @@ span = t('layouts.navbar.workbench_outputs.organisation') = link_to '#', class: 'list-group-item disabled' do span = t('layouts.navbar.workbench_outputs.workgroup') - - if policy(workbench.workgroup).edit? - = link_to [:edit, workbench.workgroup], class: 'list-group-item' do - span = t('layouts.navbar.workbench_outputs.edit_workgroup') .menu-item.panel .panel-heading @@ -38,9 +35,6 @@ span = t('activerecord.models.compliance_check_set.other').capitalize = link_to compliance_control_sets_path, class: 'list-group-item' do span = t('activerecord.models.compliance_control_set.other').capitalize - - if policy(workbench).edit? - = link_to [:edit, workbench], class: 'list-group-item' do - span = t('workbenches.edit.link') .menu-item.panel .panel-heading @@ -76,10 +70,25 @@ .panel-heading h4.panel-title = link_to '#miSix', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do - = t('layouts.navbar.tools') + = t('layouts.navbar.configuration') #miSix.panel-collapse.collapse .list-group + - if policy(workbench).edit? + = link_to [:edit, workbench], class: 'list-group-item' do + span = t('layouts.navbar.workbench_configuration') + - if policy(workbench.workgroup).edit? + = link_to [:edit, workbench.workgroup], class: 'list-group-item' do + span = t('layouts.navbar.workgroup_configuration') + + .menu-item.panel + .panel-heading + h4.panel-title + = link_to '#miSeven', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do + = t('layouts.navbar.tools') + + #miSeven.panel-collapse.collapse + .list-group = link_to Rails.application.config.try(:portal_url), target: '_blank', class: 'list-group-item' do span span.fa.fa-2x.fa-circle diff --git a/app/views/referential_vehicle_journeys/_consolidated.html.slim b/app/views/referential_vehicle_journeys/_consolidated.html.slim index e2de526bc..4a1866e8a 100644 --- a/app/views/referential_vehicle_journeys/_consolidated.html.slim +++ b/app/views/referential_vehicle_journeys/_consolidated.html.slim @@ -8,26 +8,42 @@ coffee: $('a.toggle-timetables').click (e)-> e.preventDefault() $(e.target).toggleClass 'active' - $(e.target).parents('.table').find('.detailed-timetables').toggleClass 'hidden' + $(e.target).parents('.table').find('.detailed-timetables').customToggle() $('a.toggle-purchase-windows').click (e)-> e.preventDefault() $(e.target).toggleClass 'active' - $(e.target).parents('.table').find('.detailed-purchase-windows').toggleClass 'hidden' + $(e.target).parents('.table').find('.detailed-purchase-windows').customToggle() - $('.route').find('.vehicle-journeys').each (i, e)-> + $('.route').find('.togglable.hidden').each (i, e)-> $e = $(e) $e.removeClass 'hidden' - e.setAttribute 'data-original-height', $e.height() - $e.height 0 + e.setAttribute 'data-original-height', $e.innerHeight() + e.setAttribute 'data-original-full-height', $e.outerHeight(true) + $e.css height: 0 + $e.addClass 'ready' $('a.toggle-route').click (e)-> e.preventDefault() $(e.currentTarget).toggleClass 'active' tab = $(e.currentTarget).parents('.route').find('.vehicle-journeys') - if tab.hasClass 'open' - tab.removeClass 'open' - tab.height 0 - else - tab.addClass 'open' - tab.height tab.attr('data-original-height') + tab.customToggle() + + $.fn.extend + customToggle: (propagate=true)-> + height = parseFloat this.attr('data-original-height') + fullHeight = parseFloat this.attr('data-original-full-height') + if this.hasClass 'open' + this.css height: 0 + this.removeClass 'open' + this.find('.togglable.open').customToggle(false) + this.find('a.active').removeClass 'active' + if propagate + for parent in this.parents(".togglable.open") + $(parent).height $(parent).height() - fullHeight + else + this.addClass 'open' + this.height height + if propagate + for parent in this.parents(".togglable.open") + $(parent).height $(parent).height() + fullHeight diff --git a/app/views/referential_vehicle_journeys/_consolidated_line.html.slim b/app/views/referential_vehicle_journeys/_consolidated_line.html.slim index d4c756d38..c73c65961 100644 --- a/app/views/referential_vehicle_journeys/_consolidated_line.html.slim +++ b/app/views/referential_vehicle_journeys/_consolidated_line.html.slim @@ -20,7 +20,7 @@ = Chouette::VehicleJourney.t | span.fa.fa-angle-up - .table.table-2entries.vehicle-journeys.hidden + .table.table-2entries.vehicle-journeys.hidden.togglable .t2e-head.w20 .th div @@ -31,7 +31,7 @@ = link_to '#', class: 'toggle-purchase-windows detailed-timetables-bt' do span.fa.fa-angle-up = Chouette::PurchaseWindow.t - .detailed-purchase-windows.hidden + .detailed-purchase-windows.hidden.togglable - route.purchase_windows.uniq.each do |tt| div p @@ -46,7 +46,7 @@ span.fa.fa-angle-up = Chouette::TimeTable.t - .detailed-timetables.hidden + .detailed-timetables.hidden.togglable - route.time_tables.uniq.each do |tt| div p @@ -86,7 +86,7 @@ span.fa.fa-calendar style="color: #{tt.color ? tt.color : '#4B4B4B'}" - if journey.purchase_windows.size > 3 span.vj_tt = "+ #{journey.purchase_windows.size - 3}" - .detailed-purchase-windows.hidden + .detailed-purchase-windows.hidden.togglable - route.purchase_windows.uniq.each do |tt| div class=(journey.has_purchase_window?(tt) ? 'active' : 'inactive') div @@ -96,7 +96,7 @@ span.fa.fa-calendar style="color: #{tt.color ? tt.color : '#4B4B4B'}" - if journey.time_tables.size > 3 span.vj_tt = "+ #{journey.time_tables.size - 3}" - .detailed-timetables.hidden + .detailed-timetables.hidden.togglable - route.time_tables.uniq.each do |tt| div class=(journey.has_time_table?(tt) ? 'active' : 'inactive') diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index aea824a89..2218bd85f 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -30,7 +30,7 @@ key: :name, \ attribute: Proc.new { |s| content_tag :span, s.stop_area&.name, class: s.stop_area&.area_type }, \ link_to: lambda do |stop_point| \ - referential_stop_area_path(@referential, stop_point.stop_area) \ + stop_area_referential_stop_area_path(stop_point.stop_area.referential, stop_point.stop_area) \ end \ ), \ TableBuilderHelper::Column.new( \ diff --git a/app/views/workbenches/_form.html.slim b/app/views/workbenches/_form.html.slim index 819346c35..c7b6fd4f3 100644 --- a/app/views/workbenches/_form.html.slim +++ b/app/views/workbenches/_form.html.slim @@ -1,4 +1,6 @@ -= simple_form_for @workbench, html: { class: 'form-horizontal', id: 'workbench_form' }, wrapper: :horizontal_form do |f| += title_tag t('activerecord.models.compliance_control_set.other') + += simple_form_for @workbench, html: { class: 'form-horizontal', id: 'workbench_form' }, wrapper: :horizontal_form, title: "prout" do |f| .row .col-lg-12 = f.fields_for :compliance_control_set_ids do |ff| diff --git a/app/views/workbenches/edit.html.slim b/app/views/workbenches/edit.html.slim index 893024490..0774610e1 100644 --- a/app/views/workbenches/edit.html.slim +++ b/app/views/workbenches/edit.html.slim @@ -1,4 +1,4 @@ -- breadcrumb @workbench +- breadcrumb :workbench_configure, @workbench - page_header_content_for @workbench .page_content diff --git a/app/views/workgroups/_form.html.slim b/app/views/workgroups/_form.html.slim index 7245cfc40..52d1faca8 100644 --- a/app/views/workgroups/_form.html.slim +++ b/app/views/workgroups/_form.html.slim @@ -1,3 +1,5 @@ += title_tag t('activerecord.models.compliance_control_set.other') + = simple_form_for @workgroup, html: { class: 'form-horizontal', id: 'workgroup_form' }, wrapper: :horizontal_form do |f| table.table thead |
