Merge branch 'master' of git.clinicalfuture.com:arvados
authorTim Pierce <twp@curoverse.com>
Tue, 11 Feb 2014 22:14:25 +0000 (17:14 -0500)
committerTim Pierce <twp@curoverse.com>
Tue, 11 Feb 2014 22:14:25 +0000 (17:14 -0500)
apps/workbench/app/assets/javascripts/users.js
apps/workbench/app/assets/stylesheets/application.css.scss
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/views/application/_show_metadata.html.erb
apps/workbench/app/views/groups/_show_recent.html.erb
apps/workbench/app/views/layouts/application.html.erb

index c9c69a0a64529860adf022b6925713b1a454f5bb..ee1c7dda37af86e7eb1719791a29052920b6673d 100644 (file)
@@ -1,8 +1,15 @@
 $(document).
+    on('notifications:recount',
+       function() {
+           var menu = $('.notification-menu');
+           n = $('.notification', menu).not('.empty').length;
+           $('.notification-count', menu).html(n>0 ? n : '');
+       }).
     on('ajax:success', 'form.new_authorized_key',
        function(e, data, status, xhr) {
-           $(e.target).parents('div.daxalert').fadeOut('slow', function() {
-               $('<div class="alert alert-success daxalert"><button type="button" class="close" data-dismiss="alert">&times;</button><p>Key added.</p></div>').hide().replaceAll(this).fadeIn('slow');
+           $(e.target).parents('.notification').eq(0).fadeOut('slow', function() {
+               $('<li class="alert alert-success daxalert">SSH key added.</li>').hide().replaceAll(this).fadeIn('slow');
+               $(document).trigger('notifications:recount');
            });
        }).
     on('ajax:complete', 'form.new_authorized_key',
index c35620c307249699cb64e4b8f4b9f08550588f9e..5ebb57230e7ea95bd0e3875a05ca4a433ccfef90 100644 (file)
@@ -125,3 +125,7 @@ ul.arvados-nav li ul li {
     width: 100px;
     display:inline-block;
 }
+
+li.notification {
+    padding: 10px;
+}
index cc452b93cbf6b3c4dfceac5bc533b6a2523038cf..843cf0da0d353494e5ab267577a85ffcaef17d43 100644 (file)
@@ -109,7 +109,12 @@ class ApplicationController < ActionController::Base
   def create
     @object ||= model_class.new params[model_class.to_s.singularize.to_sym]
     @object.save!
-    redirect_to(params[:return_to] || @object)
+    respond_to do |f|
+      f.html {
+        redirect_to(params[:return_to] || @object)
+      }
+      f.js { render }
+    end
   end
 
   def destroy
index 3972da0c342f6fcb3a209eb760c80652b050e50c..f36240bd1059f7bda33e277bdb8e1b68d823d686 100644 (file)
@@ -30,7 +30,7 @@ No metadata.
 <% end %>
 
 <h3>Metadata that refers to this object</h3>
-<% if outgoing.items_available > 0 %>
+<% if incoming.items_available > 0 %>
 <table class="table topalign">
   <thead>
     <tr>
index 117ddb65da08d07e507151a31f2fbb86b3b3b645..c372b885926664d6e0cbcd4af31e39d683fb6edb 100644 (file)
@@ -20,7 +20,7 @@
 
     <tr>
       <td>
-        <%= g.friendly_link_name %>
+        <%= link_to_if_arvados_object g, friendly_name: true %>
       </td><td>
         <%= link_to_if_arvados_object g.owner_uuid, friendly_name: true %>
       </td><td>
index 3d5fcfd01c6347801bb3f2bf68ed66515d3979d4..30d454e831c4409e8397ee64ffb89dd83e6244cf 100644 (file)
         </li>        
         -->
 
-        <li class="dropdown">
+        <li class="dropdown notification-menu">
           <a href="#" class="dropdown-toggle" data-toggle="dropdown">
             <span class="glyphicon glyphicon-envelope"></span>
-            <span class="badge badge-alert"><%= @notification_count %></span>
+            <span class="badge badge-alert notification-count"><%= @notification_count %></span>
             <span class="caret"></span>
           </a>
           <ul class="dropdown-menu" role="menu">
             <% if @notifications.length > 0 %>
               <% @notifications.each_with_index do |n, i| %>
                 <% if i > 0 %><li class="divider"></li><% end %>
-                <li style="padding: 10px"><%= n.call(self) %></li>
+                <li class="notification"><%= n.call(self) %></li>
               <% end %>
             <% else %>
-              <li style="padding: 10px">No notifications.</li>
+              <li class="notification empty">No notifications.</li>
             <% end %>
           </ul>
         </li>