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/23 01:57:29 UTC
[2/8] git commit: Improve the floating console: - Fixed background in
"Tapestry Green" - Round the top corners - Use monospaced text (not Alerts) -
Keep history until manually cleared - Limit height to 200px
Improve the floating console:
- Fixed background in "Tapestry Green"
- Round the top corners
- Use monospaced text (not Alerts)
- Keep history until manually cleared
- Limit height to 200px
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/2ec37ad4
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/2ec37ad4
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/2ec37ad4
Branch: refs/heads/master
Commit: 2ec37ad4bdf77ba209d8f5f44ec1e26eda245574
Parents: cddab13
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Jul 22 08:48:19 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Jul 22 08:48:19 2013 -0700
----------------------------------------------------------------------
.../META-INF/modules/t5/core/console.coffee | 58 +++++---------------
.../assets/tapestry5/tapestry-console.css | 40 ++++++++------
2 files changed, 35 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2ec37ad4/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 4eaf6b6..4db2ac5 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
@@ -24,14 +24,6 @@ define ["./dom", "underscore"],
forceFloating = (dom.body.attribute "data-floating-console") == "true"
- FADE_DURATION = 0.25
-
- # module exports are mutable; someone else could
- # require this module to change the default DURATION
- exports =
- # Default duration for floating console in seconds.
- DURATION: 10
-
try
# FireFox will throw an exception if you even access the console object and it does
# not exist. Wow!
@@ -48,8 +40,7 @@ define ["./dom", "underscore"],
floatingConsole = dom.create
class: "tapestry-console",
"""
- <div class="console-backdrop"></div>
- <div class="alert-container"></div>
+ <div class="message-container"></div>
<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>
@@ -57,7 +48,7 @@ define ["./dom", "underscore"],
dom.body.prepend floatingConsole
- alertContainer = floatingConsole.findFirst ".alert-container"
+ alertContainer = floatingConsole.findFirst ".message-container"
floatingConsole.on "click", "[data-action=clear]", ->
floatingConsole.hide()
@@ -81,39 +72,16 @@ define ["./dom", "underscore"],
return false
- div = dom.create
- class: "alert #{className}"
- """
- <button class="close">×</button>
- #{_.escape message}
+ alertContainer.append """
+ <div class="#{className}">#{_.escape message}</div>
"""
+ # Make sure the console is visible, even if disabled.
floatingConsole.show()
- alertContainer.append div.hide().fadeIn FADE_DURATION
# A slightly clumsy way to ensure that the container is scrolled to the bottom.
_.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
- animating = false
-
- runFadeout = ->
- return if animating
-
- animating = true
-
- div.fadeOut FADE_DURATION, ->
- dom.withReflowEventsDisabled ->
- # Remove if not already removed
- div.remove() if div.parent()
-
- # Hide the console after the last one is removed.
- unless floatingConsole.findFirst(".alert")
- floatingConsole.hide()
-
- window.setTimeout runFadeout, exports.DURATION * 1000
-
- div.on "click", -> runFadeout()
-
level = (className, consolefn) ->
(message) ->
# consolefn may be null if there's no console; under IE it may be non-null, but not a function.
@@ -137,23 +105,23 @@ define ["./dom", "underscore"],
return
+ exports =
+ info: level "info", nativeConsole.info
+ warn: level "warn", nativeConsole.warn
+ error: level "error", nativeConsole.error
- # Determine whether debug is enabled by checking for the necessary attribute (which is missing
- # in production mode).
- exports.debugEnabled = (document.documentElement.getAttribute "data-debug-enabled")?
+ # Determine whether debug is enabled by checking for the necessary attribute (which is missing
+ # in production mode).
+ debugEnabled: (document.documentElement.getAttribute "data-debug-enabled")?
# When debugging is not enabled, then the debug function becomes a no-op.
exports.debug =
if exports.debugEnabled
# If native console available, go for it. IE doesn't have debug, so we use log instead.
- level "", (nativeConsole.debug or nativeConsole.log)
+ level "debug", (nativeConsole.debug or nativeConsole.log)
else
->
- exports.info = level "alert-info", nativeConsole.info
- exports.warn = level "", nativeConsole.warn
- exports.error = level "alert-error", nativeConsole.error
-
# This is also an aid to debugging; it allows arbitrary scripts to present on the console; when using Geb
# and/or Selenium, it is very useful to present debugging data right on the page.
window.t5console = exports
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2ec37ad4/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
index 55eb257..de98d34 100644
--- a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
+++ b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
@@ -5,28 +5,32 @@
bottom: 0px;
left: 0px;
right: 0px;
- border-radius: 4px;
padding: 5px;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ background-color: #8DBA4A;
+
+}
+
+.tapestry-console > .message-container {
+ max-height: 200px;
+ overflow-y: scroll;
+ font-size: 14px;
+ font-family: monospace;
+ background-color: white;
+ margin-bottom: 2px;
+ padding-left: 2px;
}
-.tapestry-console > .console-backdrop {
- position: absolute;
- background-color: black;
- opacity: .5;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- z-index: -1;
+.tapestry-console > .message-container > .debug {
+ color: blue;
}
-.tapestry-console > .alert-container {
- max-height: 300px;
- overflow-x: auto;
+.tapestry-console > .message-container > .warn {
+ color: #c09853;
}
-/** Unlike a normal alert, a console message can be dismissed by a click anywhere. */
-.tapestry-console .alert{
- cursor: pointer;
- margin-bottom: 5px;
-}
\ No newline at end of file
+.tapestry-console > .message-container > .error {
+ color: #b94a48;
+ font-weight: bold;
+}