From f056b0d79a2a5c894cc91d3723d16244c4abb58d Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Thu, 23 Jan 2020 17:36:56 +0100 Subject: [PATCH] fix buttons colours and manage a bit more the date form --- src/app/config/defaultConfigs.ts | 4 ++ src/app/pages/dates/dates.component.html | 62 ++++++++++++++++-------- src/app/pages/dates/dates.component.scss | 10 ++++ src/app/pages/dates/dates.component.ts | 8 +++ src/app/services/config.service.ts | 2 +- src/assets/scss/atoms/_buttons.scss | 19 ++++++-- 6 files changed, 78 insertions(+), 27 deletions(-) diff --git a/src/app/config/defaultConfigs.ts b/src/app/config/defaultConfigs.ts index e3706d54..1320521f 100644 --- a/src/app/config/defaultConfigs.ts +++ b/src/app/config/defaultConfigs.ts @@ -23,14 +23,18 @@ export const defaultAnswers = [{ id: 0, text: 'réponse de démo 1', url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`, + timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}] }, { id: 1, text: 'réponse 2', url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`, }, { id: 2, text: 'la réponse D', url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`, }]; diff --git a/src/app/pages/dates/dates.component.html b/src/app/pages/dates/dates.component.html index 6c2dbae8..64c7fa10 100644 --- a/src/app/pages/dates/dates.component.html +++ b/src/app/pages/dates/dates.component.html @@ -23,29 +23,33 @@
+ class="date-interval " >

{{"dates.add_interval"|translate}}

@@ -60,31 +64,38 @@ (change)="countDays()" [(ngModel)]="endDateInterval" type="date" > +
+


-
+
+
{{config.timeList.length}} - + {{"dates.count_time"|translate}} + (pour chaque jour) - + +
+ +

- + {{config.dateList.length}} @@ -121,15 +137,19 @@ name="dateChoices_{{id}}" type="date" > +
+        choice.literal :
+            {{choice.literal|json}}
+        
@@ -149,7 +169,7 @@
diff --git a/src/app/pages/dates/dates.component.scss b/src/app/pages/dates/dates.component.scss index 84c17656..3881e06f 100644 --- a/src/app/pages/dates/dates.component.scss +++ b/src/app/pages/dates/dates.component.scss @@ -2,10 +2,20 @@ padding-left: 1em; } +.date-interval { + padding: 1em; + margin-bottom: 1em; +} + +.title { + font-size: 1.5rem; +} + :host { input, button { + button { margin-left: 1em; } } + } diff --git a/src/app/pages/dates/dates.component.ts b/src/app/pages/dates/dates.component.ts index b75b7a35..f339c366 100644 --- a/src/app/pages/dates/dates.component.ts +++ b/src/app/pages/dates/dates.component.ts @@ -2,6 +2,7 @@ import {ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core'; import {ConfigService} from '../../services/config.service'; import {BaseComponent} from '../base-page/base.component'; import {DOCUMENT} from '@angular/common'; +import {MessageService} from "primeng/api"; @Component({ selector: 'framadate-dates', @@ -17,6 +18,7 @@ export class DatesComponent extends BaseComponent implements OnInit { constructor(public config: ConfigService, private cd: ChangeDetectorRef, + private messageService: MessageService, @Inject(DOCUMENT) private document: any ) { super(config); @@ -106,6 +108,12 @@ export class DatesComponent extends BaseComponent implements OnInit { this.config.dateList = [...new Set(converted)]; // add only dates that are not already present with a Set of unique items this.showDateInterval = false; + this.messageService.add({ + severity: 'success', + summary: 'Dates ajoutées', + detail: `les dates ont été ajoutées aux réponses possibles` + }); + } /** diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index 58ce01d8..e7250368 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -108,7 +108,7 @@ export class ConfigService extends PollConfig { }, title: this.title, description: this.description, - type: this.pollType, + pollType: this.pollType, visibility: this.visibility, voteChoices: this.voteChoices, allowSeveralHours: this.allowSeveralHours, diff --git a/src/assets/scss/atoms/_buttons.scss b/src/assets/scss/atoms/_buttons.scss index 8a520838..a9a5d61f 100644 --- a/src/assets/scss/atoms/_buttons.scss +++ b/src/assets/scss/atoms/_buttons.scss @@ -18,6 +18,7 @@ } } } + .clickable { cursor: pointer; } @@ -34,17 +35,25 @@ &--primary { @include btnTheme($primary_color); } + &--semi-bold { font-weight: 600; } + &--black-text { - color:black; - } - &--purple { - background-color:$pale-purple; + color: black; } - &--alert { + &--purple { + background-color: $pale-purple; + } + + &--warning { + @include btnTheme($dusty-orange); + } + + &--alert, + &--danger { @include btnTheme($red); }