Commit 1725e4b1bca27afb7fad9ab16b12da6576b87ed4

Authored by Leandro Santos
2 parents e27020c8 4000a698
Exists in staging

Merge branch 'master' into staging

Showing 42 changed files with 162 additions and 32 deletions   Show diff stats
src/app/layout/boxes/box.html
... ... @@ -3,7 +3,7 @@
3 3 <div class="panel-heading" ng-show="block.title">
4 4 <h3 class="panel-title">{{block.title}}</h3>
5 5 </div>
6   - <div class="panel-body">
  6 + <div class="panel-body {{block.type | lowercase}}" >
7 7 <noosfero-block [block]="block" [owner]="ctrl.owner"></noosfero-block>
8 8 </div>
9 9 </div>
... ...
src/plugins/comment_paragraph/hotspot/article-content/article-content.component.spec.ts
... ... @@ -24,13 +24,87 @@ describe(&quot;Components&quot;, () =&gt; {
24 24 });
25 25  
26 26 it("return false in isDiscussion when other type was specified", () => {
27   - helper.changeProperties({article: {type: "TextArticle"}});
  27 + helper.changeProperties({ article: { type: "TextArticle" } });
28 28 expect(helper.component.isDiscussion()).toBeFalsy();
29 29 });
30 30  
31 31 it("return true in isDiscussion when discussion type was specified", () => {
32   - helper.changeProperties({article: {type: "CommentParagraphPlugin::Discussion"}});
  32 + helper.changeProperties({ article: { type: "CommentParagraphPlugin::Discussion" } });
33 33 expect(helper.component.isDiscussion()).toBeTruthy();
34 34 });
  35 +
  36 + it("return true in notOpened when start date is after today", () => {
  37 + let date = new Date();
  38 + date.setDate(date.getDate() + 1);
  39 + helper.changeProperties({ article: { start_date: date.toISOString() } });
  40 + expect(helper.component.notOpened()).toBeTruthy();
  41 + expect(helper.component.available()).toBeFalsy();
  42 + expect(helper.component.closed()).toBeFalsy();
  43 + });
  44 +
  45 + it("return false in notOpened when start date is before today", () => {
  46 + let date = new Date();
  47 + date.setDate(date.getDate() - 1);
  48 + helper.changeProperties({ article: { start_date: date.toISOString() } });
  49 + expect(helper.component.notOpened()).toBeFalsy();
  50 + });
  51 +
  52 + it("return false in notOpened when start date is null", () => {
  53 + helper.changeProperties({ article: { start_date: null } });
  54 + expect(helper.component.notOpened()).toBeFalsy();
  55 + });
  56 +
  57 + it("return true in closed when end date is before today", () => {
  58 + let date = new Date();
  59 + date.setDate(date.getDate() - 1);
  60 + helper.changeProperties({ article: { end_date: date.toISOString() } });
  61 + expect(helper.component.closed()).toBeTruthy();
  62 + expect(helper.component.available()).toBeFalsy();
  63 + expect(helper.component.notOpened()).toBeFalsy();
  64 + });
  65 +
  66 + it("return false in closed when start date is after today", () => {
  67 + let date = new Date();
  68 + date.setDate(date.getDate() + 1);
  69 + helper.changeProperties({ article: { end_date: date.toISOString() } });
  70 + expect(helper.component.closed()).toBeFalsy();
  71 + });
  72 +
  73 + it("return false in closed when end date is null", () => {
  74 + helper.changeProperties({ article: { start_date: null } });
  75 + expect(helper.component.closed()).toBeFalsy();
  76 + });
  77 +
  78 + it("return true in available when start date is before today and end date is after", () => {
  79 + let date = new Date();
  80 + date.setDate(date.getDate() - 1);
  81 + let startDate = date.toISOString();
  82 + date.setDate(date.getDate() + 3);
  83 + let endDate = date.toISOString();
  84 + helper.changeProperties({ article: { start_date: startDate, end_date: endDate } });
  85 + expect(helper.component.available()).toBeTruthy();
  86 + expect(helper.component.closed()).toBeFalsy();
  87 + expect(helper.component.notOpened()).toBeFalsy();
  88 + });
  89 +
  90 + it("return true in available when start date is before today and end date is null", () => {
  91 + let date = new Date();
  92 + date.setDate(date.getDate() - 1);
  93 + let startDate = date.toISOString();
  94 + helper.changeProperties({ article: { start_date: startDate, end_date: null } });
  95 + expect(helper.component.available()).toBeTruthy();
  96 + expect(helper.component.closed()).toBeFalsy();
  97 + expect(helper.component.notOpened()).toBeFalsy();
  98 + });
  99 +
  100 + it("return true in available when start date is null and end date is after today", () => {
  101 + let date = new Date();
  102 + date.setDate(date.getDate() + 3);
  103 + let endDate = date.toISOString();
  104 + helper.changeProperties({ article: { start_date: null, end_date: endDate } });
  105 + expect(helper.component.available()).toBeTruthy();
  106 + expect(helper.component.closed()).toBeFalsy();
  107 + expect(helper.component.notOpened()).toBeFalsy();
  108 + });
35 109 });
36 110 });
... ...
src/plugins/comment_paragraph/hotspot/article-content/article-content.component.ts
... ... @@ -13,4 +13,20 @@ export class CommentParagraphArticleContentHotspotComponent {
13 13 isDiscussion() {
14 14 return this.article.type === "CommentParagraphPlugin::Discussion";
15 15 }
  16 +
  17 + notOpened() {
  18 + let now = new Date();
  19 + return !!this.article.start_date && new Date(this.article.start_date) > now;
  20 + }
  21 +
  22 + available() {
  23 + let now = new Date();
  24 + return (!this.article.start_date || new Date(this.article.start_date) <= now) &&
  25 + (!this.article.end_date || new Date(this.article.end_date) >= now);
  26 + }
  27 +
  28 + closed() {
  29 + let now = new Date();
  30 + return !!this.article.end_date && new Date(this.article.end_date) < now;
  31 + }
16 32 }
... ...
src/plugins/comment_paragraph/hotspot/article-content/article-content.html
1 1 <div class="discussion-header" ng-if="ctrl.isDiscussion()">
2   - <span class="description">{{"comment-paragraph-plugin.discussion.header" | translate}}</span>
3   - <span class="start-date date" ng-if="ctrl.article.start_date">
4   - <span class="description">{{"comment-paragraph-plugin.discussion.editor.start_date.label" | translate}}</span>
5   - <span class="value">{{ctrl.article.start_date | amDateFormat:'DD/MM/YYYY'}}</span>
6   - </span>
7   - <span class="end-date date" ng-if="ctrl.article.end_date">
8   - <span class="description">{{"comment-paragraph-plugin.discussion.editor.end_date.label" | translate}}</span>
9   - <span class="value">{{ctrl.article.end_date | amDateFormat:'DD/MM/YYYY'}}</span>
10   - </span>
  2 + <div class="icon">
  3 + <i class="fa fa-calendar fa-fw fa-lg"></i>
  4 + </div>
  5 + <div class="period">
  6 + <div ng-if="ctrl.notOpened()" class="description not-opened">
  7 + {{"comment-paragraph-plugin.discussion.notOpened.header" | translate:{date: (ctrl.article.start_date | dateFormat | amTimeAgo)} }}
  8 + </div>
  9 + <div ng-if="ctrl.available()" class="description available">
  10 + <div ng-if="ctrl.article.end_date" class="with-end-date">
  11 + {{"comment-paragraph-plugin.discussion.available.header" | translate:{date: (ctrl.article.end_date | dateFormat | amTimeAgo)} }}
  12 + </div>
  13 + <div ng-if="!ctrl.article.end_date" class="without-end-date">
  14 + {{"comment-paragraph-plugin.discussion.available.without-end.header" | translate}}
  15 + </div>
  16 + </div>
  17 + <div ng-if="ctrl.closed()" class="description closed">
  18 + {{"comment-paragraph-plugin.discussion.closed.header" | translate:{date: (ctrl.article.end_date | dateFormat | amTimeAgo)} }}
  19 + </div>
  20 + </div>
11 21 </div>
... ...
src/plugins/comment_paragraph/hotspot/article-content/article-content.scss
1 1 .discussion-header {
2 2 @extend .pull-right;
3 3 margin-bottom: 20px;
4   - .date {
5   - text-transform: lowercase;
6   - font-size: 16px;
  4 + .period {
  5 + @extend .pull-right;
7 6 .description {
8 7 font-weight: bold;
9   - color: #BFBFBF;
10   - }
11   - .value {
12   - font-size: 15px;
13   - color: #969696;
  8 + color: #A2A2A2;
14 9 }
15 10 }
16   - .description {
17   - font-weight: bold;
18   - color: #BFBFBF;
  11 + .icon {
  12 + @extend .pull-right;
  13 + margin-left: 8px;
19 14 }
20 15 }
... ...
src/plugins/comment_paragraph/languages/en.json
... ... @@ -2,5 +2,9 @@
2 2 "comment-paragraph-plugin.title": "Paragraph Comments",
3 3 "comment-paragraph-plugin.discussion.editor.start_date.label": "From",
4 4 "comment-paragraph-plugin.discussion.editor.end_date.label": "To",
5   - "comment-paragraph-plugin.discussion.header": "Open for comments"
  5 + "comment-paragraph-plugin.discussion.header": "Open for comments",
  6 + "comment-paragraph-plugin.discussion.notOpened.header": "Discussion will start {{date}}",
  7 + "comment-paragraph-plugin.discussion.available.header": "Discussion will end {{date}}",
  8 + "comment-paragraph-plugin.discussion.available.without-end.header": "Discussion opened",
  9 + "comment-paragraph-plugin.discussion.closed.header": "Discussion finished {{date}}"
6 10 }
... ...
src/plugins/comment_paragraph/languages/pt.json
... ... @@ -2,5 +2,9 @@
2 2 "comment-paragraph-plugin.title": "Comentários por Parágrafo",
3 3 "comment-paragraph-plugin.discussion.editor.start_date.label": "De",
4 4 "comment-paragraph-plugin.discussion.editor.end_date.label": "Até",
5   - "comment-paragraph-plugin.discussion.header": "Aberto para comentários"
  5 + "comment-paragraph-plugin.discussion.header": "Aberto para comentários",
  6 + "comment-paragraph-plugin.discussion.notOpened.header": "Discussão iniciará {{date}}",
  7 + "comment-paragraph-plugin.discussion.available.header": "Discussão terminará {{date}}",
  8 + "comment-paragraph-plugin.discussion.available.without-end.header": "Discussão aberta",
  9 + "comment-paragraph-plugin.discussion.closed.header": "Discussão finalizada {{date}}"
6 10 }
... ...
themes/participa-consulta/app/participa-consulta.scss
... ... @@ -6,6 +6,27 @@ html, body {
6 6 height:100%;
7 7 }
8 8  
  9 +@font-face{
  10 + font-family: 'Ubuntu';
  11 + font-weight: 300;
  12 + font-style: normal;
  13 + src: url('../assets/fonts/participa-consulta/Ubuntu-R.ttf');
  14 +}
  15 +
  16 +@font-face{
  17 + font-family: 'Ubuntu Mediun';
  18 + font-weight: 300;
  19 + font-style: normal;
  20 + src: url('../assets/fonts/participa-consulta/Ubuntu-M.ttf');
  21 +}
  22 +
  23 +@font-face{
  24 + font-family: 'Ubuntu';
  25 + font-weight: 300;
  26 + font-style: italic;
  27 + src: url('../assets/fonts/participa-consulta/Ubuntu-RI.ttf');
  28 +}
  29 +
9 30 .box-default{
10 31 border: none;
11 32 border-radius: 3px 3px 0 0;
... ... @@ -19,27 +40,33 @@ html, body {
19 40 background-size: 30px 30px;
20 41 }
21 42  
  43 +.skin-whbl .panel-default > .panel-heading, .skin-whbl .notifications-list .item-footer {
  44 + background: #DAE1C4;
  45 + color: #4F9CAC;
  46 +}
  47 +
  48 +.panel-body.linklistblock{
  49 + padding: 0px;
  50 +}
  51 +
22 52 .skin-whbl .membersblock > .panel-heading{
23 53 @extend .box-default;
24   - background: #DAE1C4 url("../assets/images/participa-consulta/pessoas.png") no-repeat 15px center;
  54 + background: #DAE1C4 url("../assets/icons/participa-consulta/pessoas.png") no-repeat 15px center;
25 55 color: #4F9CAC;
26 56 }
27 57  
28 58 .skin-whbl .statisticsblock > .panel-heading{
29 59 @extend .box-default;
30   - background: #69677C url("../assets/images/participa-consulta/indicadores.png") no-repeat 15px center;
  60 + background: #69677C url("../assets/icons/participa-consulta/indicadores.png") no-repeat 15px center;
31 61 color: #DAE1C4;
32 62 }
33 63  
34 64 .link-list-block{
35   - width: 900px; //Apagar depois!!!!
36 65 font-family: "Ubuntu";
37 66 font-size: 12px;
38 67 background: #69677C;
39 68 border-radius: 0 0 3px 3px;
40   - margin-bottom: 30px;
41 69 padding: 20px;
42   - margin: 0 0 30px 0;
43 70 position: relative;
44 71 }
45 72  
... ... @@ -51,13 +78,13 @@ html, body {
51 78 font-family: "Ubuntu Mediun";
52 79 font-size: 16px;
53 80 margin: 0;
54   - padding: 0;
  81 + padding-right: 15px;
55 82 font-weight: bold;
56 83 }
57 84  
58 85 .link-list-block div:first-child{
59 86 padding: 15px 15px 15px 55px;
60   - background: #69677C url("../assets/images/participa-consulta/home.png") no-repeat 15px center;
  87 + background: #69677C url("../assets/icons/participa-consulta/home.png") no-repeat 15px center;
61 88 color: #FFF;
62 89 background-size: 30px 30px;
63 90 }
... ...
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-B.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-BI.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-C.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-L.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-LI.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-M.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-MI.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-R.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/Ubuntu-RI.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/UbuntuMono-B.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/UbuntuMono-BI.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/UbuntuMono-R.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/fonts/participa-consulta/UbuntuMono-RI.ttf 0 → 100644
No preview for this file type
themes/participa-consulta/assets/icons/participa-consulta/agenda-contagem.png 0 → 100644

921 Bytes

themes/participa-consulta/assets/icons/participa-consulta/balao.png 0 → 100644

528 Bytes

themes/participa-consulta/assets/icons/participa-consulta/balao_claro.png 0 → 100644

517 Bytes

themes/participa-consulta/assets/icons/participa-consulta/closed.png 0 → 100644

577 Bytes

themes/participa-consulta/assets/icons/participa-consulta/como-participar.png 0 → 100644

1.14 KB

themes/participa-consulta/assets/icons/participa-consulta/home.png 0 → 100644

777 Bytes

themes/participa-consulta/assets/icons/participa-consulta/icon-attend.png 0 → 100644

1.32 KB

themes/participa-consulta/assets/icons/participa-consulta/indicadores.png 0 → 100644

1004 Bytes

themes/participa-consulta/assets/icons/participa-consulta/line.png 0 → 100644

142 Bytes

themes/participa-consulta/assets/icons/participa-consulta/login.png 0 → 100644

1.06 KB

themes/participa-consulta/assets/icons/participa-consulta/more.png 0 → 100644

528 Bytes

themes/participa-consulta/assets/icons/participa-consulta/more_two.png 0 → 100644

488 Bytes

themes/participa-consulta/assets/icons/participa-consulta/open.png 0 → 100644

651 Bytes

themes/participa-consulta/assets/icons/participa-consulta/pessoas.png 0 → 100644

1.27 KB

themes/participa-consulta/assets/icons/participa-consulta/trilhas.png 0 → 100644

1.79 KB

themes/participa-consulta/assets/icons/participa-consulta/user.png 0 → 100644

512 Bytes

themes/participa-consulta/assets/icons/participa-consulta/visualizacao.png 0 → 100644

502 Bytes

themes/participa-consulta/assets/icons/participa-consulta/visualizacao_claro.png 0 → 100644

425 Bytes

themes/participa-consulta/assets/images/participa-consulta/home.png

777 Bytes

themes/participa-consulta/assets/images/participa-consulta/indicadores.png

1004 Bytes

themes/participa-consulta/assets/images/participa-consulta/pessoas.png

1.27 KB