Sha256: 08e213eec921f571dea3450c960f400a9814a681201aad4bdaec46d4612c99c8

Contents?: true

Size: 1.91 KB

Versions: 10

Compression:

Stored size: 1.91 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class All
# Set: All cards (Follow)
#
#! no set module
module Follow;
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/follow/set/all/follow/follow_link.rb"; end
class FollowLink
  attr_reader :format, :rule_content, :link_text, :action, :css_class, :hover_text

  delegate :link_to, to: :format

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

  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

  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

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

  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

  private

  def mark
    @card.follow_set_card.follow_rule_name Auth.current.name
  end

  def path view=:follow_status
    @format.path mark: mark,
                 action: :update,
                 success: { id: @card.name, view: view },
                 card: { content: "[[#{rule_content}]]" }
  end

  def title
    "#{action} emails about changes to #{@card.follow_label}"
  end
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card/mod/follow/set/all/follow/follow_link.rb ~~

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
card-1.100.0 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.99.4 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.99.3 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.99.2 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.99.1 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.99.0 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.98.3 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.98.2 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.98.1 tmpsets/set/mod017-follow/all/follow/follow_link.rb
card-1.98.0 tmpsets/set/mod017-follow/all/follow/follow_link.rb