Module: Card::Set::Right::Follow
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod017-follow/right/follow.rb
Overview
While the user follow dashboard ([User]+:follow`) is also in this Set, its
Defined Under Namespace
Modules: HtmlFormat
Class Method Summary collapse
Instance Method Summary collapse
- #add_follow_item?(condition) ⇒ Boolean
- #allowed_to_change_follow_status? ⇒ Boolean
- #ok_to_create ⇒ Object
- #ok_to_delete ⇒ Object
- #ok_to_update ⇒ Object
- #option_cards ⇒ Object
- #options_rule_card ⇒ Object
- #permit(action, verb = nil) ⇒ Object
Methods included from I18nScope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore
Methods included from AdvancedApi
#attachment, #ensure_set, #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
Class Method Details
.source_location ⇒ Object
9 |
# File 'tmpsets/set/mod017-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
28 29 30 |
# File 'tmpsets/set/mod017-follow/right/follow.rb', line 28 def add_follow_item? condition new_card? || !include_item?(condition) end |
#allowed_to_change_follow_status? ⇒ Boolean
52 53 54 55 |
# File 'tmpsets/set/mod017-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 |
#ok_to_create ⇒ Object
36 37 38 |
# File 'tmpsets/set/mod017-follow/right/follow.rb', line 36 def ok_to_create permit :create end |
#ok_to_delete ⇒ Object
40 41 42 |
# File 'tmpsets/set/mod017-follow/right/follow.rb', line 40 def ok_to_delete permit :delete end |
#ok_to_update ⇒ Object
32 33 34 |
# File 'tmpsets/set/mod017-follow/right/follow.rb', line 32 def ok_to_update permit :update end |
#option_cards ⇒ Object
16 17 18 |
# File 'tmpsets/set/mod017-follow/right/follow.rb', line 16 def option_cards Card::FollowOption.cards.compact end |
#options_rule_card ⇒ Object
20 21 22 23 24 25 26 |
# File 'tmpsets/set/mod017-follow/right/follow.rb', line 20 def 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 'tmpsets/set/mod017-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 |