Commit fe5e2a59beba296f2ebea36bbc169be3822d7f35
1 parent
f50fb8fb
Exists in
master
and in
38 other branches
Add cms controller
Showing
7 changed files
with
64 additions
and
7 deletions
Show diff stats
... | ... | @@ -0,0 +1,20 @@ |
1 | +(function() { | |
2 | + 'use strict'; | |
3 | + | |
4 | + angular | |
5 | + .module('angular') | |
6 | + .controller('CmsController', CmsController); | |
7 | + | |
8 | + | |
9 | + /** @ngInject */ | |
10 | + function CmsController(noosfero, $log, $stateParams, $scope) { | |
11 | + var vm = this; | |
12 | + vm.article = null; | |
13 | + vm.profile = null; | |
14 | + activate(); | |
15 | + | |
16 | + function activate() { | |
17 | + } | |
18 | + | |
19 | + } | |
20 | +})(); | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +CMS | ... | ... |
src/app/components/noosfero/noosfero.service.js
... | ... | @@ -2,7 +2,10 @@ |
2 | 2 | 'use strict'; |
3 | 3 | |
4 | 4 | angular.module('angular').factory('noosfero', function(Restangular) { |
5 | + var currentProfile; | |
6 | + | |
5 | 7 | return { |
8 | + currentProfile: currentProfile, | |
6 | 9 | profiles: Restangular.service('profiles'), |
7 | 10 | articles: Restangular.service('articles'), |
8 | 11 | profile: function(profileId) { | ... | ... |
src/app/content-viewer/content-viewer-actions.controller.js
0 → 100644
... | ... | @@ -0,0 +1,20 @@ |
1 | +(function() { | |
2 | + 'use strict'; | |
3 | + | |
4 | + angular | |
5 | + .module('angular') | |
6 | + .controller('ContentViewerActionsController', ContentViewerActionsController); | |
7 | + | |
8 | + | |
9 | + /** @ngInject */ | |
10 | + function ContentViewerActionsController(noosfero, $log, $stateParams, $scope, $state) { | |
11 | + var vm = this; | |
12 | + vm.article = null; | |
13 | + vm.profile = null; | |
14 | + activate(); | |
15 | + | |
16 | + function activate() { | |
17 | + vm.profile = noosfero.currentProfile; | |
18 | + } | |
19 | + } | |
20 | +})(); | ... | ... |
src/app/content-viewer/navbar-actions.html
1 | 1 | <ul class="nav navbar-nav navbar-right"> |
2 | 2 | <li> |
3 | - <a href="#" role="button"> | |
3 | + <a href="#" role="button" ui-sref="main.profile.cms({profile: vm.profile.identifier})"> | |
4 | 4 | <span class="fa-stack"> |
5 | 5 | <i class="fa fa-file-o fa-stack-2x"></i> |
6 | 6 | <i class="fa fa-plus fa-stack-1x"></i> | ... | ... |
src/app/index.route.js
... | ... | @@ -18,6 +18,19 @@ |
18 | 18 | } |
19 | 19 | } |
20 | 20 | }) |
21 | + .state('main.profile.cms', { | |
22 | + url: '^/myprofile/:profile/cms', | |
23 | + views: { | |
24 | + 'mainBlockContent': { | |
25 | + templateUrl: 'app/cms/cms.html', | |
26 | + controller: 'CmsController', | |
27 | + controllerAs: 'vm' | |
28 | + } | |
29 | + } | |
30 | + }) | |
31 | + .state('main.profile.settings', { | |
32 | + url: '^/myprofile/:profile' | |
33 | + }) | |
21 | 34 | .state('main.profile', { |
22 | 35 | url: '/:profile', |
23 | 36 | abstract: true, |
... | ... | @@ -51,18 +64,17 @@ |
51 | 64 | .state('main.profile.page', { |
52 | 65 | url: '/{page:any}', |
53 | 66 | views: { |
54 | - 'actions@main': { | |
55 | - templateUrl: 'app/content-viewer/navbar-actions.html' | |
56 | - }, | |
57 | 67 | 'mainBlockContent': { |
58 | 68 | templateUrl: 'app/content-viewer/page.html', |
59 | 69 | controller: 'ContentViewerController', |
60 | 70 | controllerAs: 'vm' |
71 | + }, | |
72 | + 'actions@main': { | |
73 | + templateUrl: 'app/content-viewer/navbar-actions.html', | |
74 | + controller: 'ContentViewerActionsController', | |
75 | + controllerAs: 'vm' | |
61 | 76 | } |
62 | 77 | } |
63 | - }) | |
64 | - .state('main.profile.settings', { | |
65 | - url: '^/myprofile/:profile' | |
66 | 78 | }); |
67 | 79 | |
68 | 80 | $urlRouterProvider.otherwise('/'); | ... | ... |
src/app/profile/profile.controller.js
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | function activate() { |
16 | 16 | noosfero.profiles.one().get({identifier: $stateParams.profile}).then(function(response) { |
17 | 17 | vm.profile = response.data[0]; |
18 | + noosfero.currentProfile = vm.profile; | |
18 | 19 | return noosfero.boxes(vm.profile.id).one().get(); |
19 | 20 | }).then(function(response) { |
20 | 21 | vm.boxes = response.data.boxes; | ... | ... |