OSDN Git Service

add profiler
[pettanr/pettanr.git] / app / assets / javascripts / pettanr.js.coffee
index 3c45a75..c5ed2df 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr\r
+  # Foo.class -> Pettanr[@constructor.name]\r
+\r
   @is_blank: (str) ->\r
     !str?.trim()\r
   \r
@@ -39,8 +41,11 @@ class Pettanr
         if l.length == 1\r
           I18n.t('activerecord.models.' + Pettanr[label].item_name())\r
         else\r
-          I18n.t('activerecord.models.attribtes.' + Pettanr[l.first].item_name() + '.' + l.last)\r
+          Pettanr.AppHelper.t_a(Pettanr[l.first].item_name(), l.last)\r
     \r
+    @t_a: (item_name, attr_name) ->\r
+      I18n.t('activerecord.attributes.' + item_name + '.' + attr_name)\r
+      \r
     @t_select_items: (items) ->\r
       _.map items, (i) ->\r
         [t(i[0]), i[1]]\r
@@ -130,8 +135,8 @@ class Pettanr
         '?' + q.join('&')\r
       else\r
         ''\r
-      @url = '/' + params['controller'] + i + a + qry\r
-      @total = new Pettanr.CounterModel({}, {url: '/' + params['controller'] + i + 'count_' + a})\r
+      @url = '/' + params['controller'] + '/' + i + a + qry\r
+      @total = new Pettanr.CounterModel({}, {url: '/' + params['controller'] + '/' + i + 'count_' + a})\r
       @model = options['model']\r
   \r
   class Pettanr.AppController\r