[ARVADOS] updated: e7153591229d096b33ea4974fb3a4d581bb3b4d4

git at public.curoverse.com git at public.curoverse.com
Tue Feb 11 15:03:43 EST 2014


Summary of changes:
 apps/workbench/app/assets/javascripts/users.js     |   11 +++++++++--
 .../app/assets/stylesheets/application.css.scss    |    4 ++++
 .../app/controllers/application_controller.rb      |    7 ++++++-
 .../app/views/layouts/application.html.erb         |    8 ++++----
 4 files changed, 23 insertions(+), 7 deletions(-)

       via  e7153591229d096b33ea4974fb3a4d581bb3b4d4 (commit)
      from  715869b9a22e22ac68a7dbefa96f27150017f75d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e7153591229d096b33ea4974fb3a4d581bb3b4d4
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Feb 11 12:02:00 2014 -0800

    Dismiss "paste your SSH key here" notification when key successfully saved.
    
    fixes #2079

diff --git a/apps/workbench/app/assets/javascripts/users.js b/apps/workbench/app/assets/javascripts/users.js
index c9c69a0..ee1c7dd 100644
--- a/apps/workbench/app/assets/javascripts/users.js
+++ b/apps/workbench/app/assets/javascripts/users.js
@@ -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">×</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',
diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index c35620c..5ebb572 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -125,3 +125,7 @@ ul.arvados-nav li ul li {
     width: 100px;
     display:inline-block;
 }
+
+li.notification {
+    padding: 10px;
+}
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index cc452b9..843cf0d 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -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
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index 3d5fcfd..30d454e 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -145,20 +145,20 @@
         </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>        

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list