Sha256: 91598e14ca49fee51395615af3c51625e5efc046a297e037a96a39c8fe73a7ae

Contents?: true

Size: 571 Bytes

Versions: 3

Compression:

Stored size: 571 Bytes

Contents

module Cockpit
  module ViewHelper
    unless respond_to?(:c)
      def c(key)
        Cockpit::Settings.global[key]
      end
    end
    
    def setting_options(key, scope = nil)
      setting_attribute(key, :options, scope)
    end
    
    def setting_attribute(key, attribute, scope = nil)
      Cockpit::Settings.for(scope.to_s.camelize).definition(key).attributes[attribute]
    end
  end
end

::ActionView::Helpers.send(:include, Cockpit::ViewHelper) if defined?(::ActionView::Helpers)
::Sinatra.helpers.send(:helper, Cockpit::ViewHelper) if defined?(::Sinatra)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cockpit-0.2.4.4 lib/cockpit/core/view_helper.rb
cockpit-0.2.4.3 lib/cockpit/core/view_helper.rb
cockpit-0.2.4.2 lib/cockpit/core/view_helper.rb