Skip to content

Commit

Permalink
fixed funkiness in add to collection popup
Browse files Browse the repository at this point in the history
  • Loading branch information
potch committed Aug 31, 2010
1 parent 9e5034d commit 9792907
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions media/js/zamboni/collections.js
Expand Up @@ -579,6 +579,7 @@ $(document).ready(function () {
$.post(url, data, function(data) {
dropdown.removeClass('new-collection');
dropdown.html(data);
$("a.outlink", dropdown).click(stopPropagation);
}, 'html');
}

Expand Down Expand Up @@ -609,29 +610,35 @@ $(document).ready(function () {
$widget = $(this).closest('.collection-add');
$('.collection-add-dropdown').hide();
var dropdown = $('.collection-add-dropdown', $(this));
dropdown.removeClass("new-collection");
var addon_id = $(this).attr('data-addonid');
// If anonymous, show login overlay.
if (z.anonymous) {
dropdown.show();
} else {

function loadList(e) {
if (e) e.preventDefault();
$widget.addClass("ajax-loading");
// Make a call to /collections/ajax/list with addon_id
$.get(list_url, {'addon_id': addon_id}, function(data) {
dropdown.show();
dropdown.removeClass("new-collection");
dropdown.html(data);
dropdown.show();
$widget.removeClass("ajax-loading");
$("a.outlink", dropdown).click(stopPropagation);
}, 'html');
}

// If anonymous, show login overlay.
if (z.anonymous) {
dropdown.show();
} else {
loadList();
}
e.preventDefault();

dropdown.unbind('click.popup', stopPropagation);
dropdown.bind('click.popup', stopPropagation);
dropdown.delegate('#ajax_collections_list li', 'click', handleToggle)
.delegate('#collections-new form', 'submit', handleSubmit)
.delegate('#ajax_new_collection', 'click', handleNew)
.delegate('#collections-new-cancel', 'click', handleClick)
.delegate('#collections-new-cancel', 'click', loadList)
.delegate('#id_name', 'blur', slugify)
.delegate('#edit_slug', 'click', show_slug_edit)
.delegate('#id_slug', 'change', function() {
Expand Down

0 comments on commit 9792907

Please sign in to comment.