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
*/
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

View File

@ -5,9 +5,10 @@ section {
border-bottom: 6px solid #000;
}
& + & {
margin-top: 3rem;
+ section {
margin: 0 !important;
}
}
article {

View File

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

View File

@ -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;
};
}

View File

@ -1,9 +1,16 @@
@charset "UTF-8";
.input-lg {
display: block;
width: 100%;
}
input[type="date"]::after {
content: "au format JJ/MM/AAAA";
display: inline-block;
position: relative;
}
input,
select,
textarea {

View File

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