Refactored repeat confirmation dialog. Also fixes dialog skipping.

This commit is contained in:
Sarven Capadisli 2010-02-10 11:16:27 +01:00
parent 2600ad9643
commit e8428d1d52

View File

@ -356,42 +356,44 @@ var SN = { // StatusNet
}, },
NoticeRepeat: function() { NoticeRepeat: function() {
$('.form_repeat').live('click', function() { $('.form_repeat').live('click', function(e) {
SN.U.FormXHR($(this)); e.preventDefault();
SN.U.NoticeRepeatConfirmation($(this)); SN.U.NoticeRepeatConfirmation($(this));
return false; return false;
}); });
}, },
NoticeRepeatConfirmation: function(form) { NoticeRepeatConfirmation: function(form) {
function NRC() { var submit_i = form.find('.submit');
form.closest('.notice-options').addClass('opaque');
form.addClass('dialogbox');
form.append('<button class="close">&#215;</button>'); var submit = submit_i.clone();
form.find('button.close').click(function(){ submit
$(this).remove(); .addClass('submit_dialogbox')
.removeClass('submit');
form.append(submit);
submit.bind('click', function() { SN.U.FormXHR(form); return false; });
form.closest('.notice-options').removeClass('opaque'); submit_i.hide();
form.removeClass('dialogbox');
form.find('.submit_dialogbox').remove();
form.find('.submit').show();
return false; form
}); .addClass('dialogbox')
}; .append('<button class="close">&#215;</button>')
.closest('.notice-options')
.addClass('opaque');
form.find('.submit').bind('click', function(e) { form.find('button.close').click(function(){
e.preventDefault(); $(this).remove();
var submit = form.find('.submit').clone(); form
submit.addClass('submit_dialogbox'); .removeClass('dialogbox')
submit.removeClass('submit'); .closest('.notice-options')
form.append(submit); .removeClass('opaque');
$(this).hide(); form.find('.submit_dialogbox').remove();
form.find('.submit').show();
NRC(); return false;
}); });
}, },