2012-02-14 16:05:41 +00:00
|
|
|
$(document).ready(function() {
|
2012-02-23 14:48:31 +00:00
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$("#manage-labels").on('click', function () {
|
2012-02-23 14:48:31 +00:00
|
|
|
var toggled = $(this).data('toggled');
|
|
|
|
$(this).data('toggled', !toggled);
|
|
|
|
if (!toggled) {
|
2012-02-23 16:16:04 +00:00
|
|
|
$("#labels-stock").fadeOut(0);
|
|
|
|
$("#labels-edit").fadeIn("slow");
|
2012-02-23 14:48:31 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-02-23 16:16:04 +00:00
|
|
|
$("#labels-edit").fadeOut(0);
|
|
|
|
$("#labels-stock").fadeIn("slow");
|
2012-02-23 14:48:31 +00:00
|
|
|
}
|
2012-02-14 16:05:41 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$("div.div-tracker-labels").on('click', function() {
|
2012-02-27 16:10:12 +00:00
|
|
|
return send_index_tracker_request('GET');
|
2012-02-23 14:48:31 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$("#table1.issues-table .pagination a").on('click', function() {
|
2013-09-10 18:03:00 +01:00
|
|
|
updatePagination($(this));
|
2013-03-19 11:57:01 +00:00
|
|
|
return send_index_tracker_request('GET');
|
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$(".issues-filter .tabnav-tabs li").on('click', function() {
|
2013-03-19 11:57:01 +00:00
|
|
|
var li = $(this);
|
|
|
|
var items = $('.issues-filter .tabnav-tabs');
|
|
|
|
if (li.hasClass('list-browser-sorts')) {
|
|
|
|
if (li.hasClass('selected')) {
|
|
|
|
var direction = li.hasClass('asc') ? 'desc' : 'asc';
|
|
|
|
li.removeClass('asc').removeClass('desc').addClass(direction);
|
|
|
|
} else {
|
|
|
|
items.find('.list-browser-sorts').removeClass('selected');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
items.find('.list-browser-filter-tabs').removeClass('selected');
|
|
|
|
}
|
|
|
|
li.addClass('selected');
|
|
|
|
return send_index_tracker_request('GET');
|
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$("#filter_issues #myradio1").on('change', function(event) {
|
2012-02-27 16:10:12 +00:00
|
|
|
return send_index_tracker_request('GET');
|
2012-02-14 16:05:41 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.ajax_search_form').on('submit', function() {
|
2013-03-19 15:30:50 +00:00
|
|
|
return send_index_tracker_request('GET', $(this).attr("action"));
|
2012-02-23 14:48:31 +00:00
|
|
|
});
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('#add_label').on('click', function() {
|
2012-02-27 16:10:12 +00:00
|
|
|
return send_index_tracker_request('POST', $(this).attr("href"), $('#new_label').serialize());
|
2012-02-23 14:48:31 +00:00
|
|
|
});
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.righter #update_label').on('click', function() {
|
2012-02-27 16:10:12 +00:00
|
|
|
return send_index_tracker_request('POST', $(this).attr("href"), $(this).parents('#update_label').serialize());
|
2012-02-23 14:48:31 +00:00
|
|
|
});
|
2012-02-20 16:54:45 +00:00
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.colors .choose').on('click', function() {
|
2012-02-23 14:48:31 +00:00
|
|
|
var parent = $(this).parents('.colors');
|
|
|
|
parent.find('.choose.selected').removeClass('selected');
|
|
|
|
$(this).addClass('selected');
|
|
|
|
parent.siblings('.lefter').find('#label_color').val($(this).attr('value'));
|
2012-02-23 16:16:04 +00:00
|
|
|
return false;
|
2012-02-23 14:48:31 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.custom_color').on('click', function() {
|
2012-02-23 14:48:31 +00:00
|
|
|
$(this).siblings('#label_color').toggle();
|
2012-02-20 16:54:45 +00:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('article a.edit_label').on('click', function() {
|
2012-02-23 14:48:31 +00:00
|
|
|
$(this).parents('.label.edit').siblings('.label.edit').find('.edit_label_form').hide();
|
|
|
|
$(this).parents('.label.edit').find('.edit_label_form').toggle();
|
|
|
|
return false;
|
2012-02-20 16:54:45 +00:00
|
|
|
});
|
2012-02-23 14:48:31 +00:00
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.delete_label').on('click', function() {
|
2012-02-27 16:10:12 +00:00
|
|
|
return send_index_tracker_request('POST', $(this).attr('href'));
|
2012-02-23 14:48:31 +00:00
|
|
|
});
|
|
|
|
|
2012-02-27 16:10:12 +00:00
|
|
|
function send_index_tracker_request(type_request, url, data) {
|
2012-02-23 14:48:31 +00:00
|
|
|
data = data || '';
|
|
|
|
var filter_form = $('#filter_issues');
|
|
|
|
url = url || filter_form.attr("action");
|
|
|
|
var label_form = $('#filter_labels');
|
2013-03-19 11:57:01 +00:00
|
|
|
var issues_filter = $('.issues-filter');
|
|
|
|
var status = 'status=' + (issues_filter.find('.open').hasClass('selected') ? 'open' : 'closed');
|
|
|
|
var direction = 'direction=' + (issues_filter.find('.list-browser-sorts').hasClass('asc') ? 'asc' : 'desc');
|
|
|
|
var sort = 'sort=' + (issues_filter.find('.list-browser-sorts.updated').hasClass('selected') ? 'updated' : 'created');
|
|
|
|
var page = $('.pagination .current').text();
|
|
|
|
page = 'page=' + (page.length == 0 ? 1 : page);
|
2012-02-23 14:48:31 +00:00
|
|
|
$.ajax({
|
|
|
|
type: type_request,
|
|
|
|
url: url,
|
2013-03-19 15:30:50 +00:00
|
|
|
data: filter_form.serialize() + '&' + label_form.serialize() + '&' + status + '&' + direction + '&' + sort + '&' + page + '&' + data + '&' + $('.ajax_search_form').serialize(),
|
2012-02-23 14:48:31 +00:00
|
|
|
success: function(data){
|
|
|
|
$('article').html(data);
|
|
|
|
$(".niceRadio").each(function() { changeRadioStart(jQuery(this)) });
|
2013-09-01 13:06:42 +01:00
|
|
|
updateTime();
|
2012-02-23 14:48:31 +00:00
|
|
|
},
|
|
|
|
error: function(data){
|
2012-02-23 16:16:04 +00:00
|
|
|
alert('error') // TODO remove
|
2012-02-23 14:48:31 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2013-03-21 18:14:07 +00:00
|
|
|
$('#search_user').on('keyup', function() {
|
2013-09-10 18:03:00 +01:00
|
|
|
path = $('#search_user_path').attr('path');
|
|
|
|
data = $(this).serialize();
|
2014-04-09 22:20:39 +01:00
|
|
|
// dom = $('#manage_issue_users_list');
|
|
|
|
dom = $('#assigned-popup .list');
|
2013-09-10 18:03:00 +01:00
|
|
|
return search_items(path, data, dom);
|
2012-02-27 16:10:12 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.users-search-popup .header .icon-remove-circle').on('click', function() {
|
2013-08-07 17:27:24 +01:00
|
|
|
$('.users-search-popup').hide();
|
2013-03-20 15:06:25 +00:00
|
|
|
});
|
2012-02-27 16:10:12 +00:00
|
|
|
|
2014-04-09 22:20:39 +01:00
|
|
|
$(document).on('click', '#assigned-container .icon-share', function() {
|
2013-03-20 15:06:25 +00:00
|
|
|
$('#assigned-popup').show();
|
2012-02-27 16:10:12 +00:00
|
|
|
});
|
|
|
|
|
2014-04-09 22:20:39 +01:00
|
|
|
$(document).on('click', '#assigned-popup .people.selected', function() {
|
2013-03-20 15:06:25 +00:00
|
|
|
var form = $('#assigned-popup .edit_assignee');
|
2013-03-20 20:36:22 +00:00
|
|
|
var item = $(this);
|
|
|
|
if (form.length == 0) {
|
|
|
|
updateAssignedUser(item);
|
|
|
|
return false;
|
|
|
|
}
|
2013-03-20 15:06:25 +00:00
|
|
|
$.ajax({
|
|
|
|
type: 'PUT',
|
|
|
|
url: form.attr("action"),
|
|
|
|
data: $(this).find('input').serialize(),
|
|
|
|
success: function(data){
|
2013-03-20 20:36:22 +00:00
|
|
|
updateAssignedUser(item);
|
2013-03-20 15:06:25 +00:00
|
|
|
},
|
|
|
|
error: function(data){
|
|
|
|
alert('error'); // TODO remove
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
2012-02-27 16:10:12 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.add_label.label').on('click', function() {
|
2012-02-28 09:23:27 +00:00
|
|
|
$(this).addClass('selected').removeClass('add_label').addClass('remove_label');
|
|
|
|
$(this).find('.labeltext').addClass('selected');
|
|
|
|
var style = $(this).find('.flag').attr('style');
|
|
|
|
$(this).find('.flag').fadeOut(0);
|
|
|
|
$(this).find('.labeltext.selected').attr('style', style);
|
2012-03-06 15:20:29 +00:00
|
|
|
var form_new = $('form.form.issue');
|
|
|
|
var clone = $(this).clone();
|
|
|
|
form_new.find('#flag-span').fadeOut(0);
|
|
|
|
form_new.find('#issue_labels').append(clone);
|
2012-03-07 13:36:17 +00:00
|
|
|
var labels = $('.manage_labels');
|
|
|
|
labels.append($(this).find('#'+$(this).attr('id')));
|
2012-02-27 16:10:12 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.remove_label.label.selected').on('click', function() {
|
2012-03-06 15:20:29 +00:00
|
|
|
var id = $(this).attr('id');
|
2012-03-07 13:36:17 +00:00
|
|
|
$('.manage_labels, #active_labels').find('#'+id+'.label.selected.remove_label').remove();
|
2012-02-27 16:10:12 +00:00
|
|
|
var form = $('.form.issue');
|
|
|
|
if(form.find('.remove_label.label.selected').length == 1) {
|
|
|
|
form.find('#flag-span').fadeIn(0);
|
|
|
|
}
|
2012-03-06 15:20:29 +00:00
|
|
|
var str = '.label.remove_label'+'#'+id;
|
2012-02-28 09:23:27 +00:00
|
|
|
form.find(str).remove();
|
|
|
|
var label = $(str);
|
|
|
|
label.removeClass('selected').addClass('add_label').removeClass('remove_label');
|
|
|
|
label.find('.labeltext.selected').attr('style', '').removeClass('selected');
|
|
|
|
label.find('.flag').fadeIn(0);
|
2012-03-07 13:36:17 +00:00
|
|
|
$('.manage_labels').find('#'+$(this).attr('id')).remove();
|
2012-02-27 16:10:12 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.issue_status.switch_issue_status').on('click', function () {
|
2012-02-28 14:05:18 +00:00
|
|
|
var button = $(this);
|
|
|
|
var status = (button.hasClass('switcher')) ? 'closed' : 'open';
|
|
|
|
var form = $('#update_issue_status');
|
|
|
|
form.find('#issue_status').attr('value', status);
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: form.attr("action"),
|
|
|
|
data: form.serialize(),
|
|
|
|
success: function(data){
|
|
|
|
if (status == "open") { button.addClass('switcher').removeClass("switcher-off"); }
|
|
|
|
else { button.removeClass('switcher').addClass("switcher-off"); }
|
|
|
|
$('#closed_issue_text').html(data);
|
|
|
|
},
|
|
|
|
error: function(data){
|
|
|
|
alert('error') // TODO remove
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('#edit_issue_content').on('click', function() {
|
2012-02-28 16:32:36 +00:00
|
|
|
$('.edit_form.issue').fadeIn('fast');
|
|
|
|
$(this).fadeOut('fast');
|
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('#cancel_edit_issue_content').on('click', function() {
|
2012-02-28 16:32:36 +00:00
|
|
|
$('.edit_form.issue').fadeOut('fast');
|
|
|
|
$('#edit_issue_content').fadeIn('fast');
|
2012-02-28 15:41:47 +00:00
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.edit_form.issue').on('submit', function() {
|
2012-02-28 15:41:47 +00:00
|
|
|
var form = $(this);
|
2012-09-24 18:34:14 +01:00
|
|
|
form.parent().find('.flash').remove();
|
2012-02-28 15:41:47 +00:00
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: form.attr("action"),
|
|
|
|
data: form.serialize(),
|
|
|
|
success: function(data){
|
|
|
|
form.fadeOut('slow');
|
|
|
|
$('#edit_issue_content').fadeIn('slow');
|
|
|
|
$('h3.issue_title').html(form.find('#issue_title').attr('value'));
|
2014-04-15 10:11:14 +01:00
|
|
|
$('.fulltext.view.issue_body').html(data);
|
2012-02-28 15:41:47 +00:00
|
|
|
},
|
|
|
|
error: function(data){
|
2012-09-24 18:34:14 +01:00
|
|
|
form.before(data.responseText);
|
2012-02-28 15:41:47 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.button.manage_labels').on('click', function() {
|
2012-03-07 16:26:43 +00:00
|
|
|
$('.button.update_labels').fadeIn(0);
|
2012-03-07 13:36:17 +00:00
|
|
|
$('.current_labels .label .labeltext.selected').parent().addClass('remove_label selected').removeClass('nopointer');
|
|
|
|
$('.current_labels .label .labeltext:not(.selected)').parent().addClass('add_label').removeClass('nopointer');
|
2012-03-06 15:20:29 +00:00
|
|
|
$(this).fadeOut(0);
|
|
|
|
});
|
|
|
|
|
2014-03-13 10:09:00 +00:00
|
|
|
$('.button.update_labels').on('click', function() {
|
2012-03-06 15:20:29 +00:00
|
|
|
var form = $('form.edit_labels.issue');
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: form.attr("action"),
|
|
|
|
data: form.serialize(),
|
|
|
|
success: function(data){
|
2012-03-07 10:50:45 +00:00
|
|
|
$('.current_labels .label').removeClass('remove_label selected').addClass('nopointer');
|
2012-03-07 16:26:43 +00:00
|
|
|
$('.button.update_labels').fadeOut(0);
|
2012-03-06 15:20:29 +00:00
|
|
|
$('.button.manage_labels').fadeIn(0);
|
|
|
|
$('#manage_issue_labels_list').html('');
|
|
|
|
},
|
|
|
|
error: function(data){
|
|
|
|
alert('error'); // TODO remove
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2012-02-20 16:54:45 +00:00
|
|
|
});
|
2013-03-20 20:36:22 +00:00
|
|
|
|
|
|
|
function updateAssignedUser(item) {
|
|
|
|
$('#assigned-popup').hide();
|
|
|
|
var container = item.find('.container').clone();
|
2013-03-21 10:54:47 +00:00
|
|
|
$('#assigned-container .user-container').empty().append(container.html()).append('<span class="icon-share"></span>');
|
2013-03-20 20:36:22 +00:00
|
|
|
}
|
2013-03-20 20:48:24 +00:00
|
|
|
|
|
|
|
function remLabel(form, id) {
|
|
|
|
var el = form.find('.label.remove_label'+'#'+id);
|
|
|
|
var label = $('#'+id+'.remove_label.label.selected');
|
|
|
|
label.find('.flag').fadeIn(0);
|
|
|
|
label.find('.labeltext.selected').removeClass('selected').attr('style', '');
|
|
|
|
label.fadeIn('slow');
|
|
|
|
el.fadeOut('slow').remove();
|
|
|
|
}
|