Module: Kaui::AccountHelper
- Defined in:
- app/helpers/kaui/account_helper.rb
Instance Method Summary collapse
- #account_closed? ⇒ Boolean
- #billing_info_margin ⇒ Object
- #email_notifications_plugin_available? ⇒ Boolean
- #pretty_account_identifier ⇒ Object
Instance Method Details
#account_closed? ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/kaui/account_helper.rb', line 15 def account_closed? return false if @account.nil? blocking_states = @account.blocking_states('ACCOUNT','account-service','NONE', Kaui.(current_user, session)) is_account_closed = false blocking_states.each do |blocking_state| if blocking_state.state_name.eql?('CLOSE_ACCOUNT') is_account_closed = true break end end is_account_closed end |
#billing_info_margin ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/kaui/account_helper.rb', line 29 def billing_info_margin style = '' unless can?(:trigger, Kaui::Payment) && can?(:credit, Kaui::Account) && can?(:charge, Kaui::Account) style = "#{style}margin-top:15px;" end unless can? :trigger, Kaui::Invoice style = "#{style}margin-bottom:15px;" end style = "style='#{style}'" unless style.empty? style end |
#email_notifications_plugin_available? ⇒ Boolean
9 10 11 12 13 |
# File 'app/helpers/kaui/account_helper.rb', line 9 def email_notifications_plugin_available? Kenui::EmailNotificationService.email_notification_plugin_available?(Kaui.(current_user, session)).first rescue return false end |
#pretty_account_identifier ⇒ Object
4 5 6 7 |
# File 'app/helpers/kaui/account_helper.rb', line 4 def pretty_account_identifier return nil if @account.nil? @account.name.presence || @account.email.presence || truncate_uuid(@account.external_key) end |