From 8e14229951405d18d1e206c2dabaeeb7644a42e0 Mon Sep 17 00:00:00 2001 From: David Rubin Date: Thu, 8 Aug 2013 11:25:07 +0200 Subject: Handle widgets with multiple capital letters This change allows widgets to have names like AwesomeWidgetYes and it will be given awesome-widget-yes instead of awesome-widget_yes --- javascripts/dashing.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee index 5712e98..d24bf54 100644 --- a/javascripts/dashing.coffee +++ b/javascripts/dashing.coffee @@ -11,7 +11,7 @@ Batman.Filters.dashize = (str) -> dashes_rx1 = /([A-Z]+)([A-Z][a-z])/g; dashes_rx2 = /([a-z\d])([A-Z])/g; - return str.replace(dashes_rx1, '$1_$2').replace(dashes_rx2, '$1_$2').replace('_', '-').toLowerCase() + return str.replace(dashes_rx1, '$1_$2').replace(dashes_rx2, '$1_$2').replace(/_/g, '-').toLowerCase() Batman.Filters.shortenedNumber = (num) -> return num if isNaN(num) -- cgit v1.2.3