Class: Reativo::Cell::Theme

Inherits:
Trailblazer::Cell
  • Object
show all
Includes:
ActionView::Helpers::CspHelper, ActionView::Helpers::CsrfHelper, React::Rails::ViewHelper, Webpacker::Helper
Defined in:
app/models/reativo/cell/theme.rb

Instance Method Summary collapse

Instance Method Details

#content_security_policy?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/reativo/cell/theme.rb', line 12

def content_security_policy?
  context[:controller].send(:content_security_policy?)
end

#current_userObject



30
31
32
# File 'app/models/reativo/cell/theme.rb', line 30

def current_user
  context[:controller].current_user
end

#flash_messages(opts = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'app/models/reativo/cell/theme.rb', line 20

def flash_messages(opts = {})
  flash_messages = []
  controller.flash.each do |type, message|
    type = 'success' if type == 'notice'
    type = 'error'   if type == 'alert'
    flash_messages << {title: message, type: type} if message
  end
  flash_messages
end

#form_authenticity_tokenObject



16
17
18
# File 'app/models/reativo/cell/theme.rb', line 16

def form_authenticity_token
  context[:controller].send(:form_authenticity_token)
end

#protect_against_forgery?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/models/reativo/cell/theme.rb', line 8

def protect_against_forgery?
  context[:controller].send(:protect_against_forgery?)
end