Sha256: 0966bbb80237a88c4637c4d354d236673932c490fe8385b9ff69e06d556fc6f9

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

class TokyoMetro::App::Renderer::Concerns::Link::ToRailwayLinePage::PassengerSurvey < TokyoMetro::App::Renderer::Concerns::Link::ToRailwayLinePage::MetaClass::Group

  def initialize( request , railway_line_decorated , survey_years , additional_class_of_li: nil )
    super( request , railway_line_decorated )

    @controller = :passenger_survey
    @link_type = :action_for_station

    @suffix_ja = "の各駅"
    @prefix_en = "Stations on"

    @survey_years = survey_years.sort.reverse
    @additional_class_of_li = additional_class_of_li
  end

  def render
    h.render inline: <<-HAML , type: :haml , locals: h_locals
%ul{ class: [ :each_railway_line , railway_line_decorated.css_class_name , :clearfix ] }
  = this.render_railway_line_name
  - survey_year_max = survey_years.max
  - survey_years.each do | survey_year |
    = ::TokyoMetro::App::Renderer::PassengerSurvey::SideMenu::MetaClass::EachYear.new( request , survey_year , survey_year_max , railway_line_page_name ).render
    HAML
  end

  private

  def add_railway_line_css_class_name_to_li_classes?
    false
  end

  def url
    url_helpers.url_for(
      controller: @controller ,
      action: :action_for_railway_line_or_year_page ,
      railway_line: railway_line_page_name ,
      only_path: true
    )
  end

  def without_link_to_railway_line_page?
    link_to_current_page? or link_to_railway_line_page_is_link_to_the_same_page?
  end

  def link_to_current_page?
    current_page?( url )
  end

  def link_to_railway_line_page_is_link_to_the_same_page?
    current_page?(
      controller: @controller ,
      action: :action_for_railway_line_or_year_page ,
      railway_line: railway_line_page_name ,
      survey_year: @survey_years.max.to_s
    )
  end

  def h_locals
    super.merge({
      survey_years: @survey_years
    })
  end

  # def additional_li_classes_to_link_to_this_page
    # :this_railway_line
  # end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/app/renderer/concerns/link/to_railway_line_page/passenger_survey.rb