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

View File

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

View File

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