Commit aa8711cd270fc04a23dbd8fb42e6eea48db27ce8
1 parent
2b60b845
Exists in
master
and in
38 other branches
Add recent documents block
Showing
6 changed files
with
126 additions
and
3 deletions
Show diff stats
bower.json
@@ -22,7 +22,8 @@ | @@ -22,7 +22,8 @@ | ||
22 | "bootswatch": "~3.3.6", | 22 | "bootswatch": "~3.3.6", |
23 | "angular-moment": "~0.10.3", | 23 | "angular-moment": "~0.10.3", |
24 | "lodash": "3.10.1", | 24 | "lodash": "3.10.1", |
25 | - "angular-filter": "~0.5.8" | 25 | + "angular-filter": "~0.5.8", |
26 | + "angular-deckgrid": "~0.5.0" | ||
26 | }, | 27 | }, |
27 | "devDependencies": { | 28 | "devDependencies": { |
28 | "angular-mocks": "~1.4.2" | 29 | "angular-mocks": "~1.4.2" |
src/app/components/noosfero-blocks/recent-documents/recent-documents.directive.js
0 → 100644
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +(function() { | ||
2 | + 'use strict'; | ||
3 | + | ||
4 | + angular | ||
5 | + .module('angular') | ||
6 | + .directive('noosferoRecentDocumentsBlock', noosferoRecentDocumentsBlock); | ||
7 | + | ||
8 | + /** @ngInject */ | ||
9 | + function noosferoRecentDocumentsBlock() { | ||
10 | + var directive = { | ||
11 | + restrict: 'E', | ||
12 | + templateUrl: 'app/components/noosfero-blocks/recent-documents/recent-documents.html', | ||
13 | + scope: { | ||
14 | + block: '=', | ||
15 | + owner: '=' | ||
16 | + }, | ||
17 | + controller: RecentDocumentsController, | ||
18 | + controllerAs: 'vm', | ||
19 | + bindToController: true | ||
20 | + }; | ||
21 | + | ||
22 | + return directive; | ||
23 | + | ||
24 | + /** @ngInject */ | ||
25 | + function RecentDocumentsController(noosfero, $state) { | ||
26 | + var vm = this; | ||
27 | + vm.profile = vm.owner; | ||
28 | + vm.documents = []; | ||
29 | + | ||
30 | + vm.openDocument = function(article) { | ||
31 | + $state.go("main.profile.page", {page: article.path, profile: article.profile.identifier}); | ||
32 | + } | ||
33 | + | ||
34 | + //FIXME get all text articles | ||
35 | + noosfero.profiles.one(vm.profile.id).one('articles').get({content_type: 'TinyMceArticle'}).then(function(result) { | ||
36 | + vm.documents = result.articles; | ||
37 | + }); | ||
38 | + } | ||
39 | + } | ||
40 | + | ||
41 | +})(); |
src/app/components/noosfero-blocks/recent-documents/recent-documents.html
0 → 100644
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +<div deckgrid source="vm.documents" class="deckgrid"> | ||
2 | + <div class="a-card panel media" ng-click="mother.vm.openDocument(card);"> | ||
3 | + <div class="author media-left" ng-show="card.author.image"> | ||
4 | + <img ng-src="{{card.author.image.url}}" class="img-circle"> | ||
5 | + </div> | ||
6 | + <div class="header media-body"> | ||
7 | + <h5 class="title media-heading" ng-bind="card.title"></h5> | ||
8 | + | ||
9 | + <div class="subheader"> | ||
10 | + <span class="time"> | ||
11 | + <i class="fa fa-clock-o"></i> <span am-time-ago="card.created_at"></span> | ||
12 | + </span> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + | ||
16 | + <img ng-if="card.image" ng-src="card.image.url"> | ||
17 | + <div class="post-lead" ng-bind-html="card.body | stripTags | truncate: 100: '...'"></div> | ||
18 | + </div> | ||
19 | +</div> |
src/app/components/noosfero-blocks/recent-documents/recent-documents.scss
0 → 100644
@@ -0,0 +1,62 @@ | @@ -0,0 +1,62 @@ | ||
1 | +.block.recentdocumentsblock { | ||
2 | + .deckgrid[deckgrid]::before { | ||
3 | + font-size: 0; /* See https://github.com/akoenig/angular-deckgrid/issues/14#issuecomment-35728861 */ | ||
4 | + visibility: hidden; | ||
5 | + } | ||
6 | + .author { | ||
7 | + img { | ||
8 | + width: 30px; | ||
9 | + height: 30px; | ||
10 | + } | ||
11 | + } | ||
12 | + .header { | ||
13 | + .subheader { | ||
14 | + color: #C1C1C1; | ||
15 | + font-size: 10px; | ||
16 | + } | ||
17 | + } | ||
18 | + .post-lead { | ||
19 | + color: #8E8E8E; | ||
20 | + font-size: 14px; | ||
21 | + } | ||
22 | +} | ||
23 | + | ||
24 | +.col-md-2-5 { | ||
25 | + .deckgrid[deckgrid]::before { | ||
26 | + content: '1 .deck-column'; | ||
27 | + } | ||
28 | +} | ||
29 | + | ||
30 | +.col-md-7 { | ||
31 | + .block.recentdocumentsblock { | ||
32 | + background-color: transparent; | ||
33 | + border: 0; | ||
34 | + | ||
35 | + .deckgrid[deckgrid]::before { | ||
36 | + content: '3 .deck-column'; | ||
37 | + } | ||
38 | + | ||
39 | + .panel-heading { | ||
40 | + display: none; | ||
41 | + } | ||
42 | + .panel-body { | ||
43 | + padding: 0; | ||
44 | + } | ||
45 | + | ||
46 | + .deckgrid { | ||
47 | + .column { | ||
48 | + float: left; | ||
49 | + } | ||
50 | + | ||
51 | + .deck-column { | ||
52 | + @extend .col-md-4; | ||
53 | + padding: 0; | ||
54 | + | ||
55 | + .a-card { | ||
56 | + padding: 10px; | ||
57 | + margin: 3px; | ||
58 | + } | ||
59 | + } | ||
60 | + } | ||
61 | + } | ||
62 | +} |
src/app/components/noosfero-boxes/box.html
1 | <div ng-class="{'col-md-2-5': box.position!=1, 'col-md-7': box.position==1}"> | 1 | <div ng-class="{'col-md-2-5': box.position!=1, 'col-md-7': box.position==1}"> |
2 | - <div ng-repeat="block in box.blocks | orderBy: 'position'" class="panel panel-default block" > | 2 | + <div ng-repeat="block in box.blocks | orderBy: 'position'" class="panel panel-default block {{block.type | lowercase}}" > |
3 | <div class="panel-heading" ng-show="block.title"> | 3 | <div class="panel-heading" ng-show="block.title"> |
4 | <h3 class="panel-title">{{block.title}}</h3> | 4 | <h3 class="panel-title">{{block.title}}</h3> |
5 | </div> | 5 | </div> |
src/app/index.module.js
@@ -5,6 +5,6 @@ | @@ -5,6 +5,6 @@ | ||
5 | .module('angular', ['ngAnimate', 'ngCookies', 'ngStorage', 'ngTouch', | 5 | .module('angular', ['ngAnimate', 'ngCookies', 'ngStorage', 'ngTouch', |
6 | 'ngSanitize', 'ngMessages', 'ngAria', 'restangular', | 6 | 'ngSanitize', 'ngMessages', 'ngAria', 'restangular', |
7 | 'ui.router', 'ui.bootstrap', 'toastr', | 7 | 'ui.router', 'ui.bootstrap', 'toastr', |
8 | - 'angularMoment', 'angular.filter']); | 8 | + 'angularMoment', 'angular.filter', 'akoenig.deckgrid']); |
9 | 9 | ||
10 | })(); | 10 | })(); |