You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/07/22 02:32:24 UTC
git commit: Add enable/disable buttons for the client console -
disabled console displays no alerts, but still collects them
Updated Branches:
refs/heads/master 3821f3873 -> 4fd664d76
Add enable/disable buttons for the client console
- disabled console displays no alerts, but still collects them
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/4fd664d7
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/4fd664d7
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/4fd664d7
Branch: refs/heads/master
Commit: 4fd664d76b91f317263a3ff44ae066a6f96eee2e
Parents: 3821f38
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 17:32:11 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 17:32:11 2013 -0700
----------------------------------------------------------------------
.../META-INF/modules/t5/core/console.coffee | 28 +++++++++++++++++---
1 file changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fd664d7/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 573a5d3..4eaf6b6 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -50,17 +50,37 @@ define ["./dom", "underscore"],
"""
<div class="console-backdrop"></div>
<div class="alert-container"></div>
- <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+ <button data-action="clear" class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+ <button data-action="enable" class="btn btn-mini" disabled="true"><i class="icon-play"></i> Enable Console</button>
+ <button data-action="disable" class="btn btn-mini"><i class="icon-pause"></i> Disable Console</button>
"""
dom.body.prepend floatingConsole
alertContainer = floatingConsole.findFirst ".alert-container"
- floatingConsole.on "click", ".btn-mini", ->
+ floatingConsole.on "click", "[data-action=clear]", ->
floatingConsole.hide()
alertContainer.update ""
+ floatingConsole.on "click", "[data-action=disable]", ->
+
+ @attribute "disabled", true
+ floatingConsole.findFirst("[data-action=enable]").attribute "disabled", false
+
+ alertContainer.hide()
+
+ return false
+
+ floatingConsole.on "click", "[data-action=enable]", ->
+
+ @attribute "disabled", true
+ floatingConsole.findFirst("[data-action=disable]").attribute "disabled", false
+
+ alertContainer.show()
+
+ return false
+
div = dom.create
class: "alert #{className}"
"""
@@ -75,7 +95,6 @@ define ["./dom", "underscore"],
_.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
animating = false
- removed = false
runFadeout = ->
return if animating
@@ -84,7 +103,8 @@ define ["./dom", "underscore"],
div.fadeOut FADE_DURATION, ->
dom.withReflowEventsDisabled ->
- div.remove() unless removed
+ # Remove if not already removed
+ div.remove() if div.parent()
# Hide the console after the last one is removed.
unless floatingConsole.findFirst(".alert")