Refactoring to implement new layout with filters: board/calendar/list views (work in progress)
This commit is contained in:
@@ -37,10 +37,11 @@ body {
|
||||
padding-bottom: 20px;
|
||||
color: #333;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
ul.no-bullet li {
|
||||
@@ -67,7 +68,18 @@ hr {
|
||||
.avatar {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}/* links */
|
||||
}
|
||||
|
||||
.views {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.views li.active a {
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
/* links */
|
||||
a {
|
||||
color: #3366CC;
|
||||
border: none;
|
||||
@@ -717,7 +729,7 @@ nav .active a {
|
||||
|
||||
/* page header */
|
||||
.page-header {
|
||||
margin-bottom: 25px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.page-header h2 {
|
||||
@@ -748,6 +760,10 @@ nav .active a {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.page-header form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
|
||||
.page-header-mobile li {
|
||||
@@ -755,15 +771,6 @@ nav .active a {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
/* board filters */
|
||||
.board-filters {
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
#more-filters {
|
||||
display: none; /* Hide this filter initially, to avoid re-layout */
|
||||
}
|
||||
|
||||
/* public board */
|
||||
.public-board {
|
||||
margin-top: 5px;
|
||||
@@ -1603,6 +1610,12 @@ span.task-board-date-overdue {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.page-header div.dropdown {
|
||||
font-size: 0.9em;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.page-header div.dropdown,
|
||||
.page-header ul.dropdown {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
@@ -142,16 +142,7 @@ th a:hover {
|
||||
|
||||
.column-70 {
|
||||
width: 70%;
|
||||
}/* board filters */
|
||||
.board-filters {
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
#more-filters {
|
||||
display: none; /* Hide this filter initially, to avoid re-layout */
|
||||
}
|
||||
|
||||
/* public board */
|
||||
}/* public board */
|
||||
.public-board {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
@@ -20,10 +20,11 @@ body {
|
||||
padding-bottom: 20px;
|
||||
color: #333;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
.page {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
ul.no-bullet li {
|
||||
@@ -50,4 +51,14 @@ hr {
|
||||
.avatar {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.views {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.views li.active a {
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
/* board filters */
|
||||
.board-filters {
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
#more-filters {
|
||||
display: none; /* Hide this filter initially, to avoid re-layout */
|
||||
}
|
||||
|
||||
/* public board */
|
||||
.public-board {
|
||||
margin-top: 5px;
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.page-header div.dropdown {
|
||||
font-size: 0.9em;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.page-header div.dropdown,
|
||||
.page-header ul.dropdown {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ nav .active a {
|
||||
|
||||
/* page header */
|
||||
.page-header {
|
||||
margin-bottom: 25px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.page-header h2 {
|
||||
@@ -97,6 +97,10 @@ nav .active a {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.page-header form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
|
||||
.page-header-mobile li {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,4 @@
|
||||
|
||||
Kanboard.Analytic = (function() {
|
||||
(function() {
|
||||
|
||||
// CFD diagram
|
||||
function drawCfd()
|
||||
@@ -185,6 +184,4 @@ Kanboard.Analytic = (function() {
|
||||
}
|
||||
});
|
||||
|
||||
return {};
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Common functions
|
||||
var Kanboard = (function() {
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Kanboard.Board = (function() {
|
||||
(function() {
|
||||
|
||||
var checkInterval = null;
|
||||
|
||||
@@ -243,7 +243,6 @@ Kanboard.Board = (function() {
|
||||
$("#main").append(data);
|
||||
Kanboard.InitAfterAjax();
|
||||
board_load_events();
|
||||
filter_apply();
|
||||
stack_show();
|
||||
compactview_reload();
|
||||
}
|
||||
@@ -264,7 +263,6 @@ Kanboard.Board = (function() {
|
||||
Kanboard.InitAfterAjax();
|
||||
board_unload_events();
|
||||
board_load_events();
|
||||
filter_apply();
|
||||
stack_show();
|
||||
compactview_reload();
|
||||
}
|
||||
@@ -273,93 +271,6 @@ Kanboard.Board = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Apply user or date filter (change tasks opacity)
|
||||
function filter_apply()
|
||||
{
|
||||
var selectedUserId = $("#form-user_id").val();
|
||||
var selectedCategoryId = $("#form-category_id").val();
|
||||
var filterDueDate = $("#more-filters option[value=filter-due-date]").is(":selected")
|
||||
var filterRecent = $("#more-filters option[value=filter-recent]").is(":selected")
|
||||
var projectId = $('#board').data('project-id');
|
||||
|
||||
$("[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");
|
||||
var recent = $(item).hasClass("task-board-recent");
|
||||
|
||||
if (ownerId != selectedUserId && selectedUserId != -1) {
|
||||
item.style.display = "none";
|
||||
}
|
||||
else {
|
||||
item.style.display = "block";
|
||||
}
|
||||
|
||||
if (filterDueDate && (dueDate == "" || dueDate == "0")) {
|
||||
item.style.display = "none";
|
||||
}
|
||||
|
||||
if (categoryId != selectedCategoryId && selectedCategoryId != -1) {
|
||||
item.style.display = "none";
|
||||
}
|
||||
|
||||
if (filterRecent && ! recent) {
|
||||
item.style.display = "none";
|
||||
}
|
||||
});
|
||||
|
||||
// Save filter settings
|
||||
Kanboard.SetStorageItem("board_filter_" + projectId + "_form-user_id", selectedUserId);
|
||||
Kanboard.SetStorageItem("board_filter_" + projectId + "_form-category_id", selectedCategoryId);
|
||||
Kanboard.SetStorageItem("board_filter_" + projectId + "_filter-due-date", ~~(filterDueDate));
|
||||
Kanboard.SetStorageItem("board_filter_" + projectId + "_filter-recent", ~~(filterRecent));
|
||||
}
|
||||
|
||||
// Load filter events
|
||||
function filter_load_events()
|
||||
{
|
||||
var projectId = $('#board').data('project-id');
|
||||
|
||||
$("#form-user_id").chosen({
|
||||
width: "180px",
|
||||
no_results_text: $("#form-user_id").data("notfound")
|
||||
});
|
||||
|
||||
$("#form-category_id").chosen({
|
||||
width: "200px",
|
||||
no_results_text: $("#form-category_id").data("notfound")
|
||||
});
|
||||
|
||||
$("#more-filters").chosen({
|
||||
width: "30%",
|
||||
no_results_text: $("#more-filters").data("notfound")
|
||||
});
|
||||
|
||||
$(".apply-filters").change(function(e) {
|
||||
filter_apply();
|
||||
});
|
||||
|
||||
// Get and set filters from localStorage
|
||||
$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-user_id") || -1);
|
||||
$("#form-user_id").trigger("chosen:updated");
|
||||
|
||||
$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-category_id") || -1);
|
||||
$("#form-category_id").trigger("chosen:updated");
|
||||
|
||||
if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) {
|
||||
$("#more-filters option[value=filter-due-date]").attr("selected", true);
|
||||
}
|
||||
|
||||
if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-recent")) {
|
||||
$("#more-filters option[value=filter-recent]").attr("selected", true);
|
||||
}
|
||||
|
||||
$("#more-filters").trigger("chosen:updated");
|
||||
|
||||
filter_apply();
|
||||
}
|
||||
|
||||
function compactview_load_events()
|
||||
{
|
||||
jQuery(document).on('click', ".filter-toggle-scrolling", function(e) {
|
||||
@@ -401,7 +312,6 @@ Kanboard.Board = (function() {
|
||||
|
||||
if (Kanboard.Exists("board")) {
|
||||
board_load_events();
|
||||
filter_load_events();
|
||||
stack_load_events();
|
||||
compactview_load_events();
|
||||
keyboard_shortcuts();
|
||||
|
||||
@@ -1,150 +1,50 @@
|
||||
Kanboard.Calendar = (function() {
|
||||
|
||||
var filter_storage_key = "";
|
||||
|
||||
// Save the new due date for a moved task
|
||||
function move_calendar_event(calendar_event)
|
||||
{
|
||||
var url = $("#calendar").data("save-url") || $("#user-calendar").data("save-url");
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url: url,
|
||||
contentType: "application/json",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
data: JSON.stringify({
|
||||
"task_id": calendar_event.id,
|
||||
"date_due": calendar_event.start.format()
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// Show the user calendar
|
||||
function show_user_calendar()
|
||||
{
|
||||
var calendar = $("#user-calendar");
|
||||
|
||||
calendar.fullCalendar({
|
||||
lang: $("body").data("js-lang"),
|
||||
editable: true,
|
||||
eventLimit: true,
|
||||
defaultView: "month",
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
viewRender: refresh_user_calendar,
|
||||
eventDrop: move_calendar_event
|
||||
});
|
||||
}
|
||||
|
||||
// Refresh the calendar events
|
||||
function refresh_user_calendar()
|
||||
{
|
||||
var calendar = $("#user-calendar");
|
||||
var url = calendar.data("check-url");
|
||||
var params = {
|
||||
"start": calendar.fullCalendar('getView').start.format(),
|
||||
"end": calendar.fullCalendar('getView').end.format(),
|
||||
"user_id": calendar.data("user-id")
|
||||
};
|
||||
|
||||
for (var key in params) {
|
||||
url += "&" + key + "=" + params[key];
|
||||
}
|
||||
|
||||
$.getJSON(url, function(events) {
|
||||
calendar.fullCalendar('removeEvents');
|
||||
calendar.fullCalendar('addEventSource', events);
|
||||
calendar.fullCalendar('rerenderEvents');
|
||||
});
|
||||
}
|
||||
|
||||
// Show the project calendar
|
||||
function show_project_calendar()
|
||||
{
|
||||
var calendar = $("#calendar");
|
||||
|
||||
calendar.fullCalendar({
|
||||
lang: $("body").data("js-lang"),
|
||||
editable: true,
|
||||
eventLimit: true,
|
||||
defaultView: "month",
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
viewRender: load_project_filters,
|
||||
eventDrop: move_calendar_event
|
||||
});
|
||||
}
|
||||
|
||||
// Refresh the calendar events
|
||||
function refresh_project_calendar(filters)
|
||||
{
|
||||
var calendar = $("#calendar");
|
||||
var url = calendar.data("check-url");
|
||||
var params = {
|
||||
"start": calendar.fullCalendar('getView').start.format(),
|
||||
"end": calendar.fullCalendar('getView').end.format()
|
||||
};
|
||||
|
||||
jQuery.extend(params, filters);
|
||||
|
||||
for (var key in params) {
|
||||
url += "&" + key + "=" + params[key];
|
||||
}
|
||||
|
||||
$.getJSON(url, function(events) {
|
||||
calendar.fullCalendar('removeEvents');
|
||||
calendar.fullCalendar('addEventSource', events);
|
||||
calendar.fullCalendar('rerenderEvents');
|
||||
});
|
||||
}
|
||||
|
||||
// Restore saved filters
|
||||
function load_project_filters()
|
||||
{
|
||||
var filters = Kanboard.GetStorageItem(filter_storage_key);
|
||||
|
||||
if (filters !== "") {
|
||||
filters = JSON.parse(filters);
|
||||
|
||||
for (var filter in filters) {
|
||||
$("select[name=" + filter + "]").val(filters[filter]);
|
||||
}
|
||||
}
|
||||
|
||||
refresh_project_calendar(filters || {});
|
||||
|
||||
$('.calendar-filter').change(apply_project_filters);
|
||||
}
|
||||
|
||||
// Apply filters on change
|
||||
function apply_project_filters()
|
||||
{
|
||||
var filters = {};
|
||||
|
||||
$('.calendar-filter').each(function() {
|
||||
filters[$(this).attr("name")] = $(this).val();
|
||||
});
|
||||
|
||||
Kanboard.SetStorageItem(filter_storage_key, JSON.stringify(filters));
|
||||
refresh_project_calendar(filters);
|
||||
}
|
||||
(function() {
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
if (Kanboard.Exists("calendar")) {
|
||||
filter_storage_key = "calendar_filters_" + $("#calendar").data("project-id");
|
||||
show_project_calendar();
|
||||
load_project_filters();
|
||||
}
|
||||
else if (Kanboard.Exists("user-calendar")) {
|
||||
show_user_calendar();
|
||||
var calendar = $('#calendar');
|
||||
|
||||
calendar.fullCalendar({
|
||||
lang: $("body").data("js-lang"),
|
||||
editable: true,
|
||||
eventLimit: true,
|
||||
defaultView: "month",
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
eventDrop: function(event) {
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url: calendar.data("save-url"),
|
||||
contentType: "application/json",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
data: JSON.stringify({
|
||||
"task_id": event.id,
|
||||
"date_due": event.start.format()
|
||||
})
|
||||
});
|
||||
},
|
||||
viewRender: function() {
|
||||
var url = calendar.data("check-url");
|
||||
var params = {
|
||||
"start": calendar.fullCalendar('getView').start.format(),
|
||||
"end": calendar.fullCalendar('getView').end.format()
|
||||
};
|
||||
|
||||
for (var key in params) {
|
||||
url += "&" + key + "=" + params[key];
|
||||
}
|
||||
|
||||
$.getJSON(url, function(events) {
|
||||
calendar.fullCalendar('removeEvents');
|
||||
calendar.fullCalendar('addEventSource', events);
|
||||
calendar.fullCalendar('rerenderEvents');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Kanboard.Swimlane = (function() {
|
||||
(function() {
|
||||
|
||||
// Expand a Swimlane via display attributes
|
||||
function expand(swimlaneId)
|
||||
|
||||
Reference in New Issue
Block a user