Sha256: 5ace3dd8cf507bc11454e56ed299658f1dfb07054d9166265e6f574a440799e4

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 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/ezl5238/dev/decko/gem/mod/follow/set/right/following.rb"; end
def virtual?
  new?
end

module HtmlFormat; module_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 :one_line_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.preference :follow
  end
end
end;end;end;end;
# ~~ generated from /Users/ezl5238/dev/decko/gem/mod/follow/set/right/following.rb ~~

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
card-1.102.0 tmpsets/set/mod026-follow/right/following.rb