[Kimchi-devel] [PATCH v2] Add help to user menu

Adam King rak at linux.vnet.ibm.com
Mon Feb 24 15:08:34 UTC 2014


Add a link to the help to the Kimchi user menu.
Include text for the word "Help" in the translation files.
The implementation assumes that the help file name matches the tab hash id, and does a simple mapping from one to the other.

Signed-off-by: Adam King <rak at linux.vnet.ibm.com>
---
 po/en_US.po                     |  3 +++
 po/kimchi.pot                   |  3 +++
 po/pt_BR.po                     |  3 +++
 po/zh_CN.po                     |  3 +++
 ui/css/theme-default/topbar.css |  3 ++-
 ui/js/src/kimchi.main.js        | 16 ++++++++++++++++
 ui/pages/kimchi-ui.html.tmpl    |  5 ++++-
 7 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/po/en_US.po b/po/en_US.po
index 8ac59c7..d68d8a4 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -304,6 +304,9 @@ msgstr "This is not a valid Server Name or IP. please, modify it."
 msgid "Log out"
 msgstr "Log out"
 
+msgid "Help"
+msgstr ""
+
 msgid "Log In"
 msgstr "Log In"
 
diff --git a/po/kimchi.pot b/po/kimchi.pot
index f7b33ee..1a748ce 100755
--- a/po/kimchi.pot
+++ b/po/kimchi.pot
@@ -296,6 +296,9 @@ msgstr ""
 msgid "Log out"
 msgstr ""
 
+msgid "Help"
+msgstr ""
+
 msgid "Log In"
 msgstr ""
 
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 0d924e3..7e521e6 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -322,6 +322,9 @@ msgstr ""
 msgid "Log out"
 msgstr "Sair"
 
+msgid "Help"
+msgstr ""
+
 msgid "Log In"
 msgstr "Entrar"
 
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 361c11a..5cc93cd 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -312,6 +312,9 @@ msgstr "这不是一个有效的服务器名或IP,请修改"
 msgid "Log out"
 msgstr "登出"
 
+msgid "Help"
+msgstr ""
+
 msgid "Log In"
 msgstr "登录"
 
diff --git a/ui/css/theme-default/topbar.css b/ui/css/theme-default/topbar.css
index c273c70..1988a6e 100644
--- a/ui/css/theme-default/topbar.css
+++ b/ui/css/theme-default/topbar.css
@@ -160,11 +160,12 @@
     white-space: nowrap;
 }
 
-#btn-logout {
+.user-menu-item {
     color: black;
     font-size: 14px;
 }
 
+
 a#btn-logout:hover {
     text-decoration: underline;
 }
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 5387495..d04c5b9 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -135,6 +135,8 @@ kimchi.main = function() {
         });
 
         // Perform logging out via Ajax request.
+
+
         $('#btn-logout').on('click', function() {
             kimchi.logout(function() {
                 updatePage();
@@ -142,6 +144,8 @@ kimchi.main = function() {
                 kimchi.message.error(err.responseJSON.reason);
             });
         });
+
+        $('#btn-help').on('click', kimchi.getHelp);
     };
 
     // Load i18n translation strings first and then render the page.
@@ -219,3 +223,15 @@ kimchi.getTabHtml = function(url) {
     });
     return tabsHtml;
 };
+
+kimchi.getHelp = function(e) {
+        var url=window.location.hash;
+        url = url.replace("#tabs","/help");
+        if (url == "/help")
+            url=url+"/index.html"
+        else
+            url=url+".html";
+
+        window.open(url, "Kimchi Help");
+        e.preventDefault();
+};
diff --git a/ui/pages/kimchi-ui.html.tmpl b/ui/pages/kimchi-ui.html.tmpl
index eebe886..24e0372 100644
--- a/ui/pages/kimchi-ui.html.tmpl
+++ b/ui/pages/kimchi-ui.html.tmpl
@@ -78,7 +78,10 @@
                 <span id="user-name"></span>
                 <span class="arrow"></span>
                 <div class="action-panel popover right-side">
-                    <a id="btn-logout" href="javascript: void(0);">$_("Log out")</a>
+                    <a id="btn-help" class="user-menu-item" href="javascript:void(0);">$_("Help")</a>
+                    <br/>
+                    <hr/>
+                    <a id="btn-logout" class="user-menu-item" href="javascript: void(0);">$_("Log out")</a>
                 </div>
             </div>
         </li>
-- 
1.8.1.4




More information about the Kimchi-devel mailing list