Sha256: 4509358d9de456bafe5a2dddddcfff8f23fff3efc18a10572bc6d1908b76fd51

Contents?: true

Size: 1.59 KB

Versions: 9

Compression:

Stored size: 1.59 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class Right
# Set: All "+Following" cards
#
module Following;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/follow/set/right/following.rb"; end
def virtual?
  !real?
end

module HtmlFormat; parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
  view :core do
    if card.left && Auth.signed_in?
      render_rule_editor
    else
      nest Card.fetch(card.name.left, :followers), view: :titled, items: { view: :link }
    end
  end

  view :status do
    if (rcard = current_follow_rule_card)
      rcard.item_cards.map do |item|
        %(<div class="alert alert-success" role="alert">
          <strong>#{rcard.rule_set.follow_label}</strong>: #{item.title}
         </div>)
      end.join
    else
      "No following preference"
    end
  end

  view :closed_content do
    ""
  end

  view :rule_editor, cache: :never do
    rule_context = Card.fetch preference_name, new: { type_id: PointerID }
    wrap_with :div, class: "edit-rule" do
      follow_context = current_follow_rule_card || rule_context
      subformat(follow_context).rule_form :open, rule_context, :modal
    end
  end

  def preference_name
    set_name = card.left.follow_set_card.name
    Card::Name[set_name, Auth.current.name, :follow]
  end

  def edit_rule_success
    { view: "status", id: card.name.url_key }
  end

  def current_follow_rule_card
    card.left.rule_card :follow, user: Auth.current
  end
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card/mod/follow/set/right/following.rb ~~

Version data entries

9 entries across 9 versions & 1 rubygems

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