You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/04/13 09:15:20 UTC

svn commit: r1738898 - in /myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp: login.xhtml script/demo.js

Author: lofwyr
Date: Wed Apr 13 07:15:20 2016
New Revision: 1738898

URL: http://svn.apache.org/viewvc?rev=1738898&view=rev
Log:
TOBAGO-1544: Revise Demo Application for Tobago 3.0
* quick links for login

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml?rev=1738898&r1=1738897&r2=1738898&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/login.xhtml Wed Apr 13 07:15:20 2016
@@ -25,21 +25,22 @@
 
   <tc:section label="Login">
 
-    <tc:out value="Use one of the following users to login."/>
-    (
-    <tc:link label="guest/guest" omit="true">
-      <tc:dataAttribute name="login" value='{"username": "guest", "password": "guest"}'/>
-    </tc:link>
-    or
-    <tc:link label="admin/admin" omit="true">
-      <tc:dataAttribute name="login" value='{"username": "admin", "password": "admin"}'/>
-    </tc:link>
-    )
+    <p>
+      Use one of the following users to login
+      (Shortcuts:
+      <tc:link label="guest/guest" omit="true">
+        <tc:dataAttribute name="login" value='{"username": "guest", "password": "guest"}'/>
+      </tc:link>
+      or
+      <tc:link label="admin/admin" omit="true">
+        <tc:dataAttribute name="login" value='{"username": "admin", "password": "admin"}'/>
+      </tc:link>).
+    </p>
 
     <tc:in id="username" value="#{login.username}" label="User"/>
     <tc:in id="password" value="#{login.password}" password="true" label="Password"/>
 
-    <tc:button action="#{login.login}" label="Login" defaultCommand="true"/>
+    <tc:button id="login" action="#{login.login}" label="Login" defaultCommand="true"/>
 
   </tc:section>
 

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js?rev=1738898&r1=1738897&r2=1738898&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js Wed Apr 13 07:15:20 2016
@@ -68,3 +68,21 @@ var initInspect = function (elements) {
 
 Tobago.registerListener(initInspect, Tobago.Phase.DOCUMENT_READY);
 Tobago.registerListener(initInspect, Tobago.Phase.AFTER_UPDATE);
+
+Demo = {};
+
+/**
+ * Copies the values from the data-login attribute to the username/password fields.
+ */
+Demo.prepareQuickLinks = function() {
+  jQuery("a[data-login]").click(function() {
+    var link = jQuery(this);
+    var login = link.data("login");
+    jQuery(Tobago.Utils.escapeClientId("page:username")).find("input").val(login.username);
+    jQuery(Tobago.Utils.escapeClientId("page:password")).find("input").val(login.password);
+    jQuery(Tobago.Utils.escapeClientId("page:login")).click();
+    return false;
+  });
+};
+
+Tobago.registerListener(Demo.prepareQuickLinks, Tobago.Phase.DOCUMENT_READY);