Sha256: f24959c1e75a65d7786c0ee142443960ff16d9f0868bfabfeb2116cdc1218025

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'lanes/access/extension'
module Skr

    class Extension < Lanes::Extensions::Definition

        identifier "skr"
        title "Stockor"
        root_path Pathname.new(__FILE__).dirname.join("..","..").expand_path

        components 'record-finder', 'select-field', 'calendar'
        client_js_aliases({
            'SC' => 'window.Lanes.Skr.Components'
        })

        def client_bootstrap_data(view)
            gl_accounts = Skr::GlAccount.all.as_json
            {
                default_gl_account_ids: Hash[ Skr.config.default_gl_accounts.map{ |code,number|
                    account = gl_accounts.detect{|gla|gla['number'] == number}
                    [code, account ? account['id'] : 0]
                }],
                gl_accounts: gl_accounts,
                payment_terms: Skr::PaymentTerm.all.as_json,
                locations: Skr::Location.all.as_json,
                templates: Skr::Print::Template.as_json
            }
        end

        def each_static_asset
            super do | entry |
                yield entry
            end
            [ 'skr/api.js', 'skr/api.css' ].each { | asset | yield asset }
        end
    end

end

require 'skr'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stockor-0.5.0 lib/skr/extension.rb
stockor-0.4.0 lib/skr/extension.rb