doortts doortts 2018-01-03
navbar: Add custom link to navbar feature
@f17c166a784b33d0b5a4f2b043b71f7bf0a35c24
app/controllers/Application.java
--- app/controllers/Application.java
+++ app/controllers/Application.java
@@ -38,6 +38,8 @@
     public static String LOGIN_PAGE_LOGINID_PLACEHOLDER  = play.Configuration.root().getString("application.login.page.loginId.placeholder", "");
     public static String LOGIN_PAGE_PASSWORD_PLACEHOLDER  = play.Configuration.root().getString("application.login.page.password.placeholder", "");
     public static boolean SHOW_USER_EMAIL = play.Configuration.root().getBoolean("application.show.user.email", true);
+    public static String NAVBAR_CUSTOM_LINK_NAME  = play.Configuration.root().getString("application.navbar.custom.link.name", "");
+    public static String NAVBAR_CUSTOM_LINK_URL  = play.Configuration.root().getString("application.navbar.custom.link.url", "");
 
     @AnonymousCheck
     public static Result index() {
app/views/common/usermenu.scala.html
--- app/views/common/usermenu.scala.html
+++ app/views/common/usermenu.scala.html
@@ -71,10 +71,14 @@
 </div>
 <ul class="gnb-usermenu">
     @if( !currentUser.isAnonymous()) {
+        @if(!StringUtils.isBlank(Application.NAVBAR_CUSTOM_LINK_NAME)) {
+        <li class="gnb-usermenu-item">
+            <a href="@Application.NAVBAR_CUSTOM_LINK_URL" class="user-item-btn loggged-in">@Application.NAVBAR_CUSTOM_LINK_NAME</a>
+        </li>
+        }
        <li class="gnb-usermenu-item hide-in-mobile">
           <a href="@routes.Application.notifications()" class="user-item-btn loggged-in">@Messages("notification")</a>
        </li>
-       <li class="divider hide-in-mobile"></li>
        <li class="gnb-usermenu-item" data-toggle="tooltip" data-placement="bottom" title="@Messages("title.shortcut") (A)">
            <a href="@routes.IssueApp.userIssues()" class="user-item-btn loggged-in">@Messages("issue.myIssue")@myOpenIssueCount</a>
         </li>
@@ -92,7 +96,7 @@
                 <span class="avatar-wrap smaller">
                     <img src="@currentUser.avatarUrl(32)" />
                 </span>
-                <span class="caret-text">@currentUser.getPureNameOnly</span>
+                <span class="caret-text hide-in-mobile">@currentUser.getPureNameOnly</span>
                 <span class="caret"></span>
             </a>
         </li>
conf/application.conf.default
--- conf/application.conf.default
+++ conf/application.conf.default
@@ -353,6 +353,17 @@
 # choice: github, google
 application.social.login.support = "github, google"
 
+# Custom link to navigation bar
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# If you fill the name of link and url,
+# custom menu will be appeared at right upper side navbar
+application.navbar.custom {
+    link {
+        name=""
+        url=""
+    }
+}
+
 # LDAP Login Support
 # ~~~~~~~~~~~~~~~~~
 #
Add a comment
List