forked from tykayn/funky-framadate-front
🐛 fix focus on date, extend the empty all button to timespans
This commit is contained in:
parent
1055a0cdbe
commit
cf2a12507e
@ -32,9 +32,9 @@
|
|||||||
"@angular/cli": "~8.2.1",
|
"@angular/cli": "~8.2.1",
|
||||||
"@angular/compiler-cli": "~8.2.0",
|
"@angular/compiler-cli": "~8.2.0",
|
||||||
"@angular/language-service": "~8.2.0",
|
"@angular/language-service": "~8.2.0",
|
||||||
"@types/node": "~8.9.4",
|
|
||||||
"@types/jasmine": "~3.3.8",
|
"@types/jasmine": "~3.3.8",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
|
"@types/node": "~8.9.4",
|
||||||
"codelyzer": "^5.0.0",
|
"codelyzer": "^5.0.0",
|
||||||
"jasmine-core": "~3.4.0",
|
"jasmine-core": "~3.4.0",
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
|
@ -2,13 +2,17 @@
|
|||||||
* une option de date dans les sondages spéciaux
|
* une option de date dans les sondages spéciaux
|
||||||
*/
|
*/
|
||||||
export interface DateOption {
|
export interface DateOption {
|
||||||
|
timeList: any;
|
||||||
literal: string;
|
literal: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const timeOfDay = [{literal: 'matin'},
|
export const timeOfDay = [{
|
||||||
{literal: 'midi'},
|
timeList: [],
|
||||||
{literal: 'après-midi'},
|
literal: 'matin'
|
||||||
{literal: 'soirée'}];
|
},
|
||||||
|
{timeList: [], literal: 'midi'},
|
||||||
|
{timeList: [], literal: 'après-midi'},
|
||||||
|
{timeList: [], literal: 'soirée'}];
|
||||||
export const defaultDates = [
|
export const defaultDates = [
|
||||||
{
|
{
|
||||||
literal: `${new Date().getDate()}-${new Date().getMonth()}-${new Date().getFullYear()}`,
|
literal: `${new Date().getDate()}-${new Date().getMonth()}-${new Date().getFullYear()}`,
|
||||||
@ -37,7 +41,7 @@ export class PollConfig {
|
|||||||
visibility = 'link_only';
|
visibility = 'link_only';
|
||||||
// date specific poll
|
// date specific poll
|
||||||
allowSeveralHours = 'true';
|
allowSeveralHours = 'true';
|
||||||
dateList: DateOption[] = defaultDates; // sets of days as strings
|
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
|
||||||
answers: any = [{
|
answers: any = [{
|
||||||
id: 0,
|
id: 0,
|
||||||
|
@ -18,6 +18,7 @@ export const Routes =
|
|||||||
{path: '', component: CreateOrRetrieveComponent},
|
{path: '', component: CreateOrRetrieveComponent},
|
||||||
{path: 'home', component: HomeComponent},
|
{path: 'home', component: HomeComponent},
|
||||||
{path: 'base', component: BaseComponent},
|
{path: 'base', component: BaseComponent},
|
||||||
|
{path: 'step/base', component: BaseComponent},
|
||||||
{path: 'step/creation', component: CreateOrRetrieveComponent},
|
{path: 'step/creation', component: CreateOrRetrieveComponent},
|
||||||
{path: 'step/date', component: DatesComponent},
|
{path: 'step/date', component: DatesComponent},
|
||||||
{path: 'step/kind', component: KindComponent},
|
{path: 'step/kind', component: KindComponent},
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
(click)="addtime()"
|
(click)="addtime()"
|
||||||
id="add_time_button"
|
id="add_time_button"
|
||||||
|
*ngIf="config.allowSeveralHours=='false'"
|
||||||
>
|
>
|
||||||
{{"dates.addTime"|translate}}
|
{{"dates.addTime"|translate}}
|
||||||
</button>
|
</button>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
|
import {ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core';
|
||||||
import {ConfigService} from '../../config.service';
|
import {ConfigService} from '../../config.service';
|
||||||
import {BaseComponent} from '../base-page/base.component';
|
import {BaseComponent} from '../base-page/base.component';
|
||||||
|
import {DOCUMENT} from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'framadate-dates',
|
selector: 'framadate-dates',
|
||||||
@ -8,7 +9,10 @@ import {BaseComponent} from '../base-page/base.component';
|
|||||||
styleUrls: ['./dates.component.scss']
|
styleUrls: ['./dates.component.scss']
|
||||||
})
|
})
|
||||||
export class DatesComponent extends BaseComponent implements OnInit {
|
export class DatesComponent extends BaseComponent implements OnInit {
|
||||||
constructor(public config: ConfigService, private cd: ChangeDetectorRef) {
|
constructor(public config: ConfigService,
|
||||||
|
private cd: ChangeDetectorRef,
|
||||||
|
@Inject(DOCUMENT) private document: any
|
||||||
|
) {
|
||||||
super(config);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,11 +20,11 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addDate() {
|
addDate() {
|
||||||
this.config.dateList.push({literal: ''});
|
this.config.dateList.push({literal: '', timeList: []});
|
||||||
}
|
}
|
||||||
|
|
||||||
addtime() {
|
addtime() {
|
||||||
this.config.timeList.push({literal: ''});
|
this.config.timeList.push({literal: '', timeList: []});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,15 +38,19 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|||||||
let selector = '[ng-reflect-name="dateTime_' + id + '_Choices_' + (config.timeList.length - 1) + '"]';
|
let selector = '[ng-reflect-name="dateTime_' + id + '_Choices_' + (config.timeList.length - 1) + '"]';
|
||||||
console.log('selector', selector);
|
console.log('selector', selector);
|
||||||
this.cd.detectChanges();
|
this.cd.detectChanges();
|
||||||
const elem = document.querySelector(selector);
|
const elem = this.document.querySelector(selector);
|
||||||
if (elem) {
|
if (elem) {
|
||||||
//this.elem.focus();
|
elem.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emptyAll() {
|
emptyAll() {
|
||||||
this.config.dateList.forEach(element => {
|
this.config.dateList.forEach(element => {
|
||||||
element.literal = '';
|
element.literal = '';
|
||||||
|
element.timeList = ['', '', ''];
|
||||||
|
});
|
||||||
|
this.config.timeList.forEach(element => {
|
||||||
|
element.literal = '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user