Merge Request #55

Merged
noosfero-themes/angular-theme!55
Created by Victor Costa

Add components that display tasks and allow accept/reject

Assignee: None
Milestone: 2016.07

Merged by Michel Felipe

Source branch has been removed
Commits (11)
2 participants
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    mentioned in issue #120

    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    Added 1 new commit:

    • 0af91d99 - List roles when accept add member tasks
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    Added 1 new commit:

    • 00341879 - Accept parameters when accept/reject tasks
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    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
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    Added 1 new commit:

    • 22792707 - Emit and subscribe to events for task accept/reject
    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe @mfdeveloper

    Reassigned to @mfdeveloper

    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe started a discussion on the outdated diff
    last updated by Michel Felipe
    src/app/task/types/abuse-complaint/abuse-complaint.html 0 → 100644
      1 +<i class="task-icon fa fa-fw fa-user-times"></i>
      2 +<span class="requestor">{{task.requestor.name}}</span> was reported due to inappropriate behavior
    1
    • Me
      Michel Felipe @mfdeveloper

      Essa mensagem não deveria ser controlada pela tradução? Dessa forma ficará apenas em inglês

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the outdated diff
    last updated by Michel Felipe
    src/app/task/types/add-member/add-member-accept.html 0 → 100644
      1 +<div class="add-member-details">
      2 + <label>{{"tasks.add_member.accept.select_role" | translate}}</label>
      3 + <div class="form-group roles">
      4 + <div class="checkbox" ng-repeat="role in ctrl.roles">
    1
    • Me
      Michel Felipe @mfdeveloper

      Você tentou utilizar a classe .checkbox-nice e sua estrutura HTML? Talvez a apresentação deste fique melhor, uma vez que já está sendo utilizado no formulário de login :)

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the outdated diff
    last updated by Michel Felipe
    src/app/task/types/add-member/add-member-task-accept.component.ts 0 → 100644
      4 +@Component({
      5 + selector: "add-member-task-accept",
      6 + templateUrl: "app/task/types/add-member/add-member-accept.html",
      7 +})
      8 +@Inject(RoleService)
      9 +export class AddMemberTaskAcceptComponent {
      10 +
      11 + @Input() task: noosfero.Task;
      12 + @Input() confirmationTask: noosfero.Task;
      13 + roles: noosfero.Role[];
      14 +
      15 + constructor(private roleService: RoleService) { }
      16 +
      17 + ngOnInit() {
      18 + if (!this.task.target) return;
      19 + (<any>this.confirmationTask)['roles'] = [];
    3
    • Me
      Michel Felipe @mfdeveloper (Edited )

      O atributo 'roles' não poderia ser definido na interface noosfero.Task? Isso evitaria o cast para anyde forma tão recorrente ao longo desse componente.

      Choose File ...   File name...
      Cancel
    • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
      Victor Costa @vfcosta

      A questão é que roles não é um atributo genérico, é específico de um tipo de Task.

      Choose File ...   File name...
      Cancel
    • Me
      Michel Felipe @mfdeveloper

      Então, seguindo o modelo de interfaces typescript espelhando os models do backend, deveria ter um noosfero.MyTask que herda de noosfero.Task nao?

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the diff
    last updated by Michel Felipe
    src/app/task/task-list/task-accept.component.spec.ts 0 → 100644
      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
    • Me
      Michel Felipe @mfdeveloper

      Algum motivo especial em não ter utilizado a classe ComponentTestHelper neste teste?

      Choose File ...   File name...
      Cancel
    • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
      Victor Costa @vfcosta

      A forma que o ComponentTestHelper foi feito não funciona nesse caso por causa do this.$element.replaceWith que o componente executa na inicialização.

      Choose File ...   File name...
      Cancel
    • Me
      Michel Felipe @mfdeveloper

      Ok, entendi :+1:

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the diff
    last updated by Michel Felipe
    src/app/task/task-list/task-accept.component.ts 0 → 100644
      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
    • Me
      Michel Felipe @mfdeveloper

      Essa substituição e concatenação não seria + indicada em um método separado, contendo um teste unitário correspondente?

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the diff
    last updated by Michel Felipe
    src/app/task/task-list/task-list.component.ts 0 → 100644
      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
    • Me
      Michel Felipe @mfdeveloper (Edited )

      Os métodos accept() e reject() me parecem que fazem a mesma coisa. Não seria interessante um método central, passando como parâmetro o que muda entre eles ?

      Choose File ...   File name...
      Cancel
    Me
    Michel Felipe started a discussion on the diff
    last updated by Michel Felipe
    src/app/task/task-list/task-list.component.ts 0 → 100644
      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
    Me
    Michel Felipe started a discussion on the diff
    last updated by Michel Felipe
    src/app/task/task-list/task-list.html 0 → 100644
      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
    • Me
      Michel Felipe @mfdeveloper

      Não seria melhor substituir as chamadas a ng-click="" por (click)="method()" no formato "Angular 2" de ser?

      Choose File ...   File name...
      Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    Added 3 new commits:

    • 879c272e - Translate tasks messages
    • 7c38f4b5 - Use .checkbox-nice in accept member task
    • ffc634cb - Refactor methods to close task
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    Added 1 new commit:

    • dbdaa1d0 - Create interface for AddMemberTask
    Choose File ...   File name...
    Cancel
  • 4a20548511a65cfccc863520b70c3ee9?s=40&d=identicon
    Victor Costa @vfcosta

    @mfdeveloper feito!

    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe @mfdeveloper

    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
    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe @mfdeveloper
    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe @mfdeveloper

    Perfeito @vfcosta ! Merge realizado :)

    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe @mfdeveloper

    Assignee removed

    Choose File ...   File name...
    Cancel
  • Me
    Michel Felipe @mfdeveloper

    mentioned in issue #120

    Choose File ...   File name...
    Cancel