Small fix for jQuery / Ajax processing.

This commit is contained in:
takezoe
2013-06-27 01:32:33 +09:00
parent 1d67ae69c5
commit 38d51ccf90
3 changed files with 51 additions and 55 deletions

View File

@@ -157,9 +157,7 @@ $(function(){
} else {
$(this).data('toggle-state', 'on');
$.get('@path/@repository.owner/@repository.name/issues/label/edit', function(data){
var parent = $('#label-list').parent();
$('#label-list').remove();
parent.append(data);
$('#label-list').parent().empty().html(data);
});
}
});

View File

@@ -18,10 +18,9 @@
}
</form>
<script>
@if(mode == "new"){
$(function(){
@if(mode == "new"){
$('#newColor').colorpicker();
});
} else {
$('#editColor').colorpicker();
@@ -33,9 +32,7 @@
if($.isEmptyObject(data)){
$.post(form.attr('action'), $(form).serialize(), function(data){
var parent = $('#label-edit').parent();
$('#label-edit').remove();
parent.append(data);
$('#label-edit').parent().empty().html(data);
});
} else {
$.each(data, function(key, value){
@@ -46,6 +43,7 @@
return false;
});
}
});
</script>
</div>
}

View File

@@ -13,14 +13,13 @@
}
</ul>
<script>
$(function(){
$('i.icon-remove-circle').click(function(e){
e.stopPropagation();
if(confirm('Are you sure you want to delete this?')){
$.get('@path/@repository.owner/@repository.name/issues/label/' + $(this).parents('a').data('label-id') + '/delete',
function(data){
var parent = $('#label-edit').parent();
$('#label-edit').remove();
parent.append(data);
$('#label-edit').parent().empty().html(data);
}
);
}
@@ -42,5 +41,6 @@
$('div#label-edit li').css('border', '1px solid white');
}
});
});
</script>
</div>