aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/referential_lines/show.html.slim
blob: cbce7a7d524e254eb9c4afcb73870ac56044a6db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/ PageHeader
= pageheader 'ligne',
             @line.name,
             '',
             t('last_update', time: l(@line.updated_at, format: :short)) do

  / Below is secundary actions & optional contents
  .row
    .col-lg-12.text-right.mb-sm
      - @line.action_links.each do |link|
        = link_to link.href,
            method: link.method,
            data: link.data,
            class: 'btn btn-primary' do
              = link.content

/ PageContent
.page_content
  .container-fluid
    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = definition_list t('metadatas'),
          {  t('id_codif') => @line.objectid.local_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 ? t("enumerize.line.transport_mode.#{@line.transport_mode}") : '-'),
             @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.line.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')),}

    .row
      .col-lg-12
        - if params[:q].present? or @routes.any?
          .row
            .col-lg-12
              = render 'filters'

        - if @routes.any?
          .row
            .col-lg-12
              = table_builder_2 @routes,
                [ \
                  TableBuilderHelper::Column.new( \
                    name: 'ID', \
                    attribute: Proc.new { |n| n.objectid.local_id }, \
                    sortable: false \
                  ), \
                  TableBuilderHelper::Column.new( \
                    key: :name, \
                    attribute: 'name', \
                    link_to: lambda do |route| \
                      referential_line_route_path(@referential, @line, route) \
                    end \
                  ), \
                  TableBuilderHelper::Column.new( \
                    key: :published_name, \
                    attribute: 'published_name' \
                  ), \
                  TableBuilderHelper::Column.new( \
                    key: :wayback, \
                    attribute: 'wayback_text' \
                  ), \
                  TableBuilderHelper::Column.new( \
                    name: 'Arrêt de départ', \
                    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", \
                    attribute: Proc.new{ |r| r.try(:stop_points).last.try(:stop_area).try(:name) }, \
                    sortable: false \
                  ), \
                  TableBuilderHelper::Column.new( \
                    key: :stop_points, \
                    attribute: Proc.new{ |r| r.try(:stop_points).count } \
                  ), \
                  TableBuilderHelper::Column.new( \
                    key: :journey_patterns, \
                    attribute: Proc.new{ |r| r.try(:journey_patterns).count } \
                  ) \
                ],
                links: [:show, :edit],
                cls: 'table has-search'

              = new_pagination @routes, 'pull-right'

        - unless @routes.any?
          .row.mt-xs
            .col-lg-12
              = replacement_msg t('routes.search_no_results')