OSDN Git Service

add: short cut
[pettanr/pettanr.git] / app / assets / javascripts / views / layout.js.coffee
index aff7337..0d984b7 100644 (file)
@@ -5,8 +5,7 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base
   className: 'layout-sns'\r
   \r
   initialize: (options) ->\r
-    @operators = new Pettanr.Operator({})\r
-    @global_router = new Pettanr.GlobalRouter({operators: @operators})\r
+    @global_router = new Pettanr.GlobalRouter({})\r
     @listenTo(@global_router, 'go', @body_get)\r
     @gate = new Pettanr.BeforeUnload()\r
     @header = new Pettanr.Views.Layout.Sns.Header({parent: this})\r
@@ -29,24 +28,22 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base
   init_operators: (user) ->\r
     author = new Pettanr.Author(user.get('author')) if user.get('author')\r
     artist = new Pettanr.Artist(user.get('artist')) if user.get('artist')\r
-    @operators.init({\r
+    Pettanr.cache.operators.init({\r
       user: user, \r
       author: author, \r
       artist: artist\r
     })\r
-    @global_router.operators = @operators\r
   \r
   reset_operators: () ->\r
-    @operators.init({\r
+    Pettanr.cache.operators.init({\r
       user: null, \r
       author: null, \r
       artist: null\r
     })\r
-    @global_router.operators = @operators\r
   \r
   start: () ->\r
     # check current user signed in?\r
-    proxy = new Pettanr.Proxy({operators: @operators})\r
+    proxy = new Pettanr.Proxy({})\r
     @listenTo(proxy, 'redirect', @test_redirect)\r
     # @listenTo(proxy, 'success', @test_ok)\r
     @listenTo(proxy, 'fail', @test_ng)\r
@@ -78,7 +75,7 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base
     @history.disable()\r
   \r
   head_http_get: (url) ->\r
-    proxy = new Pettanr.Proxy({operators: @operators})\r
+    proxy = new Pettanr.Proxy({})\r
     @listenTo(proxy, 'ready', @head_ready)\r
     proxy.http_get(url, null)\r
   \r
@@ -88,13 +85,15 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base
     @header.refresh(view)\r
   \r
   getter_proxy: () ->\r
-    proxy = new Pettanr.Proxy({operators: @operators, gate: @gate})\r
+    proxy = new Pettanr.Proxy({gate: @gate})\r
     @listenTo(proxy, 'ready', @body_ready)\r
     @listenTo(proxy, 'title', @body_title)\r
     @listenTo(proxy, 'title', @push_history)\r
     @listenTo(proxy, 'done', @body_done)\r
+    @listenTo(proxy, 'deny', @body_deny)\r
     @listenTo(proxy, 'lock', @body_lock)\r
     @listenTo(proxy, 'unlock', @body_unlock)\r
+    @listenTo(proxy, 'cancel', @cancel)\r
     proxy\r
   \r
   body_http_get: (url, form) ->\r
@@ -121,12 +120,13 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base
     $(document).attr('title', t + ' - ' + site_caption)\r
   \r
   poster_proxy: () ->\r
-    proxy = new Pettanr.Proxy({operators: @operators})\r
+    proxy = new Pettanr.Proxy({})\r
     @listenTo(proxy, 'success', @body_success)\r
     @listenTo(proxy, 'fail', @body_fail)\r
     @listenTo(proxy, 'redirect', @body_redirect)\r
     @listenTo(proxy, 'sign_in', @sign_in)\r
     @listenTo(proxy, 'sign_out', @sign_out)\r
+    @listenTo(proxy, 'deny', @body_deny)\r
     @listenTo(proxy, 'unlock', @body_unlock)\r
     proxy\r
   \r
@@ -146,12 +146,17 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base
     @global_router.navigate(url)\r
     @getter_proxy().http_get(url)\r
   \r
+  body_deny: (params, form, safe_url) ->\r
+    @getter_proxy().http_get(safe_url, params, form)\r
+  \r
   body_lock: (params, form) ->\r
     @gate.lock(params, form)\r
   \r
   body_unlock: (params, form) ->\r
     @gate.unlock()\r
   \r
+  cancel: (params, form) ->\r
+  \r
 class Pettanr.Views.Layout.Blog extends Pettanr.Views.Layout.Base\r
   className: 'layout-blog'\r
   \r
@@ -162,9 +167,7 @@ class Pettanr.Views.Layout.Blog extends Pettanr.Views.Layout.Base
     @body.navigate('top/demo')\r
   \r
   sign_in_fail: (user, response) ->\r
-    view = new Pettanr.Views.UserSeeeion.New({\r
-      operators: @operators\r
-    })\r
+    view = new Pettanr.Views.UserSeeeion.New({})\r
     view.render()\r
     @body.navigate('top/demo')\r
   \r