-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Servicios básicos, temas, rutas básicas y persistentes
- Loading branch information
1 parent
fc712aa
commit a04e35f
Showing
25 changed files
with
345 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/app/pages/accout-settings/accout-settings.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<div class="row"> | ||
<div class="col-5"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h4>Seleccione un tema </h4> | ||
<div class="r-panel-body"> | ||
<ul id="themecolors" class="m-t-20"> | ||
<li><b>Con el sidebar claro</b></li> | ||
<li><a (click)="changeTheme('default')" data-theme="default" class="selector default-theme">1</a></li> | ||
<li><a (click)="changeTheme('green')" data-theme="green" class="selector green-theme">2</a></li> | ||
<li><a (click)="changeTheme('red')" data-theme="red" class="selector red-theme">3</a></li> | ||
<li><a (click)="changeTheme('blue')" data-theme="blue" class="selector blue-theme">4</a></li> | ||
<li><a (click)="changeTheme('purple')" data-theme="purple" class="selector purple-theme">5</a></li> | ||
<li><a (click)="changeTheme('megna')" data-theme="megna" class="selector megna-theme">6</a></li> | ||
|
||
<li class="d-block m-t-30"><b>Con el sidebar oscuro</b></li> | ||
<li><a (click)="changeTheme('default-dark')" data-theme="default-dark" class="selector default-dark-theme">7</a></li> | ||
<li><a (click)="changeTheme('green-dark')" data-theme="green-dark" class="selector green-dark-theme">8</a></li> | ||
<li><a (click)="changeTheme('red-dark')" data-theme="red-dark" class="selector red-dark-theme">9</a></li> | ||
<li><a (click)="changeTheme('blue-dark')" data-theme="blue-dark" class="selector blue-dark-theme working">10</a></li> | ||
<li><a (click)="changeTheme('purple-dark')" data-theme="purple-dark" class="selector purple-dark-theme">11</a></li> | ||
<li><a (click)="changeTheme('megna-dark')" data-theme="megna-dark" class="selector megna-dark-theme">12</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
22 changes: 22 additions & 0 deletions
22
src/app/pages/accout-settings/accout-settings.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { SettingsService } from '../../services/settings.service'; | ||
|
||
@Component({ | ||
selector: 'app-accout-settings', | ||
templateUrl: './accout-settings.component.html', | ||
styles: [ | ||
] | ||
}) | ||
export class AccoutSettingsComponent implements OnInit { | ||
|
||
constructor(private settingsService: SettingsService) { } | ||
|
||
ngOnInit(): void { | ||
this.settingsService.checkCurrentTheme(); | ||
} | ||
|
||
changeTheme(theme: string) { | ||
this.settingsService.changeTheme(theme); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class SettingsService { | ||
|
||
private linkTheme = document.querySelector('#theme'); | ||
|
||
constructor() { | ||
const url = localStorage.getItem('theme') || './assets/css/colors/purple-dark.css'; | ||
this.linkTheme?.setAttribute('href', url); | ||
} | ||
|
||
|
||
changeTheme(theme: string) { | ||
const url = `./assets/css/colors/${theme}.css`; | ||
this.linkTheme?.setAttribute('href', url); | ||
localStorage.setItem('theme', url); | ||
|
||
this.checkCurrentTheme(); | ||
} | ||
|
||
checkCurrentTheme() { | ||
|
||
const links = document.querySelectorAll('.selector'); | ||
|
||
links.forEach(elem => { | ||
elem.classList.remove('working'); | ||
const btnTheme = elem.getAttribute('data-theme'); | ||
const btnThemeUrl = `./assets/css/colors/${btnTheme}.css`; | ||
const currentTheme = this.linkTheme?.getAttribute('href'); | ||
|
||
if (btnThemeUrl === currentTheme) { | ||
elem.classList.add('working'); | ||
} | ||
|
||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class SidebarService { | ||
|
||
menu: any[] = [ | ||
{ | ||
titulo: 'Dashboard', | ||
icono: 'mdi mdi-gauge', | ||
submenu: [ | ||
{ titulo: 'Main', url: '/' }, | ||
{ titulo: 'Progressbar', url: 'progress' }, | ||
{ titulo: 'Gráfica', url: 'grafica1' }, | ||
] | ||
} | ||
]; | ||
|
||
constructor() { } | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.