mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
⚡ theme persisted in the localstorage, reload config on page reload - issue #75
This commit is contained in:
parent
6e6b812d2d
commit
936110846c
@ -1,6 +1,6 @@
|
|||||||
<div
|
<div
|
||||||
id='big_container'
|
id='big_container'
|
||||||
class={{this.config.themeClass}}
|
class={{this.config.preferences.themeClass}}
|
||||||
>
|
>
|
||||||
|
|
||||||
<header class='big-header'>
|
<header class='big-header'>
|
||||||
|
@ -21,7 +21,6 @@ export class AppComponent {
|
|||||||
@Inject(DOCUMENT) private document,
|
@Inject(DOCUMENT) private document,
|
||||||
private route: Router) {
|
private route: Router) {
|
||||||
this.detectCurrentTabOnRouteChange();
|
this.detectCurrentTabOnRouteChange();
|
||||||
this.findLocalStoragePreferences();
|
|
||||||
|
|
||||||
this.isDevelopmentEnv = !environment.production
|
this.isDevelopmentEnv = !environment.production
|
||||||
}
|
}
|
||||||
@ -56,13 +55,5 @@ export class AppComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public findLocalStoragePreferences() {
|
|
||||||
const storage = window.localStorage;
|
|
||||||
|
|
||||||
if ( storage ){
|
|
||||||
const preferences = storage.getItem('FramadateConfig');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,14 @@ const baseConfigValues = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configuration of the poll, add new fields at will
|
* configuration of the poll, add new fields at will
|
||||||
*/
|
*/
|
||||||
export class PollConfig {
|
export class PollConfig {
|
||||||
|
|
||||||
|
|
||||||
menuVisible = true;
|
menuVisible = true;
|
||||||
|
|
||||||
expiracyDateDefaultInDays = 60;
|
expiracyDateDefaultInDays = 60;
|
||||||
|
@ -74,10 +74,10 @@
|
|||||||
{{"visibility.archiving_can_not"|translate}}
|
{{"visibility.archiving_can_not"|translate}}
|
||||||
</option >
|
</option >
|
||||||
</select >
|
</select >
|
||||||
<span *ngIf="config.canModifyAnswers == 'false' || config.canModifyAnswers == false">
|
<span *ngIf=" config.canModifyAnswers == false">
|
||||||
{{"visibility.archiving_end_not"|translate}}
|
{{"visibility.archiving_end_not"|translate}}
|
||||||
</span>
|
</span>
|
||||||
<span class="can_modify_votes" *ngIf="config.canModifyAnswers== 'true' || config.canModifyAnswers== true">
|
<span class="can_modify_votes" *ngIf="config.canModifyAnswers== true ">
|
||||||
<label for="modificationScope">
|
<label for="modificationScope">
|
||||||
{{"visibility.archiving_end"|translate}}
|
{{"visibility.archiving_end"|translate}}
|
||||||
</label>
|
</label>
|
||||||
|
@ -20,12 +20,7 @@ export class VotingSummaryComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.computePreferred();
|
this.computePreferred();
|
||||||
console.log(' this.pollconfig.choices', this.pollconfig.choices)
|
}
|
||||||
console.log(' this.pollconfig.choices_count', this.pollconfig.choices_count.counts)
|
|
||||||
console.log('this.pollconfig.choices_count.counts[10]', this.pollconfig.choices_count.counts[10])
|
|
||||||
console.log('this.pollconfig.choices[2].id', this.pollconfig.choices[2].id)
|
|
||||||
console.log('this.pollconfig.choices_count.counts[]', this.pollconfig.choices_count.counts[this.pollconfig.choices[2].id].score)
|
|
||||||
}
|
|
||||||
|
|
||||||
getKeys(obj) {
|
getKeys(obj) {
|
||||||
return Object.keys(obj)
|
return Object.keys(obj)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,21 +2,21 @@
|
|||||||
<h1 class='title' >Thème</h1 >
|
<h1 class='title' >Thème</h1 >
|
||||||
<span
|
<span
|
||||||
class='choice btn'
|
class='choice btn'
|
||||||
[ngClass]="{ 'btn--primary' : config.themeClass ==='theme-light-watermelon' }"
|
[ngClass]="{ 'btn--primary' : config.preferences.themeClass ==='theme-light-watermelon' }"
|
||||||
(click)="selectTheme('light-watermelon')" >
|
(click)="selectTheme('light-watermelon')" >
|
||||||
|
|
||||||
<i class='fa fa-sun-o' ></i > light
|
<i class='fa fa-sun-o' ></i > light
|
||||||
</span >
|
</span >
|
||||||
<span
|
<span
|
||||||
class='choice btn'
|
class='choice btn'
|
||||||
[ngClass]="{ 'btn--primary' : config.themeClass ==='theme-dark-crystal' }"
|
[ngClass]="{ 'btn--primary' : config.preferences.themeClass ==='theme-dark-crystal' }"
|
||||||
(click)="selectTheme('dark-crystal')" >
|
(click)="selectTheme('dark-crystal')" >
|
||||||
|
|
||||||
<i class='fa fa-moon-o' ></i > dark
|
<i class='fa fa-moon-o' ></i > dark
|
||||||
</span >
|
</span >
|
||||||
<span
|
<span
|
||||||
class='choice btn'
|
class='choice btn'
|
||||||
[ngClass]="{ 'btn--primary' : config.themeClass ==='theme-hot-covid' }"
|
[ngClass]="{ 'btn--primary' : config.preferences.themeClass ==='theme-hot-covid' }"
|
||||||
|
|
||||||
(click)="selectTheme('hot-covid')" >
|
(click)="selectTheme('hot-covid')" >
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ConfigService} from "../../services/config.service";
|
import {ConfigService} from '../../services/config.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'framadate-theme-selector',
|
selector: 'framadate-theme-selector',
|
||||||
@ -9,6 +9,7 @@ import {ConfigService} from "../../services/config.service";
|
|||||||
export class ThemeSelectorComponent implements OnInit {
|
export class ThemeSelectorComponent implements OnInit {
|
||||||
|
|
||||||
constructor(public config: ConfigService) {
|
constructor(public config: ConfigService) {
|
||||||
|
// this.selectTheme('dark-crystal')
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -16,8 +17,8 @@ export class ThemeSelectorComponent implements OnInit {
|
|||||||
|
|
||||||
selectTheme(themeName: string) {
|
selectTheme(themeName: string) {
|
||||||
if (this.config.themeChoices.includes(themeName)) {
|
if (this.config.themeChoices.includes(themeName)) {
|
||||||
this.config.themeSelected = this.config.themeChoices.indexOf(themeName);
|
|
||||||
this.config.themeClass = `theme-${themeName}`;
|
this.config.setPreference('themeName', themeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user