summaryrefslogtreecommitdiff
path: root/vendor/javascripts/application.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/javascripts/application.coffee')
-rw-r--r--vendor/javascripts/application.coffee6
1 files changed, 6 insertions, 0 deletions
diff --git a/vendor/javascripts/application.coffee b/vendor/javascripts/application.coffee
index 54050c6..d311687 100644
--- a/vendor/javascripts/application.coffee
+++ b/vendor/javascripts/application.coffee
@@ -1,6 +1,12 @@
Batman.Filters.PrettyNumber = (num) ->
num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") unless isNaN(num)
+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();
+
class window.AllTheThings extends Batman.App
@root ->