You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2013/07/19 23:55:29 UTC
[3/4] git commit: TAP5-1914: Alerts needs a parameter to show/hide
"Dismiss all"
TAP5-1914: Alerts needs a parameter to show/hide "Dismiss all"
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/bbc3412d
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/bbc3412d
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/bbc3412d
Branch: refs/heads/master
Commit: bbc3412dc3627f16a02ef109e29d6912a668a21c
Parents: da4f665
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 14:52:14 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 14:52:14 2013 -0700
----------------------------------------------------------------------
.../META-INF/modules/t5/core/alert.coffee | 18 +++++++++++-------
.../tapestry5/corelib/components/Alerts.java | 12 +++++++++++-
.../org/apache/tapestry5/core.properties | 3 +++
3 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/bbc3412d/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
index 3ca552b..aed174a 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/alert.coffee
@@ -57,10 +57,14 @@ define ["./dom", "./console", "./messages", "./ajax", "underscore"],
parameters: { id }
success: -> removeAlert container, alert
- setupUI = (container) ->
+ setupUI = (outer) ->
- container.update """
- <div data-container-type="inner"></div>
+ outer.update """
+ <div data-container-type="inner"></div>
+ """
+
+ if (outer.attribute "data-show-dismiss-all") is "true"
+ outer.append """
<div class="row-fluid">
<button class="btn btn-mini pull-right" data-action="dismiss-all">
<strong>×</strong>
@@ -69,12 +73,12 @@ define ["./dom", "./console", "./messages", "./ajax", "underscore"],
</div>
"""
- container.on "click", "[data-action=dismiss-all]", ->
- dismissAll container
+ outer.on "click", "[data-action=dismiss-all]", ->
+ dismissAll outer
return false
- container.on "click", "button.close", ->
- dismissOne container, this
+ outer.on "click", "button.close", ->
+ dismissOne outer, this
return false
findInnerContainer = ->
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/bbc3412d/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
index a39b0fb..6e8a045 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java
@@ -1,4 +1,4 @@
-// Copyright 2011, 2012 The Apache Software Foundation
+// Copyright 2011-2013 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -49,6 +49,15 @@ public class Alerts extends BaseClientElement
@Parameter(value = "message:core-dismiss-label", defaultPrefix = BindingConstants.LITERAL)
private String dismissText;
+
+ /**
+ * If set to true, then the "dismiss all" button will not be rendered on the client.
+ *
+ * @since 5.4
+ */
+ @Parameter(value = "message:core-alerts-show-dismiss-all", defaultPrefix = BindingConstants.LITERAL)
+ private boolean showDismissAll;
+
@SessionState(create = false)
private AlertStorage storage;
@@ -66,6 +75,7 @@ public class Alerts extends BaseClientElement
storeElement(writer.element("div",
"data-container-type", "alerts",
+ "data-show-dismiss-all", showDismissAll,
"data-dismiss-url", dismissLink));
resources.renderInformalParameters(writer);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/bbc3412d/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
index 941adf7..e78df6c 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
@@ -119,3 +119,6 @@ core-components.beaneditform.class=well
# Submit component cssClass parameter default:
core-components.submit.class=btn btn-primary
+
+# Default for showDismissAll parameter of Alerts
+core-alerts-show-dismiss-all=true
\ No newline at end of file