Add categories for projects and tasks

This commit is contained in:
Frédéric Guillot
2014-05-21 22:33:57 -04:00
parent 57e40671af
commit a750b8ab2a
39 changed files with 815 additions and 44 deletions

View File

@@ -484,23 +484,26 @@ nav .active a {
}
.project-menu li {
padding-left: 5px;
display: inline;
padding-left: 10px;
padding-right: 10px;
border-right: 1px dotted #ccc;
}
.project-menu li:last-child {
border: none;
padding-right: 0;
}
.project-menu ul {
padding-bottom: 5px;
}
.project-menu a {
padding-right: 5px;
}
.project-menu {
text-align: right;
font-size: 0.8em;
}
.public-board {
@@ -540,7 +543,26 @@ a.filter-on {
color: #444;
}
.task-category-container {
text-align: right;
padding-bottom: 2px;
}
.task-category {
font-weight: bold;
font-size: 0.8em;
color: #000;
border: 1px solid #555;
border-radius: 4px;
padding: 2px;
padding-right: 5px;
padding-left: 5px;
}
.task-date {
position: absolute;
bottom: 0;
left: 5px;
font-weight: bold;
color: #D90000;
}
@@ -552,7 +574,7 @@ a.filter-on {
}
.task-footer {
margin-top: 10px;
height: 18px;
}
.task {

View File

@@ -76,7 +76,7 @@
$("#board").remove();
$("#main").append(data);
board_load_events();
filter_apply(filter_get_user_id(), filter_has_due_date());
filter_apply();
}
});
}
@@ -96,32 +96,25 @@
$("#main").append(data);
board_unload_events();
board_load_events();
filter_apply(filter_get_user_id(), filter_has_due_date());
filter_apply();
}
}
});
}
}
// Get the selected user id
function filter_get_user_id()
{
return $("#form-user_id").val();
}
// Return true if the filter is activated
function filter_has_due_date()
{
return $("#filter-due-date").hasClass("filter-on");
}
// Apply user or date filter (change tasks opacity)
function filter_apply(selectedUserId, filterDueDate)
function filter_apply()
{
var selectedUserId = $("#form-user_id").val();
var selectedCategoryId = $("#form-category_id").val();
var filterDueDate = $("#filter-due-date").hasClass("filter-on");
$("[data-task-id]").each(function(index, item) {
var ownerId = item.getAttribute("data-owner-id");
var dueDate = item.getAttribute("data-due-date");
var categoryId = item.getAttribute("data-category-id");
if (ownerId != selectedUserId && selectedUserId != -1) {
item.style.opacity = "0.2";
@@ -133,19 +126,23 @@
if (filterDueDate && (dueDate == "" || dueDate == "0")) {
item.style.opacity = "0.2";
}
if (categoryId != selectedCategoryId && selectedCategoryId != -1) {
item.style.opacity = "0.2";
}
});
}
// Load filter events
function filter_load_events()
{
$("#form-user_id").change(function() {
filter_apply(filter_get_user_id(), filter_has_due_date());
});
$("#form-user_id").change(filter_apply);
$("#form-category_id").change(filter_apply);
$("#filter-due-date").click(function(e) {
$(this).toggleClass("filter-on");
filter_apply(filter_get_user_id(), filter_has_due_date());
filter_apply();
e.preventDefault();
});
}