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

Extended by:
Card::Set
Defined in:
card/tmpsets/set/mod025-card-mod-follow/right/follow.rb,
card/tmpsets/set/mod035-card-mod-search/right/follow.rb,
card/tmpsets/set/mod026-card-mod-follow/right/follow.rb,
card/tmpsets/set/mod036-card-mod-search/right/follow.rb

Overview

Set: All “+Follow” cards

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_modules

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore

Methods included from AdvancedApi

#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 Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

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 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 9

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

Instance Method Details

#add_follow_item?(condition) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 28

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

#allowed_to_change_follow_status?Boolean

Returns:

  • (Boolean)


52
53
54
55
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 52

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

customizations are handled in TypePlusRight::User::Follow



12
13
14
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 12

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

#ok_to_createObject



36
37
38
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 36

def ok_to_create
  permit :create
end

#ok_to_deleteObject



40
41
42
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 40

def ok_to_delete
  permit :delete
end

#ok_to_updateObject



32
33
34
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 32

def ok_to_update
  permit :update
end

#option_cardsObject



16
17
18
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 16

def option_cards
  Card::FollowOption.cards.compact
end

#options_rule_cardObject



20
21
22
23
24
25
26
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 20

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

#permit(action, verb = nil) ⇒ Object



44
45
46
47
48
49
50
# File 'card/tmpsets/set/mod025-card-mod-follow/right/follow.rb', line 44

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

#raw_help_textObject



8
9
10
# File 'card/tmpsets/set/mod035-card-mod-search/right/follow.rb', line 8

def raw_help_text
  "Get notified about changes"
end