diff --git a/src/api/helpers/BeanLoader.php b/src/api/helpers/BeanLoader.php index 0dc5868..b39c9d7 100644 --- a/src/api/helpers/BeanLoader.php +++ b/src/api/helpers/BeanLoader.php @@ -9,9 +9,9 @@ class BeanLoader { $attachment->filename = isset($data->filename) ? $data->filename : ''; $attachment->name = isset($data->name) ? $data->name : ''; $attachment->type = isset($data->type) ? $data->type : ''; - $attachment->user_id = isset($data->user_id) ? $data->user_id : ''; + $attachment->user_id = isset($data->user_id) ? $data->user_id : -1; $attachment->timestamp = time(); - $attachment->task_id = isset($data->task_id) ? $data->task_id : ''; + $attachment->task_id = isset($data->task_id) ? $data->task_id : -1; if (!isset($data->filename) || !isset($data->name) || !isset($data->type) || !isset($data->user_id) || @@ -25,11 +25,11 @@ class BeanLoader { public static function LoadAutoAction(&$action, $json) { $data = json_decode($json); - $action->trigger = isset($data->trigger) ? $data->trigger : ''; - $action->source_id = isset($data->source_id) ? $data->source_id: ''; + $action->trigger = isset($data->trigger) ? $data->trigger : -1; + $action->source_id = isset($data->source_id) ? $data->source_id: -1; $action->type = isset($data->type) ? $data->type : ''; - $action->change_to = isset($data->change_to) ? $data->change_to: ''; - $action->board_id = isset($data->board_id) ? $data->board_id: ''; + $action->change_to = isset($data->change_to) ? $data->change_to: -1; + $action->board_id = isset($data->board_id) ? $data->board_id: -1; if (!isset($data->trigger) || !isset($data->type) || !isset($data->board_id)) { @@ -43,7 +43,7 @@ class BeanLoader { $data = json_decode($json); $board->name = isset($data->name) ? $data->name : ''; - $board->is_active = isset($data->is_active) ? $data->is_active : ''; + $board->is_active = isset($data->is_active) ? $data->is_active : false; if (isset($data->categories)) { self::updateObjectList('category', 'LoadCategory', @@ -89,7 +89,7 @@ class BeanLoader { $category->name = isset($data->name) ? $data->name : ''; $category->default_task_color = isset($data->default_task_color) ? $data->default_task_color : ''; - $category->board_id = isset($data->board_id) ? $data->board_id : ''; + $category->board_id = isset($data->board_id) ? $data->board_id : -1; if (!isset($data->name) || !isset($data->default_task_color) || !isset($data->board_id)) { @@ -103,8 +103,9 @@ class BeanLoader { $data = json_decode($json); $column->name = isset($data->name) ? $data->name : ''; - $column->position = isset($data->position) ? $data->position : ''; - $column->board_id = isset($data->board_id) ? $data->board_id : ''; + $column->position = isset($data->position) ? $data->position : -1; + $column->board_id = isset($data->board_id) ? $data->board_id : -1; + $column->task_limit = isset($data->task_limit) ? $data->task_limit : 0; if (isset($data->tasks)) { self::updateObjectList('task', 'LoadTask', @@ -123,8 +124,8 @@ class BeanLoader { $data = json_decode($json); $comment->text = isset($data->text) ? $data->text : ''; - $comment->user_id = isset($data->user_id) ? $data->user_id : ''; - $comment->task_id = isset($data->task_id) ? $data->task_id : ''; + $comment->user_id = isset($data->user_id) ? $data->user_id : -1; + $comment->task_id = isset($data->task_id) ? $data->task_id : -1; if (!isset($data->text) || !isset($data->user_id) || !isset($data->task_id)) { @@ -139,7 +140,7 @@ class BeanLoader { $tracker->url = isset($data->url) ? $data->url : ''; $tracker->regex = isset($data->regex) ? $data->regex : ''; - $tracker->board_id = isset($data->board_id) ? $data->board_id : ''; + $tracker->board_id = isset($data->board_id) ? $data->board_id : -1; if (!isset($data->url) || !isset($data->regex) || !isset($data->board_id)) { @@ -157,9 +158,9 @@ class BeanLoader { ? $data->description : ''; $task->color = isset($data->color) ? $data->color : ''; $task->due_date = isset($data->due_date) ? $data->due_date : ''; - $task->points = isset($data->points) ? $data->points : ''; - $task->position = isset($data->position) ? $data->position : ''; - $task->column_id = isset($data->column_id) ? $data->column_id : ''; + $task->points = isset($data->points) ? $data->points : 0; + $task->position = isset($data->position) ? $data->position : -1; + $task->column_id = isset($data->column_id) ? $data->column_id : -1; if (isset($data->comments)) { self::updateObjectList('comment', 'LoadComment', @@ -207,13 +208,13 @@ class BeanLoader { $data = json_decode($json); $user->security_level = isset($data->security_level) - ? $data->security_level : ''; + ? $data->security_level : -1; $user->username = isset($data->username) ? $data->username : ''; $user->email = isset($data->email) ? $data->email : ''; $user->default_board_id = isset($data->default_board_id) - ? $data->default_board_id : ''; + ? $data->default_board_id : -1; $user->user_option_id = isset($data->user_option_id) - ? $data->user_option_id : ''; + ? $data->user_option_id : -1; $user->last_login = isset($data->last_login) ? $data->last_login : ''; $user->password_hash = isset($data->password_hash) ? $data->password_hash : ''; @@ -229,13 +230,13 @@ class BeanLoader { $data = json_decode($json); $opts->new_tasks_at_bottom = isset($data->new_tasks_at_bottom) - ? (boolean)$data->new_tasks_at_bottom : ''; + ? (boolean)$data->new_tasks_at_bottom : true; $opts->show_animations = isset($data->show_animations) - ? (boolean)$data->show_animations : ''; + ? (boolean)$data->show_animations : true; $opts->show_assignee = isset($data->show_assignee) - ? (boolean)$data->show_assignee : ''; + ? (boolean)$data->show_assignee : true; $opts->multiple_tasks_per_row = isset($data->multiple_tasks_per_row) - ? (boolean)$data->multiple_tasks_per_row : ''; + ? (boolean)$data->multiple_tasks_per_row : false; $opts->language = isset($data->language) ? $data->language : ''; diff --git a/src/app/board/column/column.component.html b/src/app/board/column/column.component.html index 0c40aa8..54b5b19 100644 --- a/src/app/board/column/column.component.html +++ b/src/app/board/column/column.component.html @@ -18,6 +18,19 @@ title="Expand Column" (click)="toggleCollapsed()"> + + + {{ columnData.tasks.length + ' / ' + columnData.task_limit }} + + + + +
+ +
+
diff --git a/src/app/board/column/column.component.ts b/src/app/board/column/column.component.ts index c9add0e..819c003 100644 --- a/src/app/board/column/column.component.ts +++ b/src/app/board/column/column.component.ts @@ -32,6 +32,7 @@ export class ColumnDisplay implements OnInit { private templateElement: any; private collapseTasks: boolean; private saving: boolean; + private hasTaskLimit: boolean; private activeUser: User; private activeBoard: Board; diff --git a/src/app/shared/models/board.model.ts b/src/app/shared/models/board.model.ts index bea46af..0cbc3a7 100644 --- a/src/app/shared/models/board.model.ts +++ b/src/app/shared/models/board.model.ts @@ -30,6 +30,7 @@ export class Board { column.name, +column.position, +column.board_id, + +column.task_limit, column.ownTask)); }); diff --git a/src/app/shared/models/column.model.ts b/src/app/shared/models/column.model.ts index f98cc77..f11cecc 100644 --- a/src/app/shared/models/column.model.ts +++ b/src/app/shared/models/column.model.ts @@ -7,6 +7,7 @@ export class Column { public name: string = '', public position: number = 0, public board_id: number = 0, // tslint:disable-line + public task_limit: number = 0, // tslint:disable-line ownTask: Array = []) { this.tasks = []; @@ -25,5 +26,9 @@ export class Column { task.sharedCategory || task.categories)); }); } + + hasTaskLimit() { + return this.task_limit > 0; + } } diff --git a/src/app/shared/models/user.model.ts b/src/app/shared/models/user.model.ts index 11abff2..106c900 100644 --- a/src/app/shared/models/user.model.ts +++ b/src/app/shared/models/user.model.ts @@ -3,11 +3,19 @@ export class User { public email: string = '', public id: number = 0, public last_login: Date = null, // tslint:disable-line - public security_level: number = 3, // tslint:disable-line + public security_level: number = 4, // tslint:disable-line public user_option_id: number = 0, // tslint:disable-line public username: string = '', public board_access: Array = [], // tslint:disable-line public collapsed: Array = []) { } + + isAdmin() { + return this.security_level === 1; + } + + isBoardAdmin() { + return this.security_level === 2; + } } diff --git a/src/scss/_board.scss b/src/scss/_board.scss index eeacf11..acb35d4 100644 --- a/src/scss/_board.scss +++ b/src/scss/_board.scss @@ -56,6 +56,16 @@ cursor: pointer; } + .count { + cursor: default; + } + + .count-editor { + float: right; + font-size: .5em; + margin-top: -4px; + } + .icon-angle-double-up, .badge { display: none; @@ -100,6 +110,7 @@ } .badge { + cursor: default; display: inline-block; font-size: .6em; margin-left: .9em; @@ -110,6 +121,7 @@ .icon-minus-squared-alt, .icon-plus-squared-alt, .tasks, + .count, .quick-add { display: none; }