From 7da480f310359c4d29a030654582cbadf68d26ce Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Sat, 23 Nov 2019 15:35:27 +0100 Subject: [PATCH] :zap: linked things --- src/app/config/PollConfig.ts | 6 +- src/app/pages/kind/kind.component.scss | 25 +++--- .../visibility/visibility.component.html | 5 +- .../pages/visibility/visibility.component.ts | 12 +++ src/assets/scss/atoms/_forms.scss | 79 ++++++++++--------- src/assets/scss/useful_classes.scss | 6 +- 6 files changed, 81 insertions(+), 52 deletions(-) diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts index 1b5cd192..8e5eb102 100644 --- a/src/app/config/PollConfig.ts +++ b/src/app/config/PollConfig.ts @@ -44,6 +44,7 @@ export const defaultAnswers = [{ * configuration of the poll, add new fields at will */ export class PollConfig { + expiracyDateDefaultInDays = 60; step = 0; stepMax = 3; pollType = 'classic';// classic or date @@ -56,11 +57,12 @@ export class PollConfig { // access visibility = 'link_only'; // visible to anyone with the link: voteChoices = 'only_yes'; // possible answers to a vote choice: only "yes", "yes, maybe, no" - expirationDate = new Date().toString().substr(0, 10); // expiracy date + expirationDate = ''; // expiracy date passwordAccess = 0; password = ''; customUrl = ''; - canModifyAnswers = "self";// everybody, self, nobody (= just admin) + canModifyAnswers = 1;// everybody, self, nobody (= just admin) + whoModifiesAnswers = "self";// everybody, self, nobody (= just admin) whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin) dateList: DateOption[] = defaultDates; // sets of days as strings, config to set identical time for days in a special days poll timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings diff --git a/src/app/pages/kind/kind.component.scss b/src/app/pages/kind/kind.component.scss index 76e12fed..2ac50a89 100644 --- a/src/app/pages/kind/kind.component.scss +++ b/src/app/pages/kind/kind.component.scss @@ -1,22 +1,23 @@ @charset "UTF-8"; section { - &:not(:last-of-type) { - border-bottom: 6px solid #000; - } + &:not(:last-of-type) { + border-bottom: 6px solid #000; + } + + + section { + margin: 0 !important; + } - & + & { - margin-top: 3rem; - } } article { - padding: 2rem 0; - border-top: 3px solid #ffb92c; + padding: 2rem 0; + border-top: 3px solid #ffb92c; - h3 { - &:not(:first-of-type) { - margin-top: 2rem; + h3 { + &:not(:first-of-type) { + margin-top: 2rem; + } } - } } diff --git a/src/app/pages/visibility/visibility.component.html b/src/app/pages/visibility/visibility.component.html index 9e3b84d5..839eb342 100644 --- a/src/app/pages/visibility/visibility.component.html +++ b/src/app/pages/visibility/visibility.component.html @@ -79,7 +79,8 @@ diff --git a/src/app/pages/visibility/visibility.component.ts b/src/app/pages/visibility/visibility.component.ts index 0deeea9e..6dd86867 100644 --- a/src/app/pages/visibility/visibility.component.ts +++ b/src/app/pages/visibility/visibility.component.ts @@ -16,6 +16,7 @@ export class VisibilityComponent extends BaseComponent implements OnInit { ngOnInit() { this.config.customUrl = this.makeUuid(); + this.config.expirationDate = (this.addDaysToDate(this.config.expiracyDateDefaultInDays, new Date())).toISOString().substring(0, 10); } /** @@ -28,4 +29,15 @@ export class VisibilityComponent extends BaseComponent implements OnInit { }); } + /** + * add some days to a date, to compute intervals + * @param days + * @param date + */ + addDaysToDate(days: number, date: Date) { + date = new Date(date.valueOf()); + date.setDate(date.getDate() + days); + return date; + }; + } diff --git a/src/assets/scss/atoms/_forms.scss b/src/assets/scss/atoms/_forms.scss index cc0fde2f..7994be0b 100644 --- a/src/assets/scss/atoms/_forms.scss +++ b/src/assets/scss/atoms/_forms.scss @@ -1,63 +1,70 @@ @charset "UTF-8"; -input[type="date"]::after{ - content:"au format JJ/MM/AAAA"; - display: inline-block; - position: relative; + +.input-lg { + display: block; + width: 100%; } + +input[type="date"]::after { + content: "au format JJ/MM/AAAA"; + display: inline-block; + position: relative; +} + input, select, textarea { - padding: 1rem; - border: 1px solid $secondary_color; - border-bottom: 3px solid $primary_color; + padding: 1rem; + border: 1px solid $secondary_color; + border-bottom: 3px solid $primary_color; } input, select { - display: inline-block; - margin-bottom:10px; - margin-left:5px; + display: inline-block; + margin-bottom: 10px; + margin-left: 5px; } textarea { - width: 100%; - border-left: 3px solid $primary_color; + width: 100%; + border-left: 3px solid $primary_color; } select, option { - // delete default display - -webkit-appearance : none; - -moz-appearance : none; + // delete default display + -webkit-appearance: none; + -moz-appearance: none; - background: none; - border-radius: 0; + background: none; + border-radius: 0; - background-color: transparent; - background-image: url("./assets/img/fleche_bas.svg"); - padding-right:1.5rem; + background-color: transparent; + background-image: url("./assets/img/fleche_bas.svg"); + padding-right: 1.5rem; - background-repeat: no-repeat; - background-size: 9px 8px; - background-position: right 1rem center; + background-repeat: no-repeat; + background-size: 9px 8px; + background-position: right 1rem center; - background-clip: border-box; + background-clip: border-box; - // TODO -> check what angular can do + // TODO -> check what angular can do } label { - &[for] { - cursor: pointer; - } - - &:not([for]) { - color: $dusty-orange; - - &:before { - content: "ce label n'a pas d'attribut for, c'est mal."; - color: $violet; + &[for] { + cursor: pointer; + } + + &:not([for]) { + color: $dusty-orange; + + &:before { + content: "ce label n'a pas d'attribut for, c'est mal."; + color: $violet; + } } - } } diff --git a/src/assets/scss/useful_classes.scss b/src/assets/scss/useful_classes.scss index 49725305..c19b4116 100644 --- a/src/assets/scss/useful_classes.scss +++ b/src/assets/scss/useful_classes.scss @@ -3,4 +3,8 @@ .align-right { display: flex; justify-content: flex-end; -} \ No newline at end of file +} + +.pull-right { + float: right; +}