aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/lines/show.html.slim
blob: 7aeb78033f15c7c0bda7de12376a94198cc98f42 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
- text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}"
- bg_color = @line.color.blank? ? "white" : "##{@line.color}"

= title_tag t('lines.show.title', line: @line.name)

.line_show
  .summary
    - text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}"
    - bg_color = @line.color.blank? ? "white" : "##{@line.color}"

    - if colors?(@line)
      p
        label = "#{t('lines.index.color')} : "
        label.color style="#{number_style(@line)}"
          = line_sticker(@line)

    - if @line.deactivated
      p
        = t('lines.index.deactivated')

    p
      label = "#{@line.human_attribute_name(:network)} : "

      - if @line.network.nil?
        = t('lines.index.unset')
      - else
        = link_to @line.network.name, [@line_referential, @line.network]
    p
      label = "#{@line.human_attribute_name(:company)} : "
      - if @line.company.nil?
        = t('lines.index.unset')
      - else
        = link_to @line.company.name, [@line_referential, @line.company]

    p
      label = "#{@line.human_attribute_name('number')} : "
      = @line.number

    p
      label = "#{@line.human_attribute_name('published_name')} : "
      = @line.published_name

    p
      label = "#{@line.human_attribute_name('registration_number')} : "
      = @line.registration_number

    p
      label = "#{@line.human_attribute_name('transport_mode')} : "
      - if @line.transport_mode
        = " " + t("enumerize.line.transport_mode.#{@line.transport_mode}")
      - else
        = " -"

    p
      label = "#{@line.human_attribute_name('transport_submode')} : "
      - if @line.transport_submode
        = " " + t("enumerize.line.transport_submode.#{@line.transport_submode}")
      - else
        = " -"

    / p
    /   label = "#{@line.human_attribute_name('stable_id')} : "
    /   = @line.stable_id

    p
      label = "#{@line.human_attribute_name('url')} : "
      = @line.url

    / p
    /   label = "#{@line.human_attribute_name('mobility_restricted_suitability')} : "
    /
    /   - if @line.mobility_restricted_suitability.nil?
    /     = @line.human_attribute_name("unspecified_mrs")
    /   - elsif @line.mobility_restricted_suitability?
    /     = @line.human_attribute_name("accessible")
    /   - else
    /     = @line.human_attribute_name("not_accessible")
    /
    /   br
    /   = "#{@line.human_attribute_name('number_of_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', true).count}"
    /   br
    /   = "#{@line.human_attribute_name('number_of_non_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', false).count}"
    /   br
    /   = @line.human_attribute_name("number_of_null_mrs_vj")
    /   = " : "
    /   = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("mobility_restricted_suitability = ?", true).count + @line.vehicle_journeys.where("mobility_restricted_suitability = ?", false).count)
    /
    / p
    /   label = "#{@line.human_attribute_name('flexible_service')} : "
    /
    /   - if @line.flexible_service.nil?
    /     = @line.human_attribute_name("unspecified_fs")
    /   - elsif @line.flexible_service?
    /     = @line.human_attribute_name("on_demaond_fs")
    /   - else
    /     = @line.human_attribute_name("regular_fs")
    /
    /   br
    /   = "#{@line.human_attribute_name('number_of_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', true).count}"
    /   br
    /   = "#{@line.human_attribute_name('number_of_non_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', false).count}"
    /   br
    /   = @line.human_attribute_name("number_of_null_fs_vj")
    /
    /   - if @line.flexible_service.nil?
    /     = "(#{@line.human_attribute_name('default_fs_msg')})"
    /
    /   = " : "
    /   = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("flexible_service = ?", true).count + @line.vehicle_journeys.where("flexible_service = ?", false).count)

    / p
    /   label = "#{@line.human_attribute_name('comment')} : "
    /   = @line.comment

    / .row
    /   #mobility_restricted_suitability.col-md-6
    /   #flexible_service.col-md-6

- content_for :sidebar do
  ul.actions
    - if policy(Chouette::Line).create?
      li
        = link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'add'
    / FIXME #2018
    - if false && policy(@line).update?
      li
        = link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), class: 'edit'
    - if policy(@line).destroy?
      li
        = link_to t('lines.actions.destroy'), line_referential_line_path(@line_referential, @line), method: :delete, :data => {:confirm =>  t('lines.actions.destroy_confirm')}, class: 'remove'

  = creation_tag(@line)