Sha256: 75610496a0f04986f7e3a1c54f6f23ec1d4e350652295d2c26a88bbe0e820015
Contents?: true
Size: 1.23 KB
Versions: 11
Compression:
Stored size: 1.23 KB
Contents
module Netzke module Javascript module Scopes extend ActiveSupport::Concern module ClassMethods # Given class name, e.g. GridPanelLib::Components::RecordFormWindow, # returns its scope: "Components.RecordFormWindow" def js_class_name_to_scope(name) name.split("::")[0..-2].join(".") end # Top level scope which will be used to scope out Netzke classes def js_default_scope "Netzke.classes" end # Scope of this component without default scope # e.g.: GridPanelLib.Components def js_scope js_class_name_to_scope(short_component_class_name) end # Returns the scope of this component # e.g. "Netzke.classes.GridPanelLib" def js_full_scope js_scope.empty? ? js_default_scope : [js_default_scope, js_scope].join(".") end # Returns the full name of the JavaScript class, including the scopes *and* the common scope, which is # Netzke.classes. # E.g.: "Netzke.classes.Netzke.GridPanelLib.RecordFormWindow" def js_full_class_name [js_full_scope, short_component_class_name.split("::").last].join(".") end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems