Class: Decidim::HashtagPresenter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Decidim::HashtagPresenter
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- app/presenters/decidim/hashtag_presenter.rb
Overview
Decorator for users
Instance Method Summary collapse
- #display_hashtag ⇒ Object
- #display_hashtag_name ⇒ Object
- #hashtag_path ⇒ Object
-
#initialize(hashtag, cased_name: nil) ⇒ HashtagPresenter
constructor
A new instance of HashtagPresenter.
-
#name ⇒ Object
hashtag presented in a twitter-like style.
Constructor Details
#initialize(hashtag, cased_name: nil) ⇒ HashtagPresenter
Returns a new instance of HashtagPresenter.
11 12 13 14 |
# File 'app/presenters/decidim/hashtag_presenter.rb', line 11 def initialize(hashtag, cased_name: nil) super(hashtag) @cased_name = cased_name if cased_name&.downcase == hashtag.name end |
Instance Method Details
#display_hashtag ⇒ Object
29 30 31 |
# File 'app/presenters/decidim/hashtag_presenter.rb', line 29 def display_hashtag link_to name, decidim.search_path(term: name), target: "_blank", class: "text-secondary underline", rel: "noopener", data: { "external-link": false } end |
#display_hashtag_name ⇒ Object
33 34 35 |
# File 'app/presenters/decidim/hashtag_presenter.rb', line 33 def display_hashtag_name name end |
#hashtag_path ⇒ Object
25 26 27 |
# File 'app/presenters/decidim/hashtag_presenter.rb', line 25 def hashtag_path decidim.hashtag_path(__getobj__.name) end |
#name ⇒ Object
hashtag presented in a twitter-like style
19 20 21 |
# File 'app/presenters/decidim/hashtag_presenter.rb', line 19 def name "##{@cased_name || super}" end |