Migrating the west panel menu to a 2nd toolbar menu.
authorBrandon King <kingb@caltech.edu>
Fri, 26 Jun 2009 19:13:23 +0000 (19:13 +0000)
committerBrandon King <kingb@caltech.edu>
Fri, 26 Jun 2009 19:13:23 +0000 (19:13 +0000)
htsworkflow/frontend/static/js/htsw.js
htsworkflow/frontend/templates/app_base.html
htsworkflow/frontend/templates/flowcell_libraries_app.html

index 43097cfd785156290358fa1accab4f6d287908ba..7df0d3a456baf42a63c9833cefcd8e16e5017181 100644 (file)
@@ -67,6 +67,7 @@ $(document).ready(function(){
     var menuPanel = new Ext.Panel({
         id: 'menu_panel',
         region: 'west',
+       hidden: true,
         collapsible: true,
        split: true,
        collapseMode: 'mini',
@@ -146,21 +147,27 @@ $(document).ready(function(){
                 },{
                     id: 'main_toolbar',
                     xtype: 'toolbar',
+                   height: 30,
                     //height: 100,
                     /*items: [{
                         text: "Demo Button",
                         handler: function() { quick_msg('Messages can be fun!'); }
                     }],*/
                     margins: '2 0 0 0'
-            }],
-            height: 60 
+               },{
+                   id: 'app_toolbar',
+                   xtype: 'toolbar',
+                   height: 30
+                   //margins: '2 0 0 0'
+               }],
+           height: 90
        },menuPanel,{
             //title: 'Body',
             region: 'center',
             xtype: 'panel',
            //autoScroll: true,
             layout: 'fit',
-            margins: '2 2 2 2',
+            margins: '2 2 2 0',
             items: [{
                 //title: 'Inner Panel',
                 contentEl: 'body_content',
@@ -175,45 +182,26 @@ $(document).ready(function(){
     //-------------------------------
     var main_tb = Ext.getCmp('main_toolbar');
     
-    var add_buttons_from_html_left = function(main_tb){
-        var left_tbar_data = Ext.fly('left_tbar_data');
-        var div_array = left_tbar_data.query('div');
+    var add_buttons_from_html = function(tb, bar_id){
+        var tbar_data = Ext.fly(bar_id);
+        var div_array = tbar_data.query('div');
         var div_id = null;
         // Loop through each div since it defines a button and link or a spacer and add it to the right side of the toolbar
         Ext.each(div_array, function(divobj) {
             div_id = divobj.id;
             if (div_id == 'spacer'){
-                main_tb.add('-');
+                tb.add('-');
             } else {
-                main_tb.add({
+                tb.add({
                     text: div_id,
                     handler: function() { goto_url(divobj.getAttribute('href')); }
                 });
             }
         });
-        //return right_tbar_data;
     }
     
-    var add_buttons_from_html_right = function(main_tb){
-        var right_tbar_data = Ext.fly('right_tbar_data');
-        var div_array = right_tbar_data.query('div');
-        var div_id = null;
-        // Loop through each div since it defines a button and link or a spacer and add it to the right side of the toolbar
-        Ext.each(div_array, function(divobj) {
-            div_id = divobj.id;
-            if (div_id == 'spacer'){
-                main_tb.add('-');
-            } else {
-                main_tb.add({
-                    text: div_id,
-                    handler: function() { goto_url(divobj.getAttribute('href')); }
-                });
-            }
-        });
-        //return right_tbar_data;
-    }
-    
-    add_buttons_from_html_left(main_tb);
+    // Fill in left side of main toolbar
+    add_buttons_from_html(main_tb, 'left_tbar_data');
     
     // Shifts the remaining toolbar options to the right side.
     main_tb.add({ xtype: 'tbfill' });
@@ -227,7 +215,7 @@ $(document).ready(function(){
                         text: 'User: ' + user_info.getAttribute('user')
                     });
         main_tb.add('-');
-        add_buttons_from_html_right(main_tb);
+        add_buttons_from_html(main_tb, 'right_tbar_data');
         main_tb.add('-');
        main_tb.add({
                         text: 'Logout',
@@ -243,4 +231,14 @@ $(document).ready(function(){
     
     main_tb.doLayout();
     
+    //-------------------------------
+    // App Toolbar Setup
+    //-------------------------------
+    var app_tb = Ext.getCmp('app_toolbar');
+    add_buttons_from_html(app_tb, 'app_toolbar_west');
+    app_tb.add({ xtype: 'tbfill' });
+    add_buttons_from_html(app_tb, 'app_toolbar_east');
+    app_tb.doLayout();
+    
+    
 });
\ No newline at end of file
index 8a983436152b33917bcc2e5a871406566601465a..5b34e5da2681d237f74d6595bd3ade166223c29a 100644 (file)
     <!-- Required login info stuff -->
     <div id="login_info" class="x-hidden" authenticated="{{ user.is_authenticated|lower }}" user="{{ user.username }}" loginurl="{% url django.contrib.auth.views.login %}" logouturl="{% url django.contrib.auth.views.logout_then_login %}"></div>
     
+    <!-- App specific toolbar setup -->
+    <div id="app_toolbar_west">
+        {% block app_toolbar_west %}
+        {% endblock %}
+    </div>
+    <div id="app_toolbar_east">
+        {% block app_toolbar_east %}
+        {% endblock %}
+    </div>
+    
     <!-- Main Content -->
     <div id="body_content" class="x-hidden">
         {% block msg %}
index ef7c3e5efd01f8385b3d27422a568df3ac1c8e12..e7dfe8db6e3bfa829bdd743aabfd7bfa8eb5f771 100644 (file)
     </ul>
 {% endblock %}
 
+{% block app_toolbar_west %}
+    <div id="Library Index" href="{% url htsworkflow.frontend.samples.views.library %}"></div>
+    <div id="Run Folders" href="/runfolders/"></div>
+{% endblock %}
+
+{% block app_toolbar_east %}
+    <!--<div id="Admin" href="/admin/"></div>-->
+{% endblock %}
+
 {% block east_region %}
 <div id="east_region_config" class="x-hidden">changelist-filter</div>
 {% endblock %}
\ No newline at end of file