Class: TokyoMetro::App::Renderer::WomenOnlyCarInfo::EachRailwayLine

Inherits:
Factory::Decorate::MetaClass show all
Defined in:
lib/tokyo_metro/app/renderer/women_only_car_info/each_railway.rb

Instance Method Summary collapse

Constructor Details

#initialize(request, railway_line, infos) ⇒ EachRailwayLine

Returns a new instance of EachRailwayLine.



3
4
5
6
7
# File 'lib/tokyo_metro/app/renderer/women_only_car_info/each_railway.rb', line 3

def initialize( request , railway_line , infos )
  super( request )
  @railway_line = railway_line
  @infos = infos
end

Instance Method Details

#render(display_railway_line: false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tokyo_metro/app/renderer/women_only_car_info/each_railway.rb', line 9

def render( display_railway_line: false )
  h.render inline: <<-HAML , type: :haml , locals: h_locals( display_railway_line )
- railway_line_decorated = railway_line.decorate
- if display_railway_line
%div{ class: [ railway_line_decorated.css_class_name , :in_railway_line_group ] }
  = railway_line_decorated.render_title_in_women_only_car_info
  = this.render_each_women_only_car_info
- else
%div{ class: railway_line_decorated.css_class_name }
  = this.render_each_women_only_car_info
  HAML
end

#render_each_women_only_car_infoObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tokyo_metro/app/renderer/women_only_car_info/each_railway.rb', line 22

def render_each_women_only_car_info
  h.render inline: <<-HAML , type: :haml , locals: { infos: @infos }
- infos.group_by( &:operation_day_id ).each do | operation_day_id , group_by_operation_day_id |
%div{ class: :operation_day }<
  = ::OperationDay.find( operation_day_id ).decorate.render_in_women_only_car_info
  - group_by_operation_day_id.group_by( &:from_station_info_id ).each do | from_station_info_id , group_by_from_station_info_id |
    - group_by_from_station_info_id.group_by( &:to_station_info_id ).each do | to_station_info_id , group_by_from_and_to_station_info_id |
      %div{ class: :section }
        = group_by_from_and_to_station_info_id.first.decorate.render_title_of_section
        - group_by_from_and_to_station_info_id.group_by( &:available_time_to_s ).each do | available_time , group_by_available_time |
          %div{ class: :section_infos }
            %div{ class: [ :available_time , :text_en ] }<
              = available_time
            %div{ class: :infos }
              - group_by_available_time.each do | info |
                = info.decorate.render_place
  HAML
end