You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2012/10/19 19:18:54 UTC

svn commit: r1400181 - in /openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp: ./ app/js/ app/js/templates/ app/js/util/ app/js/view/ app/js/view/panels/

Author: tveronezi
Date: Fri Oct 19 17:18:53 2012
New Revision: 1400181

URL: http://svn.apache.org/viewvc?rev=1400181&view=rev
Log:
New 'Home' tab. It is the only available tab for unauthenticated users.

Added:
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-tab-home.handlebars
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/panels/home.js
Modified:
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/ApplicationTemplates.js
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-toolbar.handlebars
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/util/I18N.js
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationToolbarView.js
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationView.js
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/ApplicationTemplates.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/ApplicationTemplates.js?rev=1400181&r1=1400180&r2=1400181&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/ApplicationTemplates.js (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/ApplicationTemplates.js Fri Oct 19 17:18:53 2012
@@ -48,6 +48,7 @@ TOMEE.ApplicationTemplates = (function (
     'application-disabled',
     'application-toolbar',
     'application-toolbar-logout-btn',
+    'application-tab-home',
     'application-tab-console',
     'application-tab-console-sample',
     'application-tab-console-output-line',

Added: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-tab-home.handlebars
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-tab-home.handlebars?rev=1400181&view=auto
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-tab-home.handlebars (added)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-tab-home.handlebars Fri Oct 19 17:18:53 2012
@@ -0,0 +1 @@
+<div class="tomee-home"></div>
\ No newline at end of file

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-toolbar.handlebars
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-toolbar.handlebars?rev=1400181&r1=1400180&r2=1400181&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-toolbar.handlebars (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/templates/application-toolbar.handlebars Fri Oct 19 17:18:53 2012
@@ -1,10 +1,11 @@
-<div class="navbar navbar-inverse">
+<div class="navbar navbar-inverse" xmlns="http://www.w3.org/1999/html">
     <div class="navbar-inner">
         <div>
             <a class="brand" href="#">{{i18n "application.name"}}</a>
             <ul class="nav">
-                <li class="toolbar-item active console"><a href="#">{{i18n "application.console"}}</a></li>
-                <li class="toolbar-item log"><a href="#">{{i18n "application.log"}}</a></li>
+                <li class="toolbar-item active" tab-key="home"><a href="#">{{i18n "application.home"}}</a></li>
+                <li class="toolbar-item disabled" tab-key="console"><a href="#">{{i18n "application.console"}}</a></li>
+                <li class="toolbar-item disabled" tab-key="log"><a href="#">{{i18n "application.log"}}</a></li>
             </ul>
             <div class="pull-right">
                 <ul class="nav">

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/util/I18N.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/util/I18N.js?rev=1400181&r1=1400180&r2=1400181&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/util/I18N.js (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/util/I18N.js Fri Oct 19 17:18:53 2012
@@ -27,6 +27,8 @@ TOMEE.I18N = (function () {
         'connection.exception':'Connection exception',
         'connection.exception.message':'The application is waiting for the server.',
 
+        'application.home':'Home',
+
         'application.console':'Console',
         'application.console.run':'Execute',
         'application.console.clear.output':'Clear output',

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationToolbarView.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationToolbarView.js?rev=1400181&r1=1400180&r2=1400181&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationToolbarView.js (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationToolbarView.js Fri Oct 19 17:18:53 2012
@@ -23,14 +23,20 @@ TOMEE.ApplicationToolbarView = function 
         el = $(TOMEE.ApplicationTemplates.getValue('application-toolbar', {})),
         logoutBtn = $(TOMEE.ApplicationTemplates.getValue('application-toolbar-logout-btn', {}));
 
-    (function (keys) {
-        TOMEE.utils.forEach(keys, function (key) {
-            el.find('.' + key).bind('click', (function () {
-                updateSelected(key);
-            }));
-        });
+    el.find('.toolbar-item').on('click', function (ev) {
+        var tabEl = $(ev.currentTarget),
+            tabKey = tabEl.attr("tab-key");
+
+        if (tabEl.hasClass('disabled')) {
+            return;
+        }
+
+        el.find('.toolbar-item').removeClass('active');
+        tabEl.addClass('active');
+
+        updateSelected(tabKey);
 
-    })(['home', 'console', 'log']);
+    });
 
     el.find('.tomee-login-btn').on('click', function () {
         var user = el.find('.tomee-login').val(),
@@ -45,7 +51,7 @@ TOMEE.ApplicationToolbarView = function 
     });
 
     logoutBtn.on('click', function () {
-      channel.send('ui-actions', 'logout-btn-click', {});
+        channel.send('ui-actions', 'logout-btn-click', {});
     });
 
     channel.bind('server-command-callback-success', 'Login', function (params) {
@@ -56,7 +62,7 @@ TOMEE.ApplicationToolbarView = function 
             user = el.find('.tomee-login'),
             pass = el.find('.tomee-password');
 
-        if(!params.output.loginSuccess) {
+        if (!params.output.loginSuccess) {
             btn.prop('disabled', false);
             return;
         }
@@ -71,6 +77,7 @@ TOMEE.ApplicationToolbarView = function 
         userNameMenu.html(user.val());
 
         el.find('.login-menu').addClass('logout');
+        el.find('.toolbar-item').removeClass('disabled');
     });
 
     channel.bind('server-command-callback-success', 'session', function (params) {
@@ -81,7 +88,7 @@ TOMEE.ApplicationToolbarView = function 
             user = el.find('.tomee-login'),
             pass = el.find('.tomee-password');
 
-        if(!params.data.userName) {
+        if (!params.data.userName) {
             return;
         }
 
@@ -93,6 +100,7 @@ TOMEE.ApplicationToolbarView = function 
         userNameMenu.html(params.data.userName);
 
         el.find('.login-menu').addClass('logout');
+        el.find('.toolbar-item').removeClass('disabled');
     });
 
     channel.bind('server-command-callback-error', 'Login', function (params) {
@@ -101,9 +109,6 @@ TOMEE.ApplicationToolbarView = function 
     });
 
     function updateSelected(key) {
-        el.find('.toolbar-item').removeClass('active');
-        el.find('.' + key).addClass('active');
-
         channel.send('ui-actions', 'toolbar-click', {
             key:key
         });

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationView.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationView.js?rev=1400181&r1=1400180&r2=1400181&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationView.js (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/ApplicationView.js Fri Oct 19 17:18:53 2012
@@ -21,6 +21,7 @@ TOMEE.ApplicationView = function () {
 
     var channel = TOMEE.ApplicationChannel,
         panelMap = {
+            'home': TOMEE.ApplicationTabHome(),
             'console':TOMEE.ApplicationTabConsole(),
             'log':TOMEE.ApplicationTabLog()
         },
@@ -160,7 +161,7 @@ TOMEE.ApplicationView = function () {
             myBody.append(container);
 
 
-            switchPanel('console');
+            switchPanel('home');
 
             showConnectionPopup();
 

Added: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/panels/home.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/panels/home.js?rev=1400181&view=auto
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/panels/home.js (added)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/app/js/view/panels/home.js Fri Oct 19 17:18:53 2012
@@ -0,0 +1,41 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+TOMEE.ApplicationTabHome = function () {
+    "use strict";
+
+    var channel = TOMEE.ApplicationChannel,
+        container = $(TOMEE.ApplicationTemplates.getValue('application-tab-home', {})),
+        active = false;
+
+    channel.bind('ui-actions', 'container-resized', function (data) {
+        container.height(data.containerHeight);
+    });
+
+    return {
+        getEl:function () {
+            return container;
+        },
+        onAppend:function () {
+            active = true;
+        },
+        onDetach:function () {
+            active = false;
+        }
+    };
+};
\ No newline at end of file

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html?rev=1400181&r1=1400180&r2=1400181&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html Fri Oct 19 17:18:53 2012
@@ -48,6 +48,7 @@
     <script src="app/js/view/ApplicationView.js"></script>
     <script src="app/js/view/ApplicationToolbarView.js"></script>
 
+    <script src="app/js/view/panels/home.js"></script>
     <script src="app/js/view/panels/console.js"></script>
     <script src="app/js/view/panels/log.js"></script>
     <script src="app/js/view/panels/webservices.js"></script>