Class: TokyoMetro::App::Renderer::Concerns::Header::Content
- Inherits:
-
Title
- Object
- RailsDecorateFactory
- Factory::Decorate::MetaClass
- MetaClass
- Title
- TokyoMetro::App::Renderer::Concerns::Header::Content
- Defined in:
- lib/tokyo_metro/app/renderer/concerns/header/content.rb
Direct Known Subclasses
FareTable::LinkToRailwayLinePage::Header, RailwayLine::Links::Header, RealTimeInfos::MetaDatum::Whole::Header, SideMenu::NowDeveloping::Header, SideMenu::Problems::Header, StationFacility::Header::BarrierFreeInfo, StationFacility::Header::PlatformInfo, StationFacility::Header::RailwayLines::OtherOperators, StationFacility::Header::RailwayLines::TheSameOperator, TravelTimeInfo::Header, Twitter::Header, WomenOnlyCarInfo::Header
Defined Under Namespace
Modules: SizeChangingButtonType
Instance Method Summary collapse
-
#initialize(request, domain_class_name, icon_name, text_ja, text_en, domain_id_name: nil, icon_size: 3, size_changing_button_type: nil, size_changing_button_id: nil, add_update_button: false, update_button_id: nil, controller_of_updating_real_time_info_form: nil, action_of_updating_real_time_info_form: nil, additional_content: nil) ⇒ Content
constructor
A new instance of Content.
- #render ⇒ Object
Constructor Details
#initialize(request, domain_class_name, icon_name, text_ja, text_en, domain_id_name: nil, icon_size: 3, size_changing_button_type: nil, size_changing_button_id: nil, add_update_button: false, update_button_id: nil, controller_of_updating_real_time_info_form: nil, action_of_updating_real_time_info_form: nil, additional_content: nil) ⇒ Content
Returns a new instance of Content.
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 |
# File 'lib/tokyo_metro/app/renderer/concerns/header/content.rb', line 3 def initialize( request , domain_class_name , icon_name , text_ja , text_en , domain_id_name: nil , icon_size: 3 , size_changing_button_type: nil , size_changing_button_id: nil , add_update_button: false , update_button_id: nil , controller_of_updating_real_time_info_form: nil , action_of_updating_real_time_info_form: nil , additional_content: nil ) raise "Error" if and .blank? raise "Error" if !( ) and .present? raise "Error" if .present? and .blank? raise "Error" if .blank? and .present? super( request , text_ja , text_en , domain_id_name: domain_id_name , domain_class_name: domain_class_name , icon_name: icon_name , icon_size: icon_size , additional_content: additional_content ) @size_changing_button_type = @size_changing_button_id = @add_update_button = @update_button_id = @controller_of_updating_real_time_info_form = controller_of_updating_real_time_info_form @action_of_updating_real_time_info_form = action_of_updating_real_time_info_form end |
Instance Method Details
#render ⇒ Object
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 |
# File 'lib/tokyo_metro/app/renderer/concerns/header/content.rb', line 35 def render h.render inline: <<-HAML , type: :haml , locals: h_locals %div{ class: [ domain_class_name , :content_header , :clearfix ] , id: domain_id_name } - # icon , text - if icon_name.present? %div{ class: :icon }< = ::TokyoMetro::App::Renderer::Icon.send( icon_name , request , icon_size ).render - if text_ja.present? %div{ class: :text } %h3{ class: :text_ja }< - if text_ja.instance_of?( ::Proc ) = text_ja.call - else = text_ja %h4{ class: :text_en }< - if text_en.instance_of?( ::Proc ) = text_en.call - else = text_en - else %h3{ class: :text_en }< - if text_en.instance_of?( ::Proc ) = text_en.call - else = text_en - # size_changing_button - if size_changing_button_type.present? %div{ id: size_changing_button_id , class: [ :size_changing_button , size_changing_button_type ] }< = button_tag( type: :button ) do = ::TokyoMetro::App::Renderer::Icon.send( size_changing_button_type , request , 1 ).render - # add_update_button - if add_update_button %div{ id: update_button_id , class: :update_button }< = form_tag( url_in_updating_real_time_info_form , remote: true , class: class_name_of_updating_real_time_info_form_button ) do = button_tag( type: :submit ) do = ::TokyoMetro::App::Renderer::Icon.updating( request , 1 ).render - # additional_content - if additional_content.present? = additional_content.call HAML end |