linked things

This commit is contained in:
Baptiste Lemoine 2019-11-23 15:35:27 +01:00
parent c1935dbb87
commit 7da480f310
6 changed files with 81 additions and 52 deletions

View File

@ -44,6 +44,7 @@ export const defaultAnswers = [{
* configuration of the poll, add new fields at will * configuration of the poll, add new fields at will
*/ */
export class PollConfig { export class PollConfig {
expiracyDateDefaultInDays = 60;
step = 0; step = 0;
stepMax = 3; stepMax = 3;
pollType = 'classic';// classic or date pollType = 'classic';// classic or date
@ -56,11 +57,12 @@ export class PollConfig {
// access // access
visibility = 'link_only'; // visible to anyone with the link: visibility = 'link_only'; // visible to anyone with the link:
voteChoices = 'only_yes'; // possible answers to a vote choice: only "yes", "yes, maybe, no" 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; passwordAccess = 0;
password = ''; password = '';
customUrl = ''; 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) 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 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 timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings

View File

@ -1,22 +1,23 @@
@charset "UTF-8"; @charset "UTF-8";
section { section {
&:not(:last-of-type) { &:not(:last-of-type) {
border-bottom: 6px solid #000; border-bottom: 6px solid #000;
} }
+ section {
margin: 0 !important;
}
& + & {
margin-top: 3rem;
}
} }
article { article {
padding: 2rem 0; padding: 2rem 0;
border-top: 3px solid #ffb92c; border-top: 3px solid #ffb92c;
h3 { h3 {
&:not(:first-of-type) { &:not(:first-of-type) {
margin-top: 2rem; margin-top: 2rem;
}
} }
}
} }

View File

@ -79,7 +79,8 @@
<select <select
name="modificationScope" name="modificationScope"
id="modificationScope" id="modificationScope"
[(ngModel)]="config.canModifyAnswers"> [(ngModel)]="config.whoModifiesAnswers"
[disabled]="!config.canModifyAnswers">
<option value="self"> <option value="self">
{{"visibility.modfiy_their"|translate}} {{"visibility.modfiy_their"|translate}}
</option> </option>
@ -101,7 +102,9 @@
<br> <br>
{{"visibility.access_url_key"|translate}} {{"visibility.access_url_key"|translate}}
</label> </label>
<br>
<input type="text" <input type="text"
class="input-lg"
name="url" name="url"
id="url" id="url"
[(ngModel)]="config.customUrl"> [(ngModel)]="config.customUrl">

View File

@ -16,6 +16,7 @@ export class VisibilityComponent extends BaseComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.config.customUrl = this.makeUuid(); 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;
};
} }

View File

@ -1,63 +1,70 @@
@charset "UTF-8"; @charset "UTF-8";
input[type="date"]::after{
content:"au format JJ/MM/AAAA"; .input-lg {
display: inline-block; display: block;
position: relative; width: 100%;
} }
input[type="date"]::after {
content: "au format JJ/MM/AAAA";
display: inline-block;
position: relative;
}
input, input,
select, select,
textarea { textarea {
padding: 1rem; padding: 1rem;
border: 1px solid $secondary_color; border: 1px solid $secondary_color;
border-bottom: 3px solid $primary_color; border-bottom: 3px solid $primary_color;
} }
input, input,
select { select {
display: inline-block; display: inline-block;
margin-bottom:10px; margin-bottom: 10px;
margin-left:5px; margin-left: 5px;
} }
textarea { textarea {
width: 100%; width: 100%;
border-left: 3px solid $primary_color; border-left: 3px solid $primary_color;
} }
select, select,
option { option {
// delete default display // delete default display
-webkit-appearance : none; -webkit-appearance: none;
-moz-appearance : none; -moz-appearance: none;
background: none; background: none;
border-radius: 0; border-radius: 0;
background-color: transparent; background-color: transparent;
background-image: url("./assets/img/fleche_bas.svg"); background-image: url("./assets/img/fleche_bas.svg");
padding-right:1.5rem; padding-right: 1.5rem;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 9px 8px; background-size: 9px 8px;
background-position: right 1rem center; 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 { label {
&[for] { &[for] {
cursor: pointer; cursor: pointer;
} }
&:not([for]) { &:not([for]) {
color: $dusty-orange; color: $dusty-orange;
&:before { &:before {
content: "ce label n'a pas d'attribut for, c'est mal."; content: "ce label n'a pas d'attribut for, c'est mal.";
color: $violet; color: $violet;
}
} }
}
} }

View File

@ -3,4 +3,8 @@
.align-right { .align-right {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.pull-right {
float: right;
}