Class: DatashiftJourney::BackLink
- Inherits:
-
Object
- Object
- DatashiftJourney::BackLink
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- lib/datashift_journey/helpers/back_link.rb
Instance Attribute Summary collapse
-
#css ⇒ Object
readonly
Returns the value of attribute css.
-
#current_request ⇒ Object
readonly
Returns the value of attribute current_request.
-
#engine_routes ⇒ Object
readonly
Returns the value of attribute engine_routes.
-
#journey_plan ⇒ Object
readonly
Returns the value of attribute journey_plan.
Instance Method Summary collapse
-
#initialize(request, engine_routes:, journey_plan: nil, css: nil) ⇒ BackLink
constructor
A new instance of BackLink.
- #tag(text = nil, html_opts = {}) ⇒ Object
Constructor Details
#initialize(request, engine_routes:, journey_plan: nil, css: nil) ⇒ BackLink
Returns a new instance of BackLink.
12 13 14 15 16 17 |
# File 'lib/datashift_journey/helpers/back_link.rb', line 12 def initialize(request, engine_routes:, journey_plan: nil, css: nil) @current_request = request @engine_routes = engine_routes @journey_plan = journey_plan @css = css end |
Instance Attribute Details
#css ⇒ Object (readonly)
Returns the value of attribute css.
10 11 12 |
# File 'lib/datashift_journey/helpers/back_link.rb', line 10 def css @css end |
#current_request ⇒ Object (readonly)
Returns the value of attribute current_request.
10 11 12 |
# File 'lib/datashift_journey/helpers/back_link.rb', line 10 def current_request @current_request end |
#engine_routes ⇒ Object (readonly)
Returns the value of attribute engine_routes.
10 11 12 |
# File 'lib/datashift_journey/helpers/back_link.rb', line 10 def engine_routes @engine_routes end |
#journey_plan ⇒ Object (readonly)
Returns the value of attribute journey_plan.
10 11 12 |
# File 'lib/datashift_journey/helpers/back_link.rb', line 10 def journey_plan @journey_plan end |
Instance Method Details
#tag(text = nil, html_opts = {}) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/datashift_journey/helpers/back_link.rb', line 19 def tag(text = nil, html_opts = {}) if journey_plan && (journey_plan.can_back?) title, url = link_arguments(text) link_to title, url, html_opts.merge(class: css || 'journey-plan-back-link') end end |