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

Inherits:
Object
  • Object
show all
Defined in:
card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb,
card/tmpsets/set/mod026-card-mod-follow/all/follow/follow_link.rb

Direct Known Subclasses

StartFollowLink, StopFollowLink

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format) ⇒ FollowLink

Returns a new instance of FollowLink.



13
14
15
16
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 13

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



9
10
11
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 9

def action
  @action
end

#css_classObject (readonly)

Returns the value of attribute css_class.



9
10
11
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 9

def css_class
  @css_class
end

#formatObject (readonly)

Returns the value of attribute format.



9
10
11
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 9

def format
  @format
end

#hover_textObject (readonly)

Returns the value of attribute hover_text.



9
10
11
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 9

def hover_text
  @hover_text
end

Returns the value of attribute link_text.



9
10
11
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 9

def link_text
  @link_text
end

#rule_contentObject (readonly)

Returns the value of attribute rule_content.



9
10
11
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 9

def rule_content
  @rule_content
end

Instance Method Details

#buttonObject



28
29
30
31
32
33
34
35
36
37
# File 'card/tmpsets/set/mod025-card-mod-follow/all/follow/follow_link.rb', line 28

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


39
40
41
42
43
# File 'card/tmpsets/set/mod025-card-mod-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


18
19
20
21
22
23
24
25
26
# File 'card/tmpsets/set/mod025-card-mod-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


45
46
47
48
49
# File 'card/tmpsets/set/mod025-card-mod-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