-
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.
- Loading branch information
martinbobbio1@gmail.com
committed
Oct 9, 2018
1 parent
6cc08fd
commit 7ef05c3
Showing
21 changed files
with
274 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
import { SettingsService } from './services/service.index'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
}) | ||
export class AppComponent { | ||
title = 'app'; | ||
|
||
constructor(public _settingsService:SettingsService){ | ||
|
||
} | ||
|
||
} |
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
31 changes: 31 additions & 0 deletions
31
src/app/pages/account-settings/account-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,31 @@ | ||
<div class="row"> | ||
<div class="col-4"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
|
||
<h4>Temas</h4><hr> | ||
|
||
<div class="r-panel-body"> | ||
<ul id="themecolors" class="m-t-20"> | ||
<li><b>Con el sidebar claro</b></li> | ||
<li><a #link1 (click)="changeColor('default',link1)" data-theme="default" class="selector default-theme working">1</a></li> | ||
<li><a #link2 (click)="changeColor('green',link2)" data-theme="green" class="selector green-theme">2</a></li> | ||
<li><a #link3 (click)="changeColor('red',link3)" data-theme="red" class="selector red-theme">3</a></li> | ||
<li><a #link4 (click)="changeColor('blue',link4)" data-theme="blue" class="selector blue-theme">4</a></li> | ||
<li><a #link5 (click)="changeColor('purple',link5)" data-theme="purple" class="selector purple-theme">5</a></li> | ||
<li><a #link6 (click)="changeColor('megna',link6)" 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 #link7 (click)="changeColor('default-dark',link7)" data-theme="default-dark" class="selector default-dark-theme">7</a></li> | ||
<li><a #link8 (click)="changeColor('green-dark',link8)" data-theme="green-dark" class="selector green-dark-theme">8</a></li> | ||
<li><a #link9 (click)="changeColor('red-dark',link9)" data-theme="red-dark" class="selector red-dark-theme">9</a></li> | ||
<li><a #link10 (click)="changeColor('blue-dark',link10)" data-theme="blue-dark" class="selector blue-dark-theme">10</a></li> | ||
<li><a #link11 (click)="changeColor('purple-dark',link11)" data-theme="purple-dark" class="selector purple-dark-theme">11</a></li> | ||
<li><a #link12 (click)="changeColor('megna-dark',link12)" data-theme="megna-dark" class="selector megna-dark-theme">12</a></li> | ||
</ul> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> |
50 changes: 50 additions & 0 deletions
50
src/app/pages/account-settings/account-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,50 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { SettingsService } from '../../services/service.index'; | ||
|
||
@Component({ | ||
selector: 'app-account-settings', | ||
templateUrl: './account-settings.component.html', | ||
styles: [] | ||
}) | ||
export class AccountSettingsComponent implements OnInit { | ||
|
||
constructor(public _settingsService:SettingsService) { } | ||
|
||
ngOnInit() { | ||
this.loadCheck(); | ||
} | ||
|
||
changeColor(theme:string,link:any){ | ||
|
||
this.activateCheck(link); | ||
this._settingsService.applyTheme(theme); | ||
|
||
} | ||
|
||
activateCheck(link:any){ | ||
|
||
let selectors:any = document.getElementsByClassName('selector'); | ||
for(let ref of selectors){ | ||
ref.classList.remove('working'); | ||
} | ||
|
||
link.classList.add('working'); | ||
|
||
} | ||
|
||
loadCheck(){ | ||
|
||
let selectors:any = document.getElementsByClassName('selector'); | ||
let theme = this._settingsService.settings.theme; | ||
|
||
for(let ref of selectors){ | ||
ref.classList.remove('working'); | ||
if(ref.getAttribute('data-theme')=== theme){ | ||
ref.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
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,3 @@ | ||
export { SettingsService } from './settings/settings.service'; | ||
export { SharedService } from './shared/shared.service'; | ||
export { SidebarService } from './sidebar/sidebar.service'; |
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,17 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { SettingsService, SharedService, SidebarService } from './service.index'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule | ||
], | ||
providers: [ | ||
SettingsService, | ||
SharedService, | ||
SidebarService | ||
], | ||
declarations: [] | ||
}) | ||
export class ServiceModule { } |
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,45 @@ | ||
import { Injectable, Inject } from '@angular/core'; | ||
import { DOCUMENT } from '@angular/platform-browser'; | ||
|
||
@Injectable() | ||
export class SettingsService { | ||
|
||
settings:Settings = { | ||
themeUrl: 'assets/css/colors/default.css', | ||
theme: 'default' | ||
} | ||
|
||
constructor(@Inject(DOCUMENT) private _document) { | ||
this.loadSettings(); | ||
} | ||
|
||
saveSettings(){ | ||
|
||
localStorage.setItem('settings',JSON.stringify(this.settings)) | ||
} | ||
|
||
loadSettings(){ | ||
|
||
if(localStorage.getItem('settings')) | ||
this.settings = JSON.parse(localStorage.getItem('settings')); | ||
|
||
this.applyTheme(this.settings.theme); | ||
} | ||
|
||
applyTheme(theme:string){ | ||
|
||
let url = `assets/css/colors/${theme}.css` | ||
this._document.getElementById('theme').setAttribute('href',url); | ||
|
||
this.settings.theme = theme; | ||
this.settings.themeUrl = url; | ||
this.saveSettings(); | ||
|
||
} | ||
|
||
} | ||
|
||
interface Settings{ | ||
themeUrl:string; | ||
theme:string; | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable() | ||
export class SidebarService { | ||
|
||
menu: any = [ | ||
{ | ||
title: 'Principal', icon: 'mdi mdi-gauge', | ||
submenu: [ | ||
{ title: 'Dashboard', url: '/dashboard' }, | ||
{ title: 'ProgressBar', url: '/progress' }, | ||
{ title: 'Graphics', url: '/graphic' } | ||
] | ||
} | ||
] | ||
|
||
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
Oops, something went wrong.