af83/chouette-core

View on GitHub
app/views/route_vehicle_journeys/show.html.slim

Summary

Maintainability
Test Coverage
- breadcrumb :vehicle_journeys, @workbench, @referential, @route
- content_for :page_header_resource_name, Chouette::VehicleJourney.ts.pluralize.capitalize, flush: true
- content_for :page_header_title, t('vehicle_journeys.index.title', route: @route.name)
- content_for :page_header_content do
  .row.mb-sm
    .col-lg-12.text-right
      = link_to I18n.t("time_tables.index.title"), [@workbench, @referential, :time_tables], class: 'btn btn-primary sticky-action', target: :blank
      - if @route.opposite_route.present?
        - enable = @route.opposite_route.vehicle_journeys.exists?
        = link_to(t('routes.actions.reversed_vehicle_journey'), [@workbench, @referential, @route.opposite_route, :vehicle_journeys], class: "btn btn-primary sticky-action #{enable ? '' : 'disabled'}")

.page_content
  .container-fluid
    .row
      .col-lg-12
        #vehicle_journeys_wip

= javascript_tag do
  | window.default_line_notices_path = '#{workbench_line_referential_line_notices_path(@workbench)}';
  | window.route_id = #{params[:route_id]};
  | window.referential_id = #{@referential.id};
  | window.workbench_id = #{@workbench.id};
  | window.companiesPath = '#{workbench_line_referential_companies_path(@workbench)}';
  | window.line_id = #{@route.line.id};
  | window.stopPoints = #{(@stop_points_list.to_json).html_safe};
  | window.returnStopPoints = #{(@return_stop_points_list.to_json).html_safe};
  | window.jpOrigin = #{(@jp_origin.present? ? @jp_origin.attributes.update({full_schedule: @jp_origin.full_schedule?}).to_json  : "null").html_safe};
  | window.jpOriginStopPoints = #{(@jp_origin_stop_points.to_json).html_safe};
  | window.transportMode = #{(@transport_mode.to_json).html_safe};
  | window.transportSubmode = #{(@transport_submode.to_json).html_safe};
  | window.vehicleJourneysLength = #{@vehicle_journeys.total_entries()};
  | window.vehicleJourneysPerPage = #{@ppage};
  | window.line_footnotes = #{raw @footnotes};
  | window.perms = #{raw @perms};
  | window.features = #{raw @features};
  | window.all_missions = #{(@all_missions.to_json).html_safe};
  | window.custom_fields = #{(@custom_fields.to_json).html_safe};
  | window.extra_headers = #{(@extra_headers.to_json).html_safe};
  | window.constraint_zones_routes = "#{url_for([@workbench, @referential, @route.line, :routing_constraint_zones]).html_safe}";
  | window.companies_path = "#{workbench_line_referential_companies_path(@workbench)}";
  | window.available_specific_stop_places_path = "#{(url_for([@workbench, @referential, @route.line, @route, :journey_patterns])+"/:journey_pattern_id:/available_specific_stop_places").html_safe}";
  | window.available_code_spaces = #{(@referential.workgroup&.code_spaces.to_json)&.html_safe};

- if has_feature?(:stop_area_routing_constraints)
  = javascript_tag do
    | window.stop_area_constraints_routes = "#{workbench_stop_area_referential_stop_area_routing_constraints_path(@workbench)}";

- if has_feature?(:vehicle_journeys_return_route)
  = javascript_tag do
    | window.returnRouteUrl = "#{(@route.opposite_route && url_for([@workbench, @referential, @route.opposite_route, :vehicle_journeys]) || "").html_safe}";