$(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',
width: 100px;
display:inline-block;
}
+
+li.notification {
+ padding: 10px;
+}
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
<% 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>
<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>
</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>