You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.3 KiB
Plaintext
73 lines
2.3 KiB
Plaintext
<%= javascript_tag do %>
|
|
function hidePbiColumnIfNeeded() {
|
|
isEmpty = true;
|
|
$('td.pbi-column').each(function(i) {
|
|
if (this.innerHTML.trim() != '') {
|
|
isEmpty = false;
|
|
}
|
|
});
|
|
var columnCells = $('th.pbi-column, td.pbi-column');
|
|
if (isEmpty) {
|
|
columnCells.hide();
|
|
} else {
|
|
columnCells.show();
|
|
}
|
|
}
|
|
$(document).ready(function() {
|
|
var $assignees = $("#tasks-assignees");
|
|
var users = { };
|
|
$assignees.append("<option value='all'><%= l(:label_any) %></option>");
|
|
$("table.sprint-board a.user").each(function(row_index, user_link) {
|
|
users[$.trim(user_link.text)] = row_index;
|
|
});
|
|
|
|
<% # put "Me" in first in the list %>
|
|
var current_user_name = '<%= User.current.name %>';
|
|
if (current_user_name in users) {
|
|
var label_me = '<< <%= l(:label_me) %> >>';
|
|
$assignees.append("<option value='" + current_user_name + "'>" + label_me + "</option>");
|
|
}
|
|
|
|
$.each(users, function(user, row_index) {
|
|
$assignees.append("<option value='" + user + "'>" + user + "</option>");
|
|
});
|
|
$assignees.change(function(user){
|
|
var user = $assignees.val();
|
|
if (user === "all") {
|
|
$("table.sprint-board tbody.sprint-board tr.sprint-board").show();
|
|
} else {
|
|
$("table.sprint-board tbody.sprint-board tr.sprint-board").hide();
|
|
$("table.sprint-board a.user:contains('" + user + "')").parents("tr.sprint-board").show();
|
|
}
|
|
});
|
|
|
|
<%- if User.current.allowed_to?(:sort_sprint_board, sprint.project) -%>
|
|
$("#<%= sprint_board_id %>").sortable({
|
|
handle: ".sprint-board-pbi-handle",
|
|
placeholder: "sprint-row-space",
|
|
update: function() {
|
|
if ($.isFunction($.fn.setupAjaxIndicator)) {
|
|
setupAjaxIndicator();
|
|
}
|
|
$.ajax({
|
|
url: "<%= sort_sprint_path(sprint) %>",
|
|
type: "POST",
|
|
data: $("#<%= sprint_board_id %>").sortable("serialize"),
|
|
dataType: "script",
|
|
error: function() {
|
|
alert("<%= l(:error_changing_pbi_order) %>");
|
|
location.reload(true);
|
|
},
|
|
complete: function() {
|
|
if ($.isFunction($.fn.hideOnLoad)) {
|
|
hideOnLoad();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
<%- end -%>
|
|
hidePbiColumnIfNeeded();
|
|
});
|
|
<% end %>
|