Class: Card::Set::All::Follow::FollowLink
- Defined in:
- platypus/tmp/set/gem-defaults/mod028-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 'platypus/tmp/set/gem-defaults/mod028-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 'platypus/tmp/set/gem-defaults/mod028-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 'platypus/tmp/set/gem-defaults/mod028-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 'platypus/tmp/set/gem-defaults/mod028-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 'platypus/tmp/set/gem-defaults/mod028-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 'platypus/tmp/set/gem-defaults/mod028-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 'platypus/tmp/set/gem-defaults/mod028-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 38 |
# File 'platypus/tmp/set/gem-defaults/mod028-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
40 41 42 43 44 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 40 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 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 18 def modal_link icon=false opts = link_opts.merge( "data-path": link_opts[:path], "data-bs-toggle": "modal", "data-bs-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
46 47 48 49 50 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 46 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 |