Class: Card::Set::All::Follow::FollowLink

Inherits:
Object
  • Object
show all
Defined in:
platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb

Overview

handles links to follow card sets (base class)

Direct Known Subclasses

StartFollowLink, StopFollowLink

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format) ⇒ FollowLink

Returns a new instance of FollowLink.



15
16
17
18
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 15

def initialize format
  @format = format
  @card = format.card
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



11
12
13
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 11

def action
  @action
end

#css_classObject (readonly)

Returns the value of attribute css_class.



11
12
13
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 11

def css_class
  @css_class
end

#formatObject (readonly)

Returns the value of attribute format.



11
12
13
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 11

def format
  @format
end

#hover_textObject (readonly)

Returns the value of attribute hover_text.



11
12
13
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 11

def hover_text
  @hover_text
end

Returns the value of attribute link_text.



11
12
13
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 11

def link_text
  @link_text
end

#rule_contentObject (readonly)

Returns the value of attribute rule_content.



11
12
13
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 11

def rule_content
  @rule_content
end

Instance Method Details

#buttonObject



30
31
32
33
34
35
36
37
38
39
40
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 30

def button
  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


42
43
44
45
46
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 42

def link_opts success_view=:follow_status
  { title: title,
    path: path(success_view),
    class: css_class }
end


20
21
22
23
24
25
26
27
28
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 20

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


48
49
50
51
52
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/follow/follow_link.rb', line 48

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