Sha256: 24458ab6d0e0d2d2a78cf77e2dc0134f1dd9a66dbbbe6100ce7f62cceea379f9

Contents?: true

Size: 1.04 KB

Versions: 83

Compression:

Stored size: 1.04 KB

Contents

require 'slim'
require 'cm_admin/version'
require 'cm_admin/engine'
require 'cm_admin/model'
require 'cm_admin/view_helpers'
require 'cm_admin/utils'
require 'cm_admin/configuration'

module CmAdmin
  class Error < StandardError; end

  mattr_accessor :layout, :authorized_roles
  mattr_accessor :included_models, :cm_admin_models
  @@authorized_roles ||= []
  @@included_models ||= []
  @@cm_admin_models ||= []

  class << self

    def webpacker
      @webpacker ||= ::Webpacker::Instance.new(
        root_path: CmAdmin::Engine.root,
        config_path: CmAdmin::Engine.root.join('config', 'webpacker.yml')
      )
    end

    def configure(&block)
      # instance_eval(&block)
      @config ||= Configuration.new
      yield(@config)
    end

    def layout
    end

    def config
      @config ||= Configuration.new
    end

    def initialize_model(entity, &block)
      if entity.is_a?(Class)
        return if CmAdmin::Model.find_by({name: entity.name})
        config.cm_admin_models << CmAdmin::Model.new(entity, &block)
      end
    end
  end

end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
cm-admin-1.5.47 lib/cm_admin.rb
cm-admin-1.5.46 lib/cm_admin.rb
cm-admin-1.5.45 lib/cm_admin.rb
cm-admin-1.5.44 lib/cm_admin.rb
cm-admin-1.5.43 lib/cm_admin.rb
cm-admin-1.5.42 lib/cm_admin.rb
cm-admin-1.5.41 lib/cm_admin.rb
cm-admin-1.5.40 lib/cm_admin.rb
cm-admin-1.5.39 lib/cm_admin.rb
cm-admin-1.5.38 lib/cm_admin.rb
cm-admin-1.5.37 lib/cm_admin.rb
cm-admin-1.5.36 lib/cm_admin.rb
cm-admin-1.5.35 lib/cm_admin.rb
cm-admin-1.5.34 lib/cm_admin.rb
cm-admin-1.5.33 lib/cm_admin.rb
cm-admin-1.5.32 lib/cm_admin.rb
cm-admin-1.5.31 lib/cm_admin.rb
cm-admin-1.5.30 lib/cm_admin.rb
cm-admin-1.5.29 lib/cm_admin.rb
cm-admin-1.5.28 lib/cm_admin.rb