Sha256: 47723fec01a42b9ea0a59ee89cbbcd688135d6a3c8070be30d04b52dc3e9cc4f

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require_relative '../workspace/extension'

module Lanes
    module Access
        class Extension < Lanes::Extensions::Definition

            identifier "lanes-access"

            components 'modal', 'grid', 'select-field'

            root_path Pathname.new(__FILE__).dirname.expand_path

            def stylesheet_include
                'lanes/access/styles'
            end

            def javascript_include
                'lanes/access'
            end

            def client_namespace
                'Access'
            end

            def client_paths
                []
            end
            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
            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

        end

    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lanes-0.1.8 lib/lanes/access/extension.rb
lanes-0.1.7 lib/lanes/access/extension.rb