X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fviews%2Flayout.js.coffee;h=aff7337cc6c01492a281b4504c11052d3397a698;hb=46c48b27d7ea359151135e0327d820a4891981d9;hp=18bdd1d1695a8435bda2c3376f43826caf3c7e34;hpb=4aee0b91a00feddf4b1fcd2ff3e7247efc06f451;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/views/layout.js.coffee b/app/assets/javascripts/views/layout.js.coffee index 18bdd1d1..aff7337c 100644 --- a/app/assets/javascripts/views/layout.js.coffee +++ b/app/assets/javascripts/views/layout.js.coffee @@ -8,9 +8,11 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base @operators = new Pettanr.Operator({}) @global_router = new Pettanr.GlobalRouter({operators: @operators}) @listenTo(@global_router, 'go', @body_get) + @gate = new Pettanr.BeforeUnload() @header = new Pettanr.Views.Layout.Sns.Header({parent: this}) @history = new Pettanr.Views.History({parent: this}) @listenTo(@history, 'http_get', @body_http_get) + @listenTo(@history, 'get', @body_get) @body = new Pettanr.Views.Layout.Sns.Body({parent: this}) @footer = new Pettanr.Views.Layout.Sns.Footer({parent: this}) @@ -52,9 +54,10 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base proxy.http_post('users/test') test_ok: (user, response) -> - + @history.enable() test_ng: (response) -> + @history.disable() @head_http_get('users/guest') @body_http_get('user_sessions/new') @@ -85,12 +88,13 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base @header.refresh(view) getter_proxy: () -> - proxy = new Pettanr.Proxy({operators: @operators}) + proxy = new Pettanr.Proxy({operators: @operators, gate: @gate}) @listenTo(proxy, 'ready', @body_ready) @listenTo(proxy, 'title', @body_title) @listenTo(proxy, 'title', @push_history) @listenTo(proxy, 'done', @body_done) @listenTo(proxy, 'lock', @body_lock) + @listenTo(proxy, 'unlock', @body_unlock) proxy body_http_get: (url, form) -> @@ -108,9 +112,6 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base url = Pettanr.params_to_url(params) @global_router.navigate(url, {trigger: false}) - body_lock: (params) -> - console.log('_lock') - push_history: (params, str = null) -> @history.push(params, str) @@ -126,6 +127,7 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base @listenTo(proxy, 'redirect', @body_redirect) @listenTo(proxy, 'sign_in', @sign_in) @listenTo(proxy, 'sign_out', @sign_out) + @listenTo(proxy, 'unlock', @body_unlock) proxy body_http_post: (url, form) -> @@ -144,6 +146,12 @@ class Pettanr.Views.Layout.Sns extends Pettanr.Views.Layout.Base @global_router.navigate(url) @getter_proxy().http_get(url) + body_lock: (params, form) -> + @gate.lock(params, form) + + body_unlock: (params, form) -> + @gate.unlock() + class Pettanr.Views.Layout.Blog extends Pettanr.Views.Layout.Base className: 'layout-blog'