src/core/registry.coffee in luca-0.9.2 vs src/core/registry.coffee in luca-0.9.4
- old
+ new
@@ -59,14 +59,28 @@
# the basis of Luca's in browser development tools.
Luca.registry.namespaces = (resolve=true)->
_( registry.namespaces ).map (namespace)->
if resolve then Luca.util.resolve( namespace ) else namespace
+Luca.registry.aliases =
+ grid: "grid_view"
+ form: "form_view"
+ text: "text_field"
+ button: "button_field"
+ select: "select_field"
+ card: "card_view"
+ paged: "card_view"
+ wizard: "card_view"
+ collection: "collection_view"
+
# Lookup a component in the Luca component registry
# by it's ctype identifier. If it doesn't exist,
# check any other registered namespace
Luca.registry.lookup = (ctype)->
+ if alias = Luca.registry.aliases[ ctype ]
+ ctype = alias
+
c = registry.classes[ctype]
return c if c?
className = Luca.util.classify(ctype)
@@ -74,16 +88,19 @@
parents = Luca.registry.namespaces()
fullPath = _( parents ).chain().map((parent)->
parent[className]).compact().value()?[0]
+Luca.registry.instances = ()->
+ _( component_cache.cid_index ).values()
+
Luca.registry.findInstancesByClassName = (className)->
- instances = _( component_cache.cid_index ).values()
+ instances = Luca.registry.instances()
_( instances ).select (instance)->
instance.displayName is className or instance._superClass?()?.displayName is className
Luca.registry.classes = (toString=false)->
- _( registry.classes ).map (className, ctype)->
+ _(_.extend({},registry.classes,registry.model_classes,registry.collection_classes)).map (className, ctype)->
if toString
className
else
className: className
ctype: ctype