Class: Card::Set::All::Follow::FollowLink
- Inherits:
-
Object
- Object
- Card::Set::All::Follow::FollowLink
- Defined in:
- tmpsets/set/mod017-follow/all/follow/follow_link.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#css_class ⇒ Object
readonly
Returns the value of attribute css_class.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#hover_text ⇒ Object
readonly
Returns the value of attribute hover_text.
-
#link_text ⇒ Object
readonly
Returns the value of attribute link_text.
-
#rule_content ⇒ Object
readonly
Returns the value of attribute rule_content.
Instance Method Summary collapse
- #button ⇒ Object
-
#initialize(format) ⇒ FollowLink
constructor
A new instance of FollowLink.
- #link_opts(success_view = :follow_status) ⇒ Object
- #modal_link(icon = false) ⇒ Object
- #render_link_text(icon = false) ⇒ Object
Constructor Details
#initialize(format) ⇒ FollowLink
Returns a new instance of FollowLink.
13 14 15 16 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 13 def initialize format @format = format @card = format.card end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
9 10 11 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 9 def action @action end |
#css_class ⇒ Object (readonly)
Returns the value of attribute css_class.
9 10 11 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 9 def css_class @css_class end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
9 10 11 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 9 def format @format end |
#hover_text ⇒ Object (readonly)
Returns the value of attribute hover_text.
9 10 11 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 9 def hover_text @hover_text end |
#link_text ⇒ Object (readonly)
Returns the value of attribute link_text.
9 10 11 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 9 def link_text @link_text end |
#rule_content ⇒ Object (readonly)
Returns the value of attribute rule_content.
9 10 11 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 9 def rule_content @rule_content end |
Instance Method Details
#button ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 28 def opts = link_opts(:follow_section).merge( remote: true, class: @format.css_classes("follow-link", link_opts[:class], "slotter btn btn-sm btn-primary") ) opts["data-update-foreign-slot"] = ".d0-card-body > .card-slot.RIGHT-Xfollower.content-view" opts["data-hover-text"] = hover_text if hover_text link_to render_link_text, opts end |
#link_opts(success_view = :follow_status) ⇒ Object
39 40 41 42 43 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 39 def link_opts success_view=:follow_status { title: title, path: path(success_view), class: css_class } end |
#modal_link(icon = false) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 18 def modal_link icon=false opts = link_opts.merge( "data-path": link_opts[:path], "data-toggle": "modal", "data-target": "#modal-#{card.name.safe_key}", class: css_classes("follow-link", link_opts[:class]) ) link_to render_link_text(icon), opts end |
#render_link_text(icon = false) ⇒ Object
45 46 47 48 49 |
# File 'tmpsets/set/mod017-follow/all/follow/follow_link.rb', line 45 def render_link_text icon=false verb = %(<span class="follow-verb">#{link_text}</span>) icon = icon ? icon_tag(:flag) : "" [icon, verb].compact.join.html_safe end |