From fa5d8d772b6cf2506efb0b8e1aa58e035da2e264 Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 23 Jun 2014 16:18:43 +0100 Subject: [PATCH] Integrate getName changes from @bielfrontera See https://github.com/Shopify/dashing/pull/310 --- javascripts/dashing.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index 2473ba0e..a7247cbf 100644 --- a/javascripts/dashing.coffee +++ b/javascripts/dashing.coffee @@ -34,7 +34,7 @@ Dashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1)); class Dashing.Widget extends Batman.View constructor: -> # Set the view path - @constructor::source = Batman.Filters.underscore(@constructor.name) + @constructor::source = Batman.Filters.underscore(getName()) super @mixin($(@node).data()) @@ -62,6 +62,11 @@ class Dashing.Widget extends Batman.View onData: (data) => # Widgets override this to handle incoming data + getName: () => + funcNameRegex = /function ([^\(]{1,})\(/; + results = (funcNameRegex).exec(@constructor.toString()) + if (results && results.length > 1) then results[1].trim() else "" + Dashing.AnimatedValue = get: Batman.Property.defaultAccessor.get set: (k, to) ->