Class: Lanes::Access::Extension

Inherits:
Extensions::Definition show all
Defined in:
lib/lanes/access/extension.rb

Instance Attribute Summary

Attributes inherited from Extensions::Definition

#context

Instance Method Summary collapse

Methods inherited from Extensions::Definition

components, #each_static_asset, inherited, #on_boot, #route, #static_paths

Instance Method Details

#client_bootstrap_data(view) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/lanes/access/extension.rb', line 36

def client_bootstrap_data(view)
    data = { roles: roles_for_client }
    if (user_id = view.session['user_id']) && (user = Lanes::User.where( id: user_id ).first)
        data.merge!(user.workspace_data)
    end
    data
end

#client_namespaceObject



21
22
23
# File 'lib/lanes/access/extension.rb', line 21

def client_namespace
    'Access'
end

#client_pathsObject



25
26
27
# File 'lib/lanes/access/extension.rb', line 25

def client_paths
    []
end

#javascript_includeObject



17
18
19
# File 'lib/lanes/access/extension.rb', line 17

def javascript_include
    'lanes/access'
end

#roles_for_clientObject



28
29
30
31
32
33
34
35
# File 'lib/lanes/access/extension.rb', line 28

def roles_for_client
    Lanes::Access::Role.all_available.map do |role|
        {
          id: role.to_s.demodulize.underscore,
          name: role.to_s.demodulize
        }
    end
end

#stylesheet_includeObject



13
14
15
# File 'lib/lanes/access/extension.rb', line 13

def stylesheet_include
    'lanes/access/styles'
end