Module: BackMark::ViewMethods
- Defined in:
- lib/back_mark.rb
Instance Method Summary collapse
-
#back_label ⇒ Object
Returns the last back_marked label.
-
#back_url ⇒ Object
Returns the last back_marked page url.
-
#back_url_or_default(default_url) ⇒ Object
Returns the stored back url or the given default_url if the former is empty.
-
#render_back_link ⇒ Object
Renders a link back to the previous page stored in the session with the stored label if both of them are available.
Instance Method Details
#back_label ⇒ Object
Returns the last back_marked label
115 116 117 |
# File 'lib/back_mark.rb', line 115 def back_label @back_marked ? session[:back_label] : session[:prev_label] end |
#back_url ⇒ Object
Returns the last back_marked page url
110 111 112 |
# File 'lib/back_mark.rb', line 110 def back_url @back_marked ? session[:back_url] : session[:prev_url] end |
#back_url_or_default(default_url) ⇒ Object
Returns the stored back url or the given default_url if the former is empty
104 105 106 107 |
# File 'lib/back_mark.rb', line 104 def back_url_or_default(default_url) (@marked_in_filter ? session[:filter_back_url] : session[:filter_prev_url]) || default_url end |
#render_back_link ⇒ Object
Renders a link back to the previous page stored in the session with the stored label if both of them are available
122 123 124 125 126 127 128 129 |
# File 'lib/back_mark.rb', line 122 def render_back_link # Dont render back link if the back url is the same as the current page return if back_url == request.url if back_url && back_label link_to "« Back to '#{back_label}'", back_url, :id => 'back_link' end end |