You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2016/01/08 10:02:46 UTC
syncope git commit: [SYNCOPE-156] Auto hide success and info
notification message
Repository: syncope
Updated Branches:
refs/heads/master 5dda24d48 -> c8a536186
[SYNCOPE-156] Auto hide success and info notification message
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c8a53618
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c8a53618
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c8a53618
Branch: refs/heads/master
Commit: c8a536186162180aa25c147b9103b6646dca4dd3
Parents: 5dda24d
Author: Marco Di Sabatino Di Diodoro <md...@apache.org>
Authored: Fri Jan 8 10:02:28 2016 +0100
Committer: Marco Di Sabatino Di Diodoro <md...@apache.org>
Committed: Fri Jan 8 10:02:28 2016 +0100
----------------------------------------------------------------------
.../console/commons/StyledNotificationBehavior.java | 14 ++++++++++++--
.../client/console/panels/NotificationPanel.java | 7 ++++---
.../client/console/panels/NotificationPanel.html | 4 ++--
3 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/c8a53618/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
index 98f53ec..ef54185 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.console.commons;
import com.googlecode.wicket.jquery.core.Options;
+import com.googlecode.wicket.kendo.ui.widget.notification.Notification;
import com.googlecode.wicket.kendo.ui.widget.notification.NotificationBehavior;
import java.io.Serializable;
import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
@@ -27,13 +28,22 @@ public class StyledNotificationBehavior extends NotificationBehavior {
private static final long serialVersionUID = -3985689554352173472L;
+ private static final String AUTOHIDEAFTER_SUCCESS = "3000";
+
+ private static final String AUTOHIDEAFTER_ERROR = "0";
+
public StyledNotificationBehavior(final String selector, final Options options) {
super(selector, options);
}
@Override
public void show(final IPartialPageRequestHandler handler, final Serializable message, final String level) {
- handler.appendJavaScript(String.format("%s.show( { message: '%s' } , '%s');", this.widget(), this.format(String.
- valueOf(message), level), level.toLowerCase()));
+ handler.appendJavaScript(String.format("%s.options.autoHideAfter = %s; %s.show( { message: '%s' } , '%s');",
+ this.widget(),
+ Notification.SUCCESS.equalsIgnoreCase(level)
+ || Notification.INFO.equalsIgnoreCase(level) ? AUTOHIDEAFTER_SUCCESS : AUTOHIDEAFTER_ERROR,
+ this.widget(),
+ this.format(String.valueOf(message), level),
+ level.toLowerCase()));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c8a53618/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
index d38cfad..2583a86 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
@@ -39,10 +39,11 @@ public class NotificationPanel extends FeedbackPanel {
final Options options = new Options();
options.set("position", "{ pinned: true }");
- options.set("autoHideAfter", "0");
options.set("templates",
- "[ { type: 'success' , template: $('#successTemplate').html() },"
- + " { type: 'error', template: $('#errorTemplate').html() } ] ");
+ "[ { type: 'success', template: $('#successTemplate').html() },"
+ + " { type: 'info', template: $('#successTemplate').html() },"
+ + " { type: 'error', template: $('#errorTemplate').html() },"
+ + " { type: 'warning', template: $('#errorTemplate').html() } ] ");
notification = new Notification(Constants.FEEDBACK, options) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/c8a53618/client/console/src/main/resources/org/apache/syncope/client/console/panels/NotificationPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/NotificationPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/NotificationPanel.html
index 2c3eb74..12c01ec 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/NotificationPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/NotificationPanel.html
@@ -22,14 +22,14 @@ under the License.
<span wicket:id="feedback"></span>
<script id="errorTemplate" type="text/x-kendo-template">
- <div data-time="0" class="errorNotification">
+ <div class="errorNotification">
<div id="level" class="glyphicon glyphicon-remove-circle"></div>
<div id="message"><p>#= message #</p></div>
</div>
</script>
<script id="successTemplate" type="text/x-kendo-template">
- <div data-time="3000" class="successNotification">
+ <div class="successNotification">
<div id="level" class="glyphicon glyphicon-ok-circle"></div>
<div id="message"><p>#= message #</p></div>
</div>