OSDN Git Service

redraw page title
[pettanr/pettanr.git] / app / assets / javascripts / pettanr.js.coffee
index 0ad5f44..966bcb5 100644 (file)
@@ -143,6 +143,28 @@ class Pettanr
       )\r
       false\r
     \r
+    set_play: () ->\r
+      @set_list()\r
+      @binder_controller = Manifest.manifest().controllers[@params['controller']]\r
+      @binder_model = Manifest.manifest().models[@binder_controller.item_name]\r
+      @binder_model_class = @binder_model.classify()\r
+      @item = new @binder_model_class({id: @params['id']})\r
+    \r
+    play_list: () ->\r
+      _this = this\r
+      opt = {\r
+        id: @params['id'], \r
+        offset: @params['offset'], \r
+        count: @params['count'], \r
+        page: @params['page'], \r
+        page_size: @params['page_size']\r
+      }\r
+      @item.fetch({cache: true}).done ->\r
+        _this.list.open(_this.operators, opt, _this.my_action, {}, (page_status) ->\r
+          console.log _this.list.models\r
+        )\r
+        false\r
+    \r
     show_prof: () ->\r
       _this = this\r
       @item.fetch({cache: true}).done ->\r
@@ -153,6 +175,7 @@ class Pettanr
           operators: _this.operators\r
         })\r
         $("#pettanr").html(profiler.render().el)\r
+        _this.redraw_title(_this.params)\r
     \r
     set_new: () ->\r
       @set_model()\r
@@ -187,6 +210,11 @@ class Pettanr
     form_edit: () ->\r
       @set_edit()\r
     \r
+    redraw_title: (params, str = null) ->\r
+      t = str || I18n.t(params['controller'] + '.' + params['action'] + '.title')\r
+      site_caption = Manifest.manifest().magic_numbers.profile.users.caption\r
+      $(document).attr('title', t + ' - ' + site_caption)\r
+    \r
   class Pettanr.FilerRender\r
     constructor: (item_name, list_result, pager_type, operators) ->\r
       @item_name = item_name\r