Skip to content

Commit 5d86915

Browse files
committed
v1.0.0
1 parent d9b88a0 commit 5d86915

39 files changed

+302
-78
lines changed

Angular4_CLI_Full_Project/.angular-cli.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
33
"project": {
44
"version": "1.0.0",
5-
"name": "coreui-angular"
5+
"name": "@coreui/angular"
66
},
77
"apps": [
88
{

Angular4_CLI_Full_Project/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "coreui-angular",
2+
"name": "@coreui/angular",
33
"version": "1.0.0",
4-
"description": "Open Source Bootstrap Admin Template",
4+
"description": "",
55
"author": "",
66
"url": "http://coreui.io",
77
"copyright": "Copyright 2017 creativeLabs Łukasz Holeczek",

Angular4_CLI_Full_Project/src/app/app.module.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import {
2424
AppSidebar,
2525
AppSidebarFooter,
2626
AppSidebarForm,
27-
AppSidebarHeader
27+
AppSidebarHeader,
28+
AppSidebarMinimizer
2829
} from './components';
2930

3031
const APP_COMPONENTS = [
@@ -35,7 +36,8 @@ const APP_COMPONENTS = [
3536
AppSidebar,
3637
AppSidebarFooter,
3738
AppSidebarForm,
38-
AppSidebarHeader
39+
AppSidebarHeader,
40+
AppSidebarMinimizer
3941
]
4042

4143
// Import directives

Angular4_CLI_Full_Project/src/app/components/app-header/app-header.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<header class="app-header navbar">
22
<button class="navbar-toggler d-lg-none" type="button" appMobileSidebarToggler>&#9776;</button>
33
<a class="navbar-brand" href="#"></a>
4-
<button class="navbar-toggler d-md-down-none" type="button" appSidebarMinimizer>&#9776;</button>
4+
<button class="navbar-toggler d-md-down-none" type="button" appSidebarToggler>&#9776;</button>
55
<ul class="nav navbar-nav d-md-down-none">
66
<li class="nav-item px-3">
77
<a class="nav-link" href="#">Dashboard</a>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<button class="sidebar-minimizer" type="button" appSidebarMinimizer appBrandMinimizer></button>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Component, ElementRef } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-sidebar-minimizer',
5+
templateUrl: './app-sidebar-minimizer.component.html'
6+
})
7+
export class AppSidebarMinimizer {
8+
9+
constructor(private el: ElementRef) { }
10+
11+
//wait for the component to render completely
12+
ngOnInit(): void {
13+
var nativeElement: HTMLElement = this.el.nativeElement,
14+
parentElement: HTMLElement = nativeElement.parentElement;
15+
// move all children out of the element
16+
while (nativeElement.firstChild) {
17+
parentElement.insertBefore(nativeElement.firstChild, nativeElement);
18+
}
19+
// remove the empty element(the host)
20+
parentElement.removeChild(nativeElement);
21+
}
22+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './app-sidebar-minimizer.component';

Angular4_CLI_Full_Project/src/app/components/app-sidebar/app-sidebar.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@
7777
</li>
7878
</ul>
7979
</li>
80+
<li class="nav-item mt-auto">
81+
<a class="nav-link nav-link-success" href="http://coreui.io/angular/"><i class="icon-cloud-download"></i> Download CoreUI</a>
82+
</li>
83+
<li class="nav-item">
84+
<a class="nav-link nav-link-danger" href="http://coreui.io/pro/angular/"><i class="icon-layers"></i> Try CoreUI <strong>PRO</strong></a>
85+
</li>
8086
</ul>
8187
</nav>
8288
<app-sidebar-footer></app-sidebar-footer>
89+
<app-sidebar-minimizer></app-sidebar-minimizer>
8390
</div>

Angular4_CLI_Full_Project/src/app/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export * from './app-sidebar';
66
export * from './app-sidebar-footer';
77
export * from './app-sidebar-form';
88
export * from './app-sidebar-header';
9+
export * from './app-sidebar-minimizer';

Angular4_CLI_Full_Project/src/app/directives/sidebar/sidebar.directive.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ export class SidebarMinimizeDirective {
2929
}
3030
}
3131

32+
@Directive({
33+
selector: '[appBrandMinimizer]'
34+
})
35+
export class BrandMinimizeDirective {
36+
constructor() { }
37+
38+
@HostListener('click', ['$event'])
39+
toggleOpen($event: any) {
40+
$event.preventDefault();
41+
document.querySelector('body').classList.toggle('brand-minimized');
42+
}
43+
}
44+
3245
@Directive({
3346
selector: '[appMobileSidebarToggler]'
3447
})
@@ -87,6 +100,7 @@ export class SidebarOffCanvasCloseDirective {
87100
export const SIDEBAR_TOGGLE_DIRECTIVES = [
88101
SidebarToggleDirective,
89102
SidebarMinimizeDirective,
103+
BrandMinimizeDirective,
90104
SidebarOffCanvasCloseDirective,
91105
MobileSidebarToggleDirective
92106
];

0 commit comments

Comments
 (0)