Module: Card::Set::Right::Follow

Extended by:
Card::Set
Defined in:
platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb

Overview

While the user follow dashboard ([User]+:follow`) is also in this Set, its

Defined Under Namespace

Modules: HtmlFormat

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Constants included from Event::Api

Event::Api::OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Card::Set

reset

Methods included from I18nScope

#mod_name, #scope

Methods included from Card::Set::Registrar

#extended, #finalize_load, #process_base_modules, #register_set

Methods included from Helpers

#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name

Methods included from AdvancedApi

#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



9
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 9

def self.source_location; "/Users/ethan/dev/decko/gem/mod/follow/set/right/follow.rb"; end

Instance Method Details

#add_follow_item?(condition) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 30

def add_follow_item? condition
  new_card? || !include_item?(condition)
end

#allowed_to_change_follow_status?Boolean

Returns:

  • (Boolean)


58
59
60
61
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 58

def allowed_to_change_follow_status?
  Auth.signed_in? &&
    ((user = rule_user) && Auth.current_id == user.id) || Auth.always_ok?
end

#event: cache_expired_for_new_preferenceObject



14
15
16
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 14

event :cache_expired_for_new_preference, :integrate, when: :preference? do
  Card.follow_caches_expired
end

#ok_to_create?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 38

def ok_to_create?
  permit :create
end

#ok_to_update?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 34

def ok_to_update?
  permit :update
end

#option_cardsObject



18
19
20
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 18

def option_cards
  Card::FollowOption.cards.compact
end

#options_cardObject



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

def options_card
  Card.new(
    name: "follow_options_card",
    type: :list,
    content: option_cards.map { |oc| "[[#{oc.name}]]" }.join("\n")
  )
end

#permit(action, verb = nil) ⇒ Object



50
51
52
53
54
55
56
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 50

def permit action, verb=nil
  if action.in?(%i[create delete update]) && allowed_to_change_follow_status?
    true
  else
    super action, verb
  end
end

#raw_help_textObject

def ok_to_delete? permit :delete end



46
47
48
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/follow.rb', line 46

def raw_help_text
  "Get notified about changes"
end