From 2ea040a4c8c1b110f325e1f3fd52d9b3d41e7728 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Wed, 15 Jun 2016 14:27:09 -0300 Subject: [PATCH] Enable header and footer edition when toggle design mode --- src/app/admin/layout-edit/designMode.service.ts | 5 ++--- src/app/profile/custom-content/custom-content.component.ts | 12 ++++++++++-- src/app/profile/custom-content/custom-content.html | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/admin/layout-edit/designMode.service.ts b/src/app/admin/layout-edit/designMode.service.ts index b548a59..ec618ca 100644 --- a/src/app/admin/layout-edit/designMode.service.ts +++ b/src/app/admin/layout-edit/designMode.service.ts @@ -1,5 +1,4 @@ -import {Component, Injectable, Output, EventEmitter} from 'ng-forward'; -import {BodyStateClassesService} from '../../layout/services/body-state-classes.service'; +import {Injectable, Output, EventEmitter} from 'ng-forward'; @Injectable() export class DesignModeService { @@ -20,4 +19,4 @@ export class DesignModeService { constructor() { } -} \ No newline at end of file +} diff --git a/src/app/profile/custom-content/custom-content.component.ts b/src/app/profile/custom-content/custom-content.component.ts index 4b99061..289f6f3 100644 --- a/src/app/profile/custom-content/custom-content.component.ts +++ b/src/app/profile/custom-content/custom-content.component.ts @@ -2,27 +2,32 @@ import {Component, Input, Inject} from 'ng-forward'; import {ProfileService} from '../../../lib/ng-noosfero-api/http/profile.service'; import {NotificationService} from '../../shared/services/notification.service'; import {PermissionDirective} from '../../shared/components/permission/permission.directive'; +import {DesignModeService} from '../../admin/layout-edit/designMode.service'; @Component({ selector: 'custom-content', templateUrl: "app/profile/custom-content/custom-content.html", directives: [PermissionDirective] }) -@Inject("$uibModal", "$scope", ProfileService, NotificationService) +@Inject("$uibModal", "$scope", ProfileService, NotificationService, DesignModeService) export class CustomContentComponent { + static $inject = ["DesignModeService"]; // @Inject doesn't works with uibModal.open + @Input() attribute: string; @Input() profile: noosfero.Profile; @Input() label: string; content: string; originalContent: string; + editionMode = false; private modalInstance: any = null; constructor(private $uibModal: any, private $scope: ng.IScope, private profileService: ProfileService, - private notificationService: NotificationService) { } + private notificationService: NotificationService, + private designModeService: DesignModeService) { } ngOnInit() { this.$scope.$watch(() => { @@ -30,6 +35,9 @@ export class CustomContentComponent { }, () => { if (this.profile) this.content = (this.profile)[this.attribute]; }); + this.designModeService.onToggle.subscribe((designModeOn: boolean) => { + this.editionMode = designModeOn; + }); } openEdit() { diff --git a/src/app/profile/custom-content/custom-content.html b/src/app/profile/custom-content/custom-content.html index 869e874..6ca137d 100644 --- a/src/app/profile/custom-content/custom-content.html +++ b/src/app/profile/custom-content/custom-content.html @@ -1,5 +1,5 @@
-
+
-- libgit2 0.21.2