Commit 18b99fd31eb720384b213448e31c7ed06fd8cff2

Authored by Victor Costa
1 parent b7f58749

Enable block edition when toggle design mode

src/app/layout/blocks/block.component.ts
@@ -4,13 +4,14 @@ import { BlockService } from '../../../lib/ng-noosfero-api/http/block.service'; @@ -4,13 +4,14 @@ import { BlockService } from '../../../lib/ng-noosfero-api/http/block.service';
4 import { NotificationService } from '../../shared/services/notification.service'; 4 import { NotificationService } from '../../shared/services/notification.service';
5 import { AuthService, SessionService, AuthEvents } from "../../login"; 5 import { AuthService, SessionService, AuthEvents } from "../../login";
6 import { TranslatorService } from "../../shared/services/translator.service"; 6 import { TranslatorService } from "../../shared/services/translator.service";
  7 +import { DesignModeService } from "../../admin/layout-edit/designMode.service";
7 8
8 @Component({ 9 @Component({
9 selector: 'noosfero-block', 10 selector: 'noosfero-block',
10 templateUrl: 'app/layout/blocks/block.html', 11 templateUrl: 'app/layout/blocks/block.html',
11 directives: [BlockEditionComponent] 12 directives: [BlockEditionComponent]
12 }) 13 })
13 -@Inject("$uibModal", "$scope", "$state", "$rootScope", BlockService, NotificationService, AuthService, SessionService, TranslatorService) 14 +@Inject("$uibModal", "$scope", "$state", "$rootScope", BlockService, NotificationService, AuthService, SessionService, TranslatorService, DesignModeService)
14 export class BlockComponent { 15 export class BlockComponent {
15 16
16 @Input() block: noosfero.Block; 17 @Input() block: noosfero.Block;
@@ -31,7 +32,8 @@ export class BlockComponent { @@ -31,7 +32,8 @@ export class BlockComponent {
31 private notificationService: NotificationService, 32 private notificationService: NotificationService,
32 private authService: AuthService, 33 private authService: AuthService,
33 private session: SessionService, 34 private session: SessionService,
34 - private translatorService: TranslatorService) { 35 + private translatorService: TranslatorService,
  36 + private designModeService: DesignModeService) {
35 37
36 this.currentUser = this.session.currentUser(); 38 this.currentUser = this.session.currentUser();
37 this.authService.subscribe(AuthEvents[AuthEvents.loginSuccess], () => { 39 this.authService.subscribe(AuthEvents[AuthEvents.loginSuccess], () => {
@@ -45,6 +47,10 @@ export class BlockComponent { @@ -45,6 +47,10 @@ export class BlockComponent {
45 this.$rootScope.$on("$stateChangeSuccess", (event: ng.IAngularEvent, toState: ng.ui.IState) => { 47 this.$rootScope.$on("$stateChangeSuccess", (event: ng.IAngularEvent, toState: ng.ui.IState) => {
46 this.verifyHomepage(); 48 this.verifyHomepage();
47 }); 49 });
  50 + this.designModeService.onToggle.subscribe((designModeOn: boolean) => {
  51 + this.editionMode = designModeOn;
  52 + this.$scope.$apply();
  53 + });
48 } 54 }
49 55
50 ngOnInit() { 56 ngOnInit() {
src/app/layout/scss/_layout.scss
@@ -36,14 +36,6 @@ @@ -36,14 +36,6 @@
36 } 36 }
37 } 37 }
38 38
39 -  
40 -body.noosfero-design-on {  
41 -  
42 - div.content-wrapper {  
43 - opacity: 0.5;  
44 - }  
45 -}  
46 -  
47 ul.nav > li.toggler-container { 39 ul.nav > li.toggler-container {
48 position: relative; 40 position: relative;
49 padding-top: 12px; 41 padding-top: 12px;
@@ -55,4 +47,4 @@ ul.nav > li.toggler-container { @@ -55,4 +47,4 @@ ul.nav > li.toggler-container {
55 margin-left: 0px; 47 margin-left: 0px;
56 margin-right: 0px; 48 margin-right: 0px;
57 background-color: #edecec; 49 background-color: #edecec;
58 -}  
59 \ No newline at end of file 50 \ No newline at end of file
  51 +}