mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
Small fix for jQuery / Ajax processing.
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,34 +18,32 @@
|
||||
}
|
||||
</form>
|
||||
<script>
|
||||
@if(mode == "new"){
|
||||
$(function(){
|
||||
$(function(){
|
||||
@if(mode == "new"){
|
||||
$('#newColor').colorpicker();
|
||||
});
|
||||
} else {
|
||||
$('#editColor').colorpicker();
|
||||
} else {
|
||||
$('#editColor').colorpicker();
|
||||
|
||||
$('#edit-label-form').submit(function(e){
|
||||
var form = $(e.target);
|
||||
$.post(form.attr('action') + '/validate', $(form).serialize(), function(data){
|
||||
// clear all error messages
|
||||
$('.error').text('');
|
||||
$('#edit-label-form').submit(function(e){
|
||||
var form = $(e.target);
|
||||
$.post(form.attr('action') + '/validate', $(form).serialize(), function(data){
|
||||
// clear all error messages
|
||||
$('.error').text('');
|
||||
|
||||
if($.isEmptyObject(data)){
|
||||
$.post(form.attr('action'), $(form).serialize(), function(data){
|
||||
var parent = $('#label-edit').parent();
|
||||
$('#label-edit').remove();
|
||||
parent.append(data);
|
||||
});
|
||||
} else {
|
||||
$.each(data, function(key, value){
|
||||
$('#error-' + key).text(value);
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
return false;
|
||||
});
|
||||
}
|
||||
if($.isEmptyObject(data)){
|
||||
$.post(form.attr('action'), $(form).serialize(), function(data){
|
||||
$('#label-edit').parent().empty().html(data);
|
||||
});
|
||||
} else {
|
||||
$.each(data, function(key, value){
|
||||
$('#error-' + key).text(value);
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -13,34 +13,34 @@
|
||||
}
|
||||
</ul>
|
||||
<script>
|
||||
$('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);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
$(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){
|
||||
$('#label-edit').parent().empty().html(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$('a.label-edit-link').click(function(e){
|
||||
if($('input[name=editLabelId]').val() != $(this).data('label-id')){
|
||||
$('#editLabelArea').remove();
|
||||
var element = this;
|
||||
$.get('@path/@repository.owner/@repository.name/issues/label/' + $(this).data('label-id') + '/edit',
|
||||
function(data){
|
||||
$(element).parent().append(data);
|
||||
$('div#label-edit li').css('border', '1px solid white');
|
||||
$(element).parent().css('border', '1px solid #eee');
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$('#editLabelArea').remove();
|
||||
$('div#label-edit li').css('border', '1px solid white');
|
||||
}
|
||||
$('a.label-edit-link').click(function(e){
|
||||
if($('input[name=editLabelId]').val() != $(this).data('label-id')){
|
||||
$('#editLabelArea').remove();
|
||||
var element = this;
|
||||
$.get('@path/@repository.owner/@repository.name/issues/label/' + $(this).data('label-id') + '/edit',
|
||||
function(data){
|
||||
$(element).parent().append(data);
|
||||
$('div#label-edit li').css('border', '1px solid white');
|
||||
$(element).parent().css('border', '1px solid #eee');
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$('#editLabelArea').remove();
|
||||
$('div#label-edit li').css('border', '1px solid white');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user