You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2024/12/16 12:38:55 UTC

(myfaces-tobago) branch main updated: refactor(demo): add home button

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/main by this push:
     new e2edf16150 refactor(demo): add home button
e2edf16150 is described below

commit e2edf16150da53ac31af404dbe2baca6d61c6678
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Dec 16 10:18:41 2024 +0100

    refactor(demo): add home button
    
    Add a "Home"-Button du go to the root of the current Tobago demo. A click on the brand leads to "https://tobago-demo.apache.org/".
---
 .../java/org/apache/myfaces/tobago/example/demo/NavigationState.java  | 4 ++++
 tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml         | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
index d2951d25cf..be97e9c895 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
@@ -88,6 +88,10 @@ public class NavigationState implements Serializable {
     return gotoNode(tree.getTree().getNextNode()) + "?faces-redirect=true"; // the first after the root node
   }
 
+  public String rootUrl() {
+    return tree.getTree().getNextNode().toString();
+  }
+
   public String gotoPrevious() {
     if (currentNode == null) {
       return gotoFirst();
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
index 08929f0fb5..4537ecd586 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
@@ -34,12 +34,12 @@
       <f:facet name="brand">
         <!-- label="Tobago Demo" contains a NO-BREAK SPACE character -->
         <tc:link image="#{request.contextPath}/image/feather-leaf.png" label="Tobago Demo" id="brand"
-                 link="http://tobago-vm.apache.org/"/>
+                 link="https://tobago-demo.apache.org/"/>
       </f:facet>
 
       <tc:form id="header">
-
         <tc:links id="commands">
+          <tc:link id="home" label="Home" link="#{navigationState.rootUrl()}"/>
 
           <tc:link id="config" label="Configuration" omit="true">
             <tc:link label="Theme" omit="true">