Module: Card::Set::Right::Account
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-defaults/mod028-follow/right/account.rb,
platypus/tmp/set/gem-defaults/mod014-account/right/account.rb,
platypus/tmp/set/gem-defaults/mod021-api_key/right/account.rb,
platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb,
platypus/tmp/set/gem-defaults/mod014-account/right/account/events.rb
Overview
Set: All “+Account” cards
Defined Under Namespace
Modules: Events, HtmlFormat, Views
Constant Summary collapse
- STATUS_OPTIONS =
%w[unapproved unverified active blocked].freeze
Constants included from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included from Event::Api
Class Method Summary collapse
Instance Method Summary collapse
-
#accounted ⇒ Object
-
#accounted_id ⇒ Object
-
#changes_visible?(act) ⇒ Boolean
-
#current_account? ⇒ Boolean
-
#ok_to_read? ⇒ Boolean
-
#ok_to_update? ⇒ Boolean
allow account owner to update account field content.
-
#own_account? ⇒ Boolean
-
#send_account_email(email_template) ⇒ Object
-
#send_change_notice(act, followed_set, follow_option) ⇒ Object
Methods included from Card::Set
Methods included from I18nScope
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
Class Method Details
.source_location ⇒ Object
7 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/account.rb', line 7 def self.source_location; "/Users/ethan/dev/decko/gem/mod/follow/set/right/account.rb"; end |
Instance Method Details
#accounted ⇒ Object
27 28 29 |
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account.rb', line 27 def accounted left end |
#accounted_id ⇒ Object
31 32 33 |
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account.rb', line 31 def accounted_id left_id end |
#changes_visible?(act) ⇒ Boolean
16 17 18 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/account.rb', line 16 def changes_visible? act act.actions_affecting(act.card).any? { |action| action.card.ok? :read } end |
#current_account? ⇒ Boolean
23 24 25 |
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account.rb', line 23 def current_account? accounted&.try :current_account? end |
#ok_to_read? ⇒ Boolean
35 36 37 |
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account.rb', line 35 def ok_to_read? own_account? || super end |
#ok_to_update? ⇒ Boolean
allow account owner to update account field content
40 41 42 |
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account.rb', line 40 def ok_to_update? (own_account? && !name_changed? && !type_id_changed?) || super end |
#own_account? ⇒ Boolean
19 20 21 |
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account.rb', line 19 def own_account? accounted&.try :own_account? end |
#send_account_email(email_template) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account.rb', line 44 def send_account_email email_template ecard = Card[email_template] unless ecard&.type_id == EmailTemplateID raise Card::Error, "invalid email template: #{email_template}" end ecard.deliver self, to: email end |
#send_change_notice(act, followed_set, follow_option) ⇒ Object
8 9 10 11 12 13 14 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/right/account.rb', line 8 def send_change_notice act, followed_set, follow_option return unless email.present? && changes_visible?(act) notify_of_act act do { follower: left.name, followed_set: followed_set, follow_option: follow_option } end end |