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