Merge Request #55
Add components that display tasks and allow accept/reject
-
Also change from ng-click to (click) when toggle role selection.
- 8 of 11 commits displayed. Click here to show all
-
Added 12 new commits:
- 8784fe3c - Ticket #116: Better display of recent activities
- 1e4736a4 - added events-hub service
- b3953cbd - improving adding a base interface EventsHubKnownEventNames
- 332c24ec - added changes to allow pass string[] or EventsHubKnownEventNames to EventsHubService constructor
- 328a7a82 - some small refactoring on class naming and changed to allow EVENTS_HUB_KNOW_EVEN…
- fb1e923a - Merge branch 'events-hub' into 'master'
- f0967aa0 - Add component to display tasks in menu
- 434c23df - Add component to list tasks
- ef871ad6 - Add accept/reject buttons to task list
- 51eac1ba - Add tests to task components
- 83f027df - List roles when accept add member tasks
- f25f5c3c - Accept parameters when accept/reject tasks
-
Reassigned to @mfdeveloper
-
Algum motivo especial em não ter utilizado a classe
ComponentTestHelper
neste teste? -
A forma que o
ComponentTestHelper
foi feito não funciona nesse caso por causa dothis.$element.replaceWith
que o componente executa na inicialização. -
Ok, entendi
-
Essa substituição e concatenação não seria + indicada em um método separado, contendo um teste unitário correspondente?
-
Os métodos
accept()
ereject()
me parecem que fazem a mesma coisa. Não seria interessante um método central, passando como parâmetro o que muda entre eles ? -
O mesmo que o comentário acima sobre o
accept()
ereject()
-
Não seria melhor substituir as chamadas a
ng-click=""
por(click)="method()"
no formato "Angular 2" de ser? -
@mfdeveloper feito!
-
Added 32 new commits:
- 3d2172f3 - Adds account register module
- bc91225e - Refactor of the account register component to uses service and restangular instead.
- 42443554 - Fixing registration - it is working now
- 503976b5 - add redirect to home in case of succeded signup
- e10ddb2a - Added notification when user is created
- 716c2a26 - Added welcome message for translation on signup
- 74b67520 - Refactory html template + new environment service property
- 64b0a116 - Added environment fields and ngMessages form validation
- 4c25e839 - Added the ng.ui.bootstrap typescript definitions
- 015b68e2 - Added the modal to show environment terms of use text
- 224b593d - Added module 'angular-password' to check password confir match
- a4dac9ec - Added unit tests and minor refactories
- b4a0a739 - Fix rebase with master adjusts
- 64000ab5 - Merge branch 'register_page' into 'master'
- 26ff5335 - Change txt navbar menuitem from 'Novo Artigo' to 'Novo post' on pt.json
- d3bba43c - Ticket #118: Profile images block
- 6596b7af - adding scrap activity in profile timeline
- e80a93b4 - change scrap timeline visualization
- de08c0f6 - Merge branch 'add_scrap_in_timeline' into 'master'
- 7309dec7 - Add button to join in community
- f3cb9503 - Merge branch 'join-community' into 'master'
- 4d167676 - Add component to display tasks in menu
- 917544be - Add component to list tasks
- 07f15849 - Add accept/reject buttons to task list
- 45183e9d - Add tests to task components
- 118eeb9d - List roles when accept add member tasks
- 0354c769 - Accept parameters when accept/reject tasks
- 7205a81d - Emit and subscribe to events for task accept/reject
- 917a672d - Translate tasks messages
- 1adb5479 - Use .checkbox-nice in accept member task
- 6fca41b5 - Refactor methods to close task
- d6d5bae0 - Create interface for AddMemberTask
-
mentioned in commit a1375e043a9e6338cb200416ace8e6ce04fe3c5c
-
Assignee removed
1 | +import { Provider, provide, Component } from 'ng-forward'; | |
2 | +import * as helpers from "../../../spec/helpers"; | |
3 | +import { TaskAcceptComponent } from './task-accept.component'; | |
4 | + | |
5 | +const htmlTemplate: string = '<task-accept [task]="ctrl.task"></task-accept>'; | |
6 | + | |
7 | +describe("Components", () => { | |
8 | + describe("Task Accept Component", () => { | |
9 | + | |
10 | + let task = { id: 1, type: "AddMember" }; | |
11 | + let roleService = jasmine.createSpyObj("roleService", ["getByProfile"]); | |
12 | + | |
13 | + beforeEach(angular.mock.module("templates")); | |
14 | + | |
15 | + function createComponent() { | |
16 | + return helpers.quickCreateComponent({ | |
3 |
|
2 | +import { AddMemberTaskAcceptComponent } from "../types/add-member/add-member-task-accept.component"; | |
3 | + | |
4 | +@Component({ | |
5 | + selector: 'task-accept', | |
6 | + template: '<div></div>', | |
7 | + directives: [AddMemberTaskAcceptComponent] | |
8 | +}) | |
9 | +@Inject("$element", "$scope", "$injector", "$compile") | |
10 | +export class TaskAcceptComponent { | |
11 | + | |
12 | + @Input() task: noosfero.Task; | |
13 | + @Input() confirmationTask: noosfero.Task; | |
14 | + | |
15 | + ngOnInit() { | |
16 | + let componentName = this.task.type.replace(/::/, '').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); | |
17 | + componentName += "-task-accept"; | |
1 |
|
38 | + ngOnInit() { | |
39 | + this.eventsHubService.subscribeToEvent(this.eventsNames.TASK_CLOSED, (task: noosfero.Task) => { | |
40 | + Arrays.remove(this.tasks, task); | |
41 | + }); | |
42 | + } | |
43 | + | |
44 | + getTaskTemplate(task: noosfero.Task) { | |
45 | + if (this.taskTemplates.indexOf(task.type) >= 0) { | |
46 | + let templateName = this.getTemplateName(task); | |
47 | + return `app/task/types/${templateName}/${templateName}.html`; | |
48 | + } else { | |
49 | + return 'app/task/types/default.html'; | |
50 | + } | |
51 | + } | |
52 | + | |
53 | + accept(task: noosfero.Task) { | |
1 |
|
79 | + }); | |
80 | + } else { | |
81 | + this.callReject(); | |
82 | + } | |
83 | + } | |
84 | + | |
85 | + callAccept() { | |
86 | + this.taskService.finishTask(this.confirmationTask).then(() => { | |
87 | + this.eventsHubService.emitEvent(this.eventsNames.TASK_CLOSED, this.currentTask); | |
88 | + this.notificationService.success({ title: "tasks.actions.accept.title", message: "tasks.actions.accept.message" }); | |
89 | + }).finally(() => { | |
90 | + this.cancel(); | |
91 | + }); | |
92 | + } | |
93 | + | |
94 | + callReject() { | |
1 |
|
1 | +<ul class="task-list"> | |
2 | + <li class="task-group" ng-repeat="(target, tasks) in ctrl.tasks | groupBy: 'target.name'"> | |
3 | + <div class="task-target"> | |
4 | + <noosfero-profile-image ng-if="tasks[0].target.type" [profile]="tasks[0].target"></noosfero-profile-image> | |
5 | + <div class="target-name">{{target}}</div> | |
6 | + </div> | |
7 | + <div class="task-body" ng-repeat="task in tasks | orderBy: 'created_at':true"> | |
8 | + <div class="task"> | |
9 | + <ng-include src="ctrl.getTaskTemplate(task)"></ng-include> | |
10 | + </div> | |
11 | + <div class="actions"> | |
12 | + <a href="#" ng-if="!task.accept_disabled" ng-click="ctrl.accept(task)" class="accept" uib-tooltip="{{'tasks.actions.accept' | translate}}"> | |
1 |
|