Skip to content

Commit

Permalink
Add task board.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbodwell committed Feb 9, 2017
1 parent ed67c7e commit 565754b
Show file tree
Hide file tree
Showing 15 changed files with 402 additions and 15 deletions.
9 changes: 8 additions & 1 deletion app/controllers/tasks_controller.rb
Expand Up @@ -59,9 +59,16 @@ def update_record
if @record.status_code == Story.Done && effort == nil
@record.effort = 0
end
if old_status == Story.Created && status != nil && status != Story.Created && @record.individual_id == nil && owner == nil
if status != nil && status != Story.Created && status != Story.Blocked && @record.individual_id == nil && owner == nil
@record.individual_id = current_individual.id
end
if @record.status_code == 2 && @record.story.status_code != 2
@record.story.status_code = 2;
@record.story.save
elsif @record.status_code > 0 && @record.story.status_code === 0
@record.story.status_code = 1;
@record.story.save
end
end

private
Expand Down
3 changes: 3 additions & 0 deletions src/app/main/components/header/header.component.html
Expand Up @@ -6,6 +6,9 @@
<li class="nav-item active" [routerLink]="['/stories']" routerLinkActive="active">
<a class="nav-link" [routerLink]="['/stories']">Stories</a>
</li>
<li class="nav-item active" [routerLink]="['/tasks']" routerLinkActive="active">
<a class="nav-link" [routerLink]="['/tasks']">Tasks</a>
</li>
<li class="nav-item active" *ngIf="user && user.is_premium && premiumService.isPremium()" [routerLink]="['/reports']" routerLinkActive="active">
<a class="nav-link" [routerLink]="['/reports']">Reports</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/components/login/login.component.html
Expand Up @@ -2,7 +2,7 @@
<div class="row">
<div class="account-wall mx-auto">
<img class="profile-img" src="images/logo.png" alt="Planigle logo">
<div class="text-xs-center">Version 2017.14</div>
<div class="text-xs-center">Version 2017.15</div>
<form class="form-signin">
<input [(ngModel)]="user.login" name="login" type="text" class="form-control" placeholder="User Name" required autofocus autocomplete="off">
<input [(ngModel)]="user.password" name="password" type="password" class="form-control" placeholder="Password" required autocomplete="off">
Expand Down
10 changes: 2 additions & 8 deletions src/app/main/components/stories/stories.component.ts
Expand Up @@ -660,18 +660,12 @@ export class StoriesComponent implements AfterViewInit, OnDestroy {
gridHolder.tasksService.update(changedTask).subscribe(
(task: Task) => {
gridHolder.updateGridForStatusChange(task);
let statusChanged = false;
if (changedTask.status_code === 2 && changedTask.story.status_code !== 2) {
changedTask.story.status_code = 2;
statusChanged = true;
gridHolder.updateGridForStatusChange(changedTask.story);
} else if (changedTask.status_code > 0 && changedTask.story.status_code === 0) {
changedTask.story.status_code = 1;
statusChanged = true;
}
if (statusChanged) {
gridHolder.storiesService.update(changedTask.story).subscribe(
(story: Story) => gridHolder.updateGridForStatusChange(changedTask.story),
(err) => gridHolder.processError.call(gridHolder, err));
gridHolder.updateGridForStatusChange(changedTask.story);
}
},
(err: any) => gridHolder.processError(err));
Expand Down
Empty file.
@@ -0,0 +1,3 @@
<div class="btn-group" role="group" aria-label="Actions">
<button type="button" class="btn btn-secondary" title="Get the latest data" (click)="refresh()"><fa [name]="'refresh'"></fa></button>
</div>
@@ -0,0 +1,28 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';

import { TaskOverallActionsComponent } from './task-overall-actions.component';

describe('TaskOverallActionsComponent', () => {
let component: TaskOverallActionsComponent;
let fixture: ComponentFixture<TaskOverallActionsComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TaskOverallActionsComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(TaskOverallActionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,15 @@
import { Component, Input } from '@angular/core';
import { TasksComponent } from '../tasks/tasks.component';

@Component({
selector: 'app-task-overall-actions',
templateUrl: './task-overall-actions.component.html',
styleUrls: ['./task-overall-actions.component.css']
})
export class TaskOverallActionsComponent {
@Input() grid: TasksComponent;

refresh(): void {
this.grid.refresh();
}
}
51 changes: 51 additions & 0 deletions src/app/main/components/tasks/tasks.component.css
@@ -0,0 +1,51 @@
:host /deep/ app-task-overall-actions .btn-group {
padding-top: 0px;
}

.board {
margin-top: 10px;
margin-bottom: 10px;
}

.row {
margin-left: 0px;
margin-right: 0px;
width: 100%;
}

.row:first-child {
border-top: 1px solid grey;
}

.square {
border-right: 1px solid grey;
border-bottom: 1px solid grey;
padding-left: 5px;
padding-right: 5px;
padding-bottom: 5px;
width: 20%;
}

.square:first-child {
border-left: 1px solid grey;
padding-top: 5px;
}

.title {
text-align: center;
font-weight: bold;
}

.task {
display: block;
width: 100%;
border: 1px solid grey;
padding: 5px;
margin-top: 5px;
cursor: pointer;
}

.owner {
display: block;
font-style: italic;
}
48 changes: 48 additions & 0 deletions src/app/main/components/tasks/tasks.component.html
@@ -0,0 +1,48 @@
<div class="container-fluid" >
<app-header></app-header>
<app-task-overall-actions [grid]="this"></app-task-overall-actions>
<div class="action-bar">
<select name="team" [(ngModel)]="team" *ngIf="teams.length>3" (change)="updateNavigation()">
<option *ngFor="let team of teams" [value]="team.id">
{{team.name}}
</option>
</select>
</div>
<template ngbModalContainer></template>
<table class="board">
<tr class="row">
<th class="square title">Story</th>
<th class="square title">Not Started</th>
<th class="square title">Blocked</th>
<th class="square title">In Progress</th>
<th class="square title">Done</th>
</tr>
<tr *ngFor="let story of stories" class="row" [attr.story]="story.id">
<td class="square story">{{story.name}}</td>
<td class="square droppable" valign="top" [attr.status]="0">
<span *ngFor="let task of story.tasks | filter: {status_code: 0}" class="task" [attr.story]="story.id" [attr.task]="task.id">
<span class="name">{{task.name}}</span>
<span class="owner" *ngIf="task.individual_name != null">{{task.individual_name}}</span>
</span>
</td>
<td class="square droppable" valign="top" [attr.status]="2">
<span *ngFor="let task of story.tasks | filter: {status_code: 2}" class="task" [attr.story]="story.id" [attr.task]="task.id">
<span class="name">{{task.name}}</span>
<span class="owner" *ngIf="task.individual_name != null">{{task.individual_name}}</span>
</span>
</td>
<td class="square droppable" valign="top" [attr.status]="1">
<span *ngFor="let task of story.tasks | filter: {status_code: 1}" class="task" [attr.story]="story.id" [attr.task]="task.id">
<span class="name">{{task.name}}</span>
<span class="owner" *ngIf="task.individual_name != null">{{task.individual_name}}</span>
</span>
</td>
<td class="square droppable" valign="top" [attr.status]="3">
<span *ngFor="let task of story.tasks | filter: {status_code: 3}" class="task" [attr.story]="story.id" [attr.task]="task.id">
<span class="name">{{task.name}}</span>
<span class="owner" *ngIf="task.individual_name != null">{{task.individual_name}}</span>
</span>
</td>
</tr>
</table>
</div>
28 changes: 28 additions & 0 deletions src/app/main/components/tasks/tasks.component.spec.ts
@@ -0,0 +1,28 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';

import { TasksComponent } from './tasks.component';

describe('TasksComponent', () => {
let component: TasksComponent;
let fixture: ComponentFixture<TasksComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TasksComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(TasksComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

0 comments on commit 565754b

Please sign in to comment.