[ARVADOS] created: 35b8110b96d41071f3958e87125975dffb10197b

git at public.curoverse.com git at public.curoverse.com
Mon Jun 2 22:18:54 EDT 2014


        at  35b8110b96d41071f3958e87125975dffb10197b (commit)


commit 35b8110b96d41071f3958e87125975dffb10197b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jun 2 22:18:47 2014 -0400

    prototype folder oriented left nav

diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index 75080a0..f0f9c7a 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -176,9 +176,9 @@ table.table-fixed-header-row tbody {
 }
 
 /* Do not leave space for left-nav */
-div#wrapper {
+/*div#wrapper {
   padding-left: 0;
-}
+}*/
 
 .arv-description-as-subtitle {
   padding-bottom: 1em;
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 4347b9b..6c5ad59 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base
   around_filter :thread_with_optional_api_token
   before_filter :check_user_agreements, except: ERROR_ACTIONS
   before_filter :check_user_notifications, except: ERROR_ACTIONS
+  before_filter :check_my_folders, :except => ERROR_ACTIONS
   before_filter :find_object_by_uuid, except: [:index] + ERROR_ACTIONS
   theme :select_theme
 
@@ -450,6 +451,23 @@ class ApplicationController < ActionController::Base
     }
   }
 
+  def check_my_folders
+    @my_top_level_folders = lambda do
+      @top_level_folders ||= Group.
+        filter([['group_class','=','folder'],
+                ['owner_uuid','=',current_user.uuid]]).
+        sort_by { |x| x.name || '' }
+    end
+    @my_shared_folders = lambda do
+      @shared_folders ||= Group.
+        filter([['group_class','=','folder'],
+                ['owner_uuid','<>',current_user.uuid]]).
+        sort_by { |x| x.name || '' }
+    end
+  end
+
+
+
   def check_user_notifications
     @notification_count = 0
     @notifications = []
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index dc97251..38b7f93 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -137,7 +137,7 @@ module ApplicationHelper
     if !object.attribute_editable?(attr, :ever) or
         (!object.editable? and
          !object.owner_uuid.in?(my_folders.collect(&:uuid)))
-      return attrvalue 
+      return attrvalue
     end
 
     input_type = 'text'
@@ -358,7 +358,7 @@ module ApplicationHelper
       render opts.merge(partial: "application/#{partial}")
     end
   end
-    
+
   def fa_icon_class_for_object object
     case object.class.to_s.to_sym
     when :User
@@ -393,4 +393,9 @@ module ApplicationHelper
       'fa-cube'
     end
   end
+
+  def render_folder_tree folder
+    l = link_to raw('<i class="fa fa-folder-open fa-fw"></i> ') + folder.name, folder_path(folder)
+    l
+  end
 end
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index 631595f..d9c4903 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -52,7 +52,7 @@
 </head>
 <body>
   <div id="wrapper">
-    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
+    <div class="navbar navbar-default navbar-fixed-top" role="navigation">
       <div class="navbar-header">
         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
           <span class="sr-only">Toggle navigation</span>
@@ -60,10 +60,87 @@
           <span class="icon-bar"></span>
           <span class="icon-bar"></span>
         </button>
-        <a class="navbar-brand" href="/"><%= Rails.configuration.site_name rescue Rails.application.class.parent_name %></a>
+        <a class="navbar-brand" href="/"><i class="fa fa-lg fa-home fa-fw"></i> <%= Rails.configuration.site_name rescue Rails.application.class.parent_name %></a>
       </div>
 
       <div class="collapse navbar-collapse">
+        <% if current_user.andand.is_active %>
+          <ul class="nav navbar-nav side-nav">
+
+<% comparable = controller.respond_to? :compare %>
+<% pane_list ||= controller.show_pane_list %>
+<% panes = Hash[pane_list.map { |pane|
+     [pane, render(partial: 'show_' + pane.downcase,
+                   locals: { comparable: comparable, objects: @objects })]
+   }.compact] %>
+
+<li class="tabs-left">
+            <ul class="nav nav-tabs ">
+              <% panes.each_with_index do |(pane, content), i| %>
+              <li class="<%= 'active' if i==0 %>"><a href="#<%= pane %>" data-toggle="tab" id="<%= pane %>-tab"> <%= pane.gsub('_', ' ') %></a></li>
+        <% end %>
+        </ul>
+</li>
+            <li class="dropdown">
+              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-lg fa-folder-o fa-fw"></i> My folders <b class="caret"></b></a>
+              <ul class="dropdown-menu">
+                <% @my_top_level_folders.call.each do |folder| %>
+                <li><%= render_folder_tree folder %></li>
+                <% end %>
+              </ul>
+            </li>
+
+            <li class="dropdown">
+              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-lg fa-folder-o fa-fw"></i> Shared folders <b class="caret"></b></a>
+              <ul class="dropdown-menu">
+                <% @my_shared_folders.call.each do |folder| %>
+                <li><%= link_to raw('<i class="fa fa-folder-open fa-fw"></i> ') + folder.name, folder_path(folder) %></li>
+                <% end %>
+              </ul>
+            </li>
+
+            <li class="dropdown">
+              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-lg fa-cogs fa-fw"></i> System <b class="caret"></b></a>
+              <ul class="dropdown-menu">
+                <li><a href="/repositories">
+                    <i class="fa fa-lg fa-code-fork fa-fw"></i> Repositories
+                  </a></li>
+                <li><a href="/virtual_machines">
+                    <i class="fa fa-lg fa-terminal fa-fw"></i> Virtual machines
+                  </a></li>
+
+                <li><a href="/nodes">
+                    <i class="fa fa-lg fa-cloud fa-fw"></i> Compute nodes
+                  </a></li>
+                <li><a href="/keep_services">
+                    <i class="fa fa-lg fa-exchange fa-fw"></i> Keep services
+                  </a></li>
+                <li><a href="/keep_disks">
+                    <i class="fa fa-lg fa-hdd-o fa-fw"></i> Keep disks
+                  </a></li>
+
+                <% if current_user.andand.is_admin %>
+                  <li><a href="/users">
+                      <i class="fa fa-lg fa-user fa-fw"></i> Users
+                    </a></li>
+                <% end %>
+                <li><a href="/groups">
+                    <i class="fa fa-lg fa-users fa-fw"></i> Groups
+                  </a></li>
+              </ul>
+            </li>
+
+            <li class="dropdown">
+              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-lg fa-hand-o-up fa-fw"></i> Help <b class="caret"></b></a>
+              <ul class="dropdown-menu">
+                <li><%= link_to raw('<i class="fa fa-book fa-fw"></i> Tutorials and User guide'), "#{Rails.configuration.arvados_docsite}/user", target: "_blank" %></li>
+                <li><%= link_to raw('<i class="fa fa-book fa-fw"></i> API Reference'), "#{Rails.configuration.arvados_docsite}/api", target: "_blank" %></li>
+                <li><%= link_to raw('<i class="fa fa-book fa-fw"></i> SDK Reference'), "#{Rails.configuration.arvados_docsite}/sdk", target: "_blank" %></li>
+              </ul>
+            </li>
+
+          </ul>
+        <% end %>
         <ul class="nav navbar-nav navbar-left breadcrumbs">
           <% if current_user %>
             <% if content_for?(:breadcrumbs) %>
@@ -206,7 +283,7 @@
           <% end %>
         </ul>
       </div><!-- /.navbar-collapse -->
-    </nav>
+    </div>
 
     <div id="page-wrapper">
       <%= yield %>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list