mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-19 17:00:13 +01:00
Updates
This commit is contained in:
parent
be84925112
commit
00a47bf22f
9 changed files with 93 additions and 94 deletions
|
|
@ -50,38 +50,38 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-content">
|
<div class="inner-content">
|
||||||
<h1>Getting Started</h1>
|
<h1>Getting Started</h1>
|
||||||
<div class="subHeader"></div><h2 id="what-is-ng2-admin-">What is ng2-admin?</h2>
|
<div class="subHeader"></div><h2 id="what-is-ng2-admin-">What is ng2-admin?</h2>
|
||||||
<p>ng2-admin is a front-end Admin Dashboard template based on Angular 2, Bootstrap 4 and Webpack. That means all the
|
<p>ng2-admin is a front-end Admin Dashboard template based on Angular 2, Bootstrap 4 and Webpack. That means all the
|
||||||
data you can see on graphs, charts and tables is mocked in Javascript so you can use the
|
data you can see on graphs, charts and tables is mocked in Javascript so you can use the
|
||||||
backend of your choice with no limitations.</p>
|
backend of your choice with no<span class="widont"> </span>limitations.</p>
|
||||||
<h2 id="how-can-it-help-me-">How can it help me?</h2>
|
<h2 id="how-can-it-help-me-">How can it help<span class="widont"> </span>me?</h2>
|
||||||
<p>We believe that at the moment a lot of business applications have administration/management interfaces inside of them. Sometimes it’s not that obvious, but a lot of web applications have dashboards with panels, charts analytics, etc.</p>
|
<p>We believe that at the moment a lot of business applications have administration/management interfaces inside of them. Sometimes it’s not that obvious, but a lot of web applications have dashboards with panels, charts analytics,<span class="widont"> </span>etc.</p>
|
||||||
<p>ng2-admin aims to bootstrap the development of your product and provide an
|
<p>ng2-admin aims to bootstrap the development of your product and provide an
|
||||||
ecosystem for building production-ready application or prototypes.</p>
|
ecosystem for building production-ready application or<span class="widont"> </span>prototypes.</p>
|
||||||
<p>Frameworks like Bootstrap provide a number of components, but usually it’s not enough to
|
<p>Frameworks like Bootstrap provide a number of components, but usually it’s not enough to
|
||||||
build a real-world app. This template comes with lots of popular <span class="caps">UI</span> components with a unified color scheme,
|
build a real-world app. This template comes with lots of popular <span class="caps">UI</span> components with a unified color scheme,
|
||||||
plus it is based on a modern Angular 2 framework and has a flexible component based structure.</p>
|
plus it is based on a modern Angular 2 framework and has a flexible component based<span class="widont"> </span>structure.</p>
|
||||||
<p>You can also use ng2-admin for the purpose of learning Angular 2.</p>
|
<p>You can also use ng2-admin for the purpose of learning Angular<span class="widont"> </span>2.</p>
|
||||||
<h2 id="list-of-features">List of features</h2>
|
<h2 id="list-of-features">List of features</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Angular 2</li>
|
<li>Angular 2</li>
|
||||||
<li>Webpack 2</li>
|
<li>Webpack 2</li>
|
||||||
<li>Bootstrap 4 <span class="caps">CSS</span> Framework</li>
|
<li>Bootstrap 4 <span class="caps">CSS</span><span class="widont"> </span>Framework</li>
|
||||||
<li><span class="caps">SASS</span></li>
|
<li><span class="caps">SASS</span></li>
|
||||||
<li><a href="http://akveo.com/ng2-admin/#/pages/tables/smarttables">Smart Table</a></li>
|
<li><a href="http://akveo.com/ng2-admin/#/pages/tables/smarttables">Smart Table</a></li>
|
||||||
<li><a href="http://akveo.com/ng2-admin/#/pages/forms/inputs">Forms</a></li>
|
<li><a href="http://akveo.com/ng2-admin/#/pages/forms/inputs">Forms</a></li>
|
||||||
<li><a href="http://akveo.com/ng2-admin/#/pages/editors/ckeditor">Editors</a></li>
|
<li><a href="http://akveo.com/ng2-admin/#/pages/editors/ckeditor">Editors</a></li>
|
||||||
<li><a href="http://akveo.com/ng2-admin/#/pages/charts/chartist-js">Charts (amChart, Chartist, Chart.js, Morris)</a></li>
|
<li><a href="http://akveo.com/ng2-admin/#/pages/charts/chartist-js">Charts (amChart, Chartist, Chart.js,<span class="widont"> </span>Morris)</a></li>
|
||||||
<li><a href="http://akveo.com/ng2-admin/#/pages/maps/googlemaps">Maps (Google, Leaflet, amMap)</a></li>
|
<li><a href="http://akveo.com/ng2-admin/#/pages/maps/googlemaps">Maps (Google, Leaflet,<span class="widont"> </span>amMap)</a></li>
|
||||||
<li>Responsive layout</li>
|
<li>Responsive layout</li>
|
||||||
<li>High resolution</li>
|
<li>High resolution</li>
|
||||||
<li>and many more!</li>
|
<li>and many more!</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2 id="i-want-to-start-developing-with-ng2-admin">I want to start developing with ng2-admin</h2>
|
<h2 id="i-want-to-start-developing-with-ng2-admin">I want to start developing with<span class="widont"> </span>ng2-admin</h2>
|
||||||
<p>Welcome aboard!</p>
|
<p>Welcome aboard!</p>
|
||||||
<p>You can start with the <a href="/ng2-admin/articles/002-installation-guidelines/">Installation Guidelines</a>.
|
<p>You can start with the <a href="/ng2-admin/articles/002-installation-guidelines/">Installation Guidelines</a>.
|
||||||
There we describe how you can download and run the template on your local machine.</p>
|
There we describe how you can download and run the template on your local<span class="widont"> </span>machine.</p>
|
||||||
<p>Good luck and have fun!</p>
|
<p>Good luck and have<span class="widont"> </span>fun!</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -52,36 +52,36 @@
|
||||||
<h1>Installation Guidelines</h1>
|
<h1>Installation Guidelines</h1>
|
||||||
<div class="subHeader"></div><h2 id="prerequisites">Prerequisites</h2>
|
<div class="subHeader"></div><h2 id="prerequisites">Prerequisites</h2>
|
||||||
<p>Although ng2-admin can be run without any development experience, it would be much easier if you already have some.
|
<p>Although ng2-admin can be run without any development experience, it would be much easier if you already have some.
|
||||||
The following instructions allow you to run a local copy on your machine.</p>
|
The following instructions allow you to run a local copy on your<span class="widont"> </span>machine.</p>
|
||||||
<h2 id="install-tools">Install tools</h2>
|
<h2 id="install-tools">Install tools</h2>
|
||||||
<p>If you don’t have any of these tools installed already, you will need to:</p>
|
<p>If you don’t have any of these tools installed already, you will need<span class="widont"> </span>to:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Download and install <a href="https://git-scm.com/">git</a></li>
|
<li>Download and install <a href="https://git-scm.com/">git</a></li>
|
||||||
<li>Download and install nodejs <a href="https://nodejs.org">https://nodejs.org</a></li>
|
<li>Download and install nodejs <a href="https://nodejs.org">https://nodejs.org</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p><strong>Note</strong>: Make sure you have Node version >= 4.0 and <span class="caps">NPM</span> >= 3</p>
|
<p><strong>Note</strong>: Make sure you have Node version >= 4.0 and <span class="caps">NPM</span> >=<span class="widont"> </span>3</p>
|
||||||
<h2 id="clone-repository-and-install-dependencies">Clone repository and install dependencies</h2>
|
<h2 id="clone-repository-and-install-dependencies">Clone repository and install<span class="widont"> </span>dependencies</h2>
|
||||||
<p>You will need to clone the source code of ng2-admin GitHub repository:</p>
|
<p>You will need to clone the source code of ng2-admin GitHub<span class="widont"> </span>repository:</p>
|
||||||
<pre><code class="lang-bash">git <span class="built_in">clone</span> https://github.com/akveo/ng2-admin.git
|
<pre><code class="lang-bash">git <span class="built_in">clone</span> https://github.com/akveo/ng2-admin.git
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>After the repository is cloned, go inside of the repository directory and install dependencies:</p>
|
<p>After the repository is cloned, go inside of the repository directory and install<span class="widont"> </span>dependencies:</p>
|
||||||
<pre><code class="lang-bash"><span class="built_in">cd</span> ng2-admin
|
<pre><code class="lang-bash"><span class="built_in">cd</span> ng2-admin
|
||||||
npm install
|
npm install
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>This will setup a working copy of ng2-admin on your local machine.</p>
|
<p>This will setup a working copy of ng2-admin on your local<span class="widont"> </span>machine.</p>
|
||||||
<h2 id="running-local-copy">Running local copy</h2>
|
<h2 id="running-local-copy">Running local copy</h2>
|
||||||
<p>To run a local copy in development mode, execute:</p>
|
<p>To run a local copy in development mode,<span class="widont"> </span>execute:</p>
|
||||||
<pre><code class="lang-bash">npm start
|
<pre><code class="lang-bash">npm start
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Go to <a href="http://0.0.0.0:3000">http://0.0.0.0:3000</a> or <a href="http://localhost:3000">http://localhost:3000</a> in your browser.</p>
|
<p>Go to <a href="http://0.0.0.0:3000">http://0.0.0.0:3000</a> or <a href="http://localhost:3000">http://localhost:3000</a> in your<span class="widont"> </span>browser.</p>
|
||||||
<p>To run the local copy in production mode and build the sources, execute:</p>
|
<p>To run the local copy in production mode and build the sources,<span class="widont"> </span>execute:</p>
|
||||||
<pre><code class="lang-bash">npm run prebuild:prod && npm run build:prod && npm run server:prod
|
<pre><code class="lang-bash">npm run prebuild:prod && npm run build:prod && npm run server:prod
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>This will clear up your dist folder (where release files are located), generate a release build and start the
|
<p>This will clear up your dist folder (where release files are located), generate a release build and start the
|
||||||
built-in server.
|
built-in server.
|
||||||
Now you can copy the sources from the <code>dist</code> folder and use it with any backend framework or
|
Now you can copy the sources from the <code>dist</code> folder and use it with any backend framework or
|
||||||
simply put it under a web server.</p>
|
simply put it under a web<span class="widont"> </span>server.</p>
|
||||||
<p>For addition information about creating a build, please check out <a href="https://github.com/AngularClass/angular2-webpack-starter">Angular2 Webpack Starter documentation</a></p>
|
<p>For addition information about creating a build, please check out <a href="https://github.com/AngularClass/angular2-webpack-starter">Angular2 Webpack Starter<span class="widont"> </span>documentation</a></p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-content">
|
<div class="inner-content">
|
||||||
<h1>Changing Color Scheme</h1>
|
<h1>Changing Color Scheme</h1>
|
||||||
<div class="subHeader"></div><p>We tried to make the process of color scheme customization as easy as possible. </p>
|
<div class="subHeader"></div><p>We tried to make the process of color scheme customization as easy as<span class="widont"> </span>possible. </p>
|
||||||
<p>By default ng2-admin has three built-in color profiles: ng2 (default blue sheme), mint and blur.
|
<p>By default ng2-admin has three built-in color profiles: ng2 (default blue sheme), mint and blur.
|
||||||
This article will help you to create your own color profile.
|
This article will help you to create your own color profile.
|
||||||
Let’s say you want to make ng2-admin dark theme.</p>
|
Let’s say you want to make ng2-admin dark<span class="widont"> </span>theme.</p>
|
||||||
<p>First we advise you to take some existing colorscheme file as a starting point.
|
<p>First we advise you to take some existing colorscheme file as a starting point.
|
||||||
For light themes we suggest taking <code>src/app/theme/sass/conf/colorScheme/_mint.scss</code> and for
|
For light themes we suggest taking <code>src/app/theme/sass/conf/colorScheme/_mint.scss</code> and for
|
||||||
dark <code>src/app/theme/sass/conf/colorScheme/_blue.scss</code>.
|
dark <code>src/app/theme/sass/conf/colorScheme/_blue.scss</code>.
|
||||||
|
|
@ -61,30 +61,30 @@ As we want a dark theme, we’re taking <code>blue</code>.</p>
|
||||||
<p>1) Copy <code>src/app/theme/sass/conf/colorScheme/_mint.scss</code> to <code>src/app/theme/sass/conf/colorScheme/_dark.scss</code>:
|
<p>1) Copy <code>src/app/theme/sass/conf/colorScheme/_mint.scss</code> to <code>src/app/theme/sass/conf/colorScheme/_dark.scss</code>:
|
||||||
<br><br></p>
|
<br><br></p>
|
||||||
<p>2) Include your colorscheme file in <code>src/app/theme/sass/conf/conf.scss</code>.</p>
|
<p>2) Include your colorscheme file in <code>src/app/theme/sass/conf/conf.scss</code>.</p>
|
||||||
<p>To do this, replace</p>
|
<p>To do this,<span class="widont"> </span>replace</p>
|
||||||
<pre><code class="lang-scss">@<span class="keyword">import</span> <span class="string">'colorSchemes/ng2'</span>;
|
<pre><code class="lang-scss"><span class="at_rule">@<span class="keyword">import</span> <span class="string">'colorSchemes/ng2'</span>;</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>with</p>
|
<p>with</p>
|
||||||
<pre><code class="lang-scss">@<span class="keyword">import</span> <span class="string">'colorSchemes/dark'</span>;
|
<pre><code class="lang-scss"><span class="at_rule">@<span class="keyword">import</span> <span class="string">'colorSchemes/dark'</span>;</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p><br><br></p>
|
<p><br><br></p>
|
||||||
<p>3) Change the color scheme enabled:</p>
|
<p>3) Change the color scheme<span class="widont"> </span>enabled:</p>
|
||||||
<p>Open <code>src/app/theme/theme.config.ts</code>.
|
<p>Open <code>src/app/theme/theme.config.ts</code>.
|
||||||
Uncomment the following line</p>
|
Uncomment the following<span class="widont"> </span>line</p>
|
||||||
<pre><code class="lang-javascript"> <span class="comment">//this._baConfig.changeTheme({name: 'my-theme'});</span>
|
<pre><code class="lang-javascript"> <span class="comment">//this._baConfig.changeTheme({name: 'my-theme'});</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>and put your theme name, in our case it is <code>dark</code></p>
|
<p>and put your theme name, in our case it is <code>dark</code></p>
|
||||||
<pre><code class="lang-javascript"> <span class="keyword">this</span>._baConfig.changeTheme({name: <span class="string">'dark'</span>});
|
<pre><code class="lang-javascript"> <span class="keyword">this</span>._baConfig.changeTheme({name: <span class="string">'dark'</span>});
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Beside notifying the system which scheme is currently enabled, this also puts a css class to a main element
|
<p>Beside notifying the system which scheme is currently enabled, this also puts a css class to a main element
|
||||||
of the page. Thus you can freely create theme-specific css selectors in your code without breakking other themes’ styles.</p>
|
of the page. Thus you can freely create theme-specific css selectors in your code without breakking other themes’<span class="widont"> </span>styles.</p>
|
||||||
<p>For example like this:</p>
|
<p>For example like<span class="widont"> </span>this:</p>
|
||||||
<pre><code class="lang-scss">. dark <span class="selector-class">.card-body</span> {
|
<pre><code class="lang-scss">. dark <span class="class">.card-body</span> {
|
||||||
<span class="attribute">background-color</span>: white;
|
<span class="attribute">background-color</span><span class="value">: white;</span>
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p><br><br></p>
|
<p><br><br></p>
|
||||||
<p>4) Change the colors:</p>
|
<p>4) Change the<span class="widont"> </span>colors:</p>
|
||||||
<p>Now you can start changing the colors.
|
<p>Now you can start changing the colors.
|
||||||
For example, after playing a bit with different colors, we changed the 2 first main variables in <code>_dark.scss</code> file:</p>
|
For example, after playing a bit with different colors, we changed the 2 first main variables in <code>_dark.scss</code> file:</p>
|
||||||
<pre><code class="lang-sass">$body-bg: #636363;
|
<pre><code class="lang-sass">$body-bg: #636363;
|
||||||
|
|
@ -135,14 +135,14 @@ To do this, add the following code to the configuration block inside <code>src/a
|
||||||
});
|
});
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Here we defined a list of main colors <code>colorScheme</code> and then made light and dark versions of those using <code>colorHelper</code> methods.
|
<p>Here we defined a list of main colors <code>colorScheme</code> and then made light and dark versions of those using <code>colorHelper</code> methods.
|
||||||
We also defined a couple of custom colors for dashboard charts.</p>
|
We also defined a couple of custom colors for dashboard<span class="widont"> </span>charts.</p>
|
||||||
<p>That’s basically it! Right now your admin application should look like this:</p>
|
<p>That’s basically it! Right now your admin application should look like<span class="widont"> </span>this:</p>
|
||||||
<p><img src="/ng2-admin/articles/011-changing-color-scheme/new-color-scheme.png" alt=""></p>
|
<p><img src="/ng2-admin/articles/011-changing-color-scheme/new-color-scheme.png" alt=""></p>
|
||||||
<p>For further reference, please look in</p>
|
<p>For further reference, please look<span class="widont"> </span>in</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Colorscheme scss file (<code>src/app/theme/sass/conf/colorScheme/_ng2.scss</code>, <code>src/app/theme/sass/conf/colorScheme/_mint.scss</code> and <code>src/app/theme/sass/conf/colorScheme/_blur.scss</code>)</li>
|
<li>Colorscheme scss file (<code>src/app/theme/sass/conf/colorScheme/_ng2.scss</code>, <code>src/app/theme/sass/conf/colorScheme/_mint.scss</code> and <code>src/app/theme/sass/conf/colorScheme/_blur.scss</code>)</li>
|
||||||
<li><code>src/app/theme/theme.configProvider.js</code> to understand which javascript colors can be changed</li>
|
<li><code>src/app/theme/theme.configProvider.js</code> to understand which javascript colors can be<span class="widont"> </span>changed</li>
|
||||||
<li>If you want to know how to change the theme to blur, read the <a href="/ng2-admin/articles/014-switch-to-blur-theme/">following article</a></li>
|
<li>If you want to know how to change the theme to blur, read the <a href="/ng2-admin/articles/014-switch-to-blur-theme/">following<span class="widont"> </span>article</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-content">
|
<div class="inner-content">
|
||||||
<h1>Project Structure</h1>
|
<h1>Project Structure</h1>
|
||||||
<div class="subHeader"></div><p>The project structure is originally based on <a href="https://github.com/AngularClass/angular2-webpack-starter#file-structure">Angular2 Webpack Starter</a>. We made some changes we thought would be better in our particular case.</p>
|
<div class="subHeader"></div><p>The project structure is originally based on <a href="https://github.com/AngularClass/angular2-webpack-starter#file-structure">Angular2 Webpack Starter</a>. We made some changes we thought would be better in our particular<span class="widont"> </span>case.</p>
|
||||||
<p>The directory structure of this template is as follows:</p>
|
<p>The directory structure of this template is as<span class="widont"> </span>follows:</p>
|
||||||
<pre><code>ng2-admin/
|
<pre><code>ng2-admin/
|
||||||
├──config/ * webpack build configuration
|
├──config/ * webpack build configuration
|
||||||
│ ├──head-config.common.js * configuration for head elements in index.html
|
│ ├──head-config.common.js * configuration for head elements in index.html
|
||||||
|
|
@ -87,7 +87,6 @@
|
||||||
│ │ │
|
│ │ │
|
||||||
│ │ ├──app.component.ts * main application component
|
│ │ ├──app.component.ts * main application component
|
||||||
│ │ │
|
│ │ │
|
||||||
│ │ ├──app.loader.ts * requires initial css styles (most important for application loading stage)
|
|
||||||
│ │ │
|
│ │ │
|
||||||
│ │ ├──app.menu.ts * menu pages routes
|
│ │ ├──app.menu.ts * menu pages routes
|
||||||
│ │ │
|
│ │ │
|
||||||
|
|
@ -114,7 +113,7 @@
|
||||||
└──package.json * what npm uses to manage it's dependencies
|
└──package.json * what npm uses to manage it's dependencies
|
||||||
</code></pre><p>In our template we tried to separate the theme layer and presentation layer. We believe most of other templates
|
</code></pre><p>In our template we tried to separate the theme layer and presentation layer. We believe most of other templates
|
||||||
have them combined. That’s why when you start developing using them, it gets very hard for you to remove things you
|
have them combined. That’s why when you start developing using them, it gets very hard for you to remove things you
|
||||||
don’t need.</p>
|
don’t<span class="widont"> </span>need.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-content">
|
<div class="inner-content">
|
||||||
<h1>Create New Page</h1>
|
<h1>Create New Page</h1>
|
||||||
<div class="subHeader"></div><p>ng2-admin uses <a href="https://angular.io/docs/ts/latest/guide/router.html">Angular 2 Component Router</a> for navigation.</p>
|
<div class="subHeader"></div><p>ng2-admin uses <a href="https://angular.io/docs/ts/latest/guide/router.html">Angular 2 Component Router</a> for<span class="widont"> </span>navigation.</p>
|
||||||
<p>We strongly recommend to follow this page structure in your application.
|
<p>We strongly recommend to follow this page structure in your application.
|
||||||
If it does not fit your needs please create a GitHub issue and tell us why. We would be glad to discuss. </p>
|
If it does not fit your needs please create a GitHub issue and tell us why. We would be glad to<span class="widont"> </span>discuss. </p>
|
||||||
<p>Basically any page is just a common Angular 2 Component with a route defined for it.</p>
|
<p>Basically any page is just a common Angular 2 Component with a route defined for<span class="widont"> </span>it.</p>
|
||||||
<h2 id="let-s-create-a-blank-page-in-6-easy-steps">Let’s create a blank page in 6 easy steps</h2>
|
<h2 id="let-s-create-a-blank-page-in-6-easy-steps">Let’s create a blank page in 6 easy<span class="widont"> </span>steps</h2>
|
||||||
<p>1) Create a new directory for our new page inside of <code>src/app/pages</code>. We can call the directory <code>new</code>.
|
<p>1) Create a new directory for our new page inside of <code>src/app/pages</code>. We can call the directory <code>new</code>.
|
||||||
<br><br></p>
|
<br><br></p>
|
||||||
<p>2) Then let’s create a blank angular 2 component for our page called ‘new.component.ts’ inside of <code>src/app/pages/new</code>:</p>
|
<p>2) Then let’s create a blank angular 2 component for our page called ‘new.component.ts’ inside of <code>src/app/pages/new</code>:</p>
|
||||||
|
|
@ -65,7 +65,7 @@ If it does not fit your needs please create a GitHub issue and tell us why. We w
|
||||||
template: <span class="string">`<strong>My page content here</strong>`</span>
|
template: <span class="string">`<strong>My page content here</strong>`</span>
|
||||||
})
|
})
|
||||||
<span class="keyword">export</span> <span class="class"><span class="keyword">class</span> <span class="title">NewComponent</span> </span>{
|
<span class="keyword">export</span> <span class="class"><span class="keyword">class</span> <span class="title">NewComponent</span> </span>{
|
||||||
<span class="keyword">constructor</span>() {}
|
constructor() {}
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>This will create a simple Angular 2 component. For more detail please check out <a href="https://angular.io/docs/ts/latest/guide/displaying-data.html">official Angular 2 documentation</a>.
|
<p>This will create a simple Angular 2 component. For more detail please check out <a href="https://angular.io/docs/ts/latest/guide/displaying-data.html">official Angular 2 documentation</a>.
|
||||||
|
|
@ -84,7 +84,7 @@ If it does not fit your needs please create a GitHub issue and tell us why. We w
|
||||||
<span class="keyword">export</span> <span class="keyword">const</span> routing = RouterModule.forChild(routes);
|
<span class="keyword">export</span> <span class="keyword">const</span> routing = RouterModule.forChild(routes);
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p><br></p>
|
<p><br></p>
|
||||||
<p>4) And now we should create <code>new.module.ts</code> in <code>src/app/pages/new</code> directory and import <code>new.component.ts</code> and <code>new.routing.ts</code> in it.</p>
|
<p>4) And now we should create <code>new.module.ts</code> in <code>src/app/pages/new</code> directory and import <code>new.component.ts</code> and <code>new.routing.ts</code> in it.</p>
|
||||||
<pre><code class="lang-javascript"><span class="keyword">import</span> { NgModule } <span class="keyword">from</span> <span class="string">'@angular/core'</span>;
|
<pre><code class="lang-javascript"><span class="keyword">import</span> { NgModule } <span class="keyword">from</span> <span class="string">'@angular/core'</span>;
|
||||||
<span class="keyword">import</span> { CommonModule } <span class="keyword">from</span> <span class="string">'@angular/common'</span>;
|
<span class="keyword">import</span> { CommonModule } <span class="keyword">from</span> <span class="string">'@angular/common'</span>;
|
||||||
<span class="keyword">import</span> { NewComponent } <span class="keyword">from</span> <span class="string">'./new.component'</span>;
|
<span class="keyword">import</span> { NewComponent } <span class="keyword">from</span> <span class="string">'./new.component'</span>;
|
||||||
|
|
@ -99,11 +99,11 @@ If it does not fit your needs please create a GitHub issue and tell us why. We w
|
||||||
NewComponent
|
NewComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
<span class="keyword">export</span> <span class="keyword">default</span> <span class="class"><span class="keyword">class</span> <span class="title">NewModule</span> </span>{}
|
<span class="keyword">export</span> <span class="class"><span class="keyword">class</span> <span class="title">NewModule</span> </span>{}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p><br></p>
|
<p><br></p>
|
||||||
<p>5) The penultimate thing we need to do is to declare a route in <code>src/app/pages/pages.menu.ts</code>.
|
<p>5) The penultimate thing we need to do is to declare a route in <code>src/app/pages/pages.menu.ts</code>.
|
||||||
Typically all pages are children of the <code>/pages</code> route and defined under the <code>children</code> property of the root <code>pages</code> route like this:</p>
|
Typically all pages are children of the <code>/pages</code> route and defined under the <code>children</code> property of the root <code>pages</code> route like<span class="widont"> </span>this:</p>
|
||||||
<pre><code class="lang-javascript"><span class="keyword">export</span> <span class="keyword">const</span> PAGES_MENU = [
|
<pre><code class="lang-javascript"><span class="keyword">export</span> <span class="keyword">const</span> PAGES_MENU = [
|
||||||
{
|
{
|
||||||
path: <span class="string">'pages'</span>,
|
path: <span class="string">'pages'</span>,
|
||||||
|
|
@ -141,15 +141,15 @@ Typically all pages are children of the <code>/pages</code> route and defined un
|
||||||
path - use pathMatch: ‘prefix’. In this case if the menu item has no children in the menu and
|
path - use pathMatch: ‘prefix’. In this case if the menu item has no children in the menu and
|
||||||
you navigated to some child route - the item will be highlighted.
|
you navigated to some child route - the item will be highlighted.
|
||||||
<br><br></p>
|
<br><br></p>
|
||||||
<p>6) And in the end let’s import our component in <code>src/app/pages/pages.routing.ts</code> like this:</p>
|
<p>6) And in the end let’s import our component in <code>src/app/pages/pages.routing.ts</code> like this:</p>
|
||||||
<pre><code class="lang-javascript"><span class="keyword">const</span> routes: Routes = [
|
<pre><code class="lang-javascript"><span class="keyword">const</span> routes: Routes = [
|
||||||
{
|
{
|
||||||
path: <span class="string">'pages'</span>,
|
path: <span class="string">'pages'</span>,
|
||||||
component: Pages,
|
component: Pages,
|
||||||
children: [
|
children: [
|
||||||
{ path: <span class="string">''</span>, redirectTo: <span class="string">'dashboard'</span>, pathMatch: <span class="string">'full'</span> },
|
{ path: <span class="string">''</span>, redirectTo: <span class="string">'dashboard'</span>, pathMatch: <span class="string">'full'</span> },
|
||||||
{ path: <span class="string">'dashboard'</span>, loadChildren: () => System.import(<span class="string">'./dashboard/dashboard.module'</span>) },
|
{ path: <span class="string">'dashboard'</span>, loadChildren: <span class="string">'app/pages/dashboard/dashboard.module#DashboardModule'</span> },
|
||||||
{ path: <span class="string">'new'</span>, loadChildren: () => System.import(<span class="string">'./new/new.module'</span>) }
|
{ path: <span class="string">'new'</span>, loadChildren: <span class="string">'app/pages/new/new.module#NewModule'</span> }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-content">
|
<div class="inner-content">
|
||||||
<h1>Enabling blur theme</h1>
|
<h1>Enabling blur theme</h1>
|
||||||
<div class="subHeader"></div><p>If you want to switch theme to the blur, you need to follow 3 simple steps:</p>
|
<div class="subHeader"></div><p>If you want to switch theme to the blur, you need to follow 3 simple<span class="widont"> </span>steps:</p>
|
||||||
<p>1) Blur color scheme needs some javascript to calculate initial background offsets for panels.
|
<p>1) Blur color scheme needs some javascript to calculate initial background offsets for panels.
|
||||||
That’s why we need to tell the system that we want to use blur theme by specifying this in <code>src/app/theme/theme.config.ts</code>:</p>
|
That’s why we need to tell the system that we want to use blur theme by specifying this in <code>src/app/theme/theme.config.ts</code>:</p>
|
||||||
<pre><code class="lang-javascript"> <span class="keyword">this</span>._baConfig.changeTheme({name: <span class="string">'blur'</span>});
|
<pre><code class="lang-javascript"> <span class="keyword">this</span>._baConfig.changeTheme({name: <span class="string">'blur'</span>});
|
||||||
|
|
@ -102,19 +102,19 @@ For our blur theme we use the following configuration in <code>src/app/theme/the
|
||||||
<p>3) <span class="caps">CSS</span> should also be recompiled.
|
<p>3) <span class="caps">CSS</span> should also be recompiled.
|
||||||
Before running build command, switch to <em>blur</em> color profile.
|
Before running build command, switch to <em>blur</em> color profile.
|
||||||
To do so replace theme in <code>src/app/theme/sass/conf/conf.scss</code>:</p>
|
To do so replace theme in <code>src/app/theme/sass/conf/conf.scss</code>:</p>
|
||||||
<pre><code class="lang-scss">@<span class="keyword">import</span> <span class="string">'colorScheme/ng2'</span>;
|
<pre><code class="lang-scss"><span class="at_rule">@<span class="keyword">import</span> <span class="string">'colorSchemes/ng2'</span>;</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>to</p>
|
<p>to</p>
|
||||||
<pre><code class="lang-scss">@<span class="keyword">import</span> <span class="string">'colorScheme/blur'</span>;
|
<pre><code class="lang-scss"><span class="at_rule">@<span class="keyword">import</span> <span class="string">'colorSchemes/blur'</span>;</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Additionaly, if you would like to use some different background, replace the following images:</p>
|
<p>Additionaly, if you would like to use some different background, replace the following<span class="widont"> </span>images:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>src/assets/img/blur-bg.jpg</code> (main background image)</li>
|
<li><code>src/assets/img/blur-bg.jpg</code> (main background<span class="widont"> </span>image)</li>
|
||||||
<li><code>src/assets/img/blur-bg-blurred.jpg</code> (blurred background image used on panels)</li>
|
<li><code>src/assets/img/blur-bg-blurred.jpg</code> (blurred background image used on<span class="widont"> </span>panels)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>We suggest using 10px Gaussian blur to blur an original image.</p>
|
<p>We suggest using 10px Gaussian blur to blur an original<span class="widont"> </span>image.</p>
|
||||||
<p><br><br>
|
<p><br><br>
|
||||||
That’s it! You have successfully blurred your theme! Run <code>npm start</code> and check it out.</p>
|
That’s it! You have successfully blurred your theme! Run <code>npm start</code> and check it<span class="widont"> </span>out.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,14 @@
|
||||||
<h1>Sidebar</h1>
|
<h1>Sidebar</h1>
|
||||||
<div class="subHeader"></div><p>The sidebar provides a convenient way to navigate the application.
|
<div class="subHeader"></div><p>The sidebar provides a convenient way to navigate the application.
|
||||||
Only one sidebar is supported per angular application.
|
Only one sidebar is supported per angular application.
|
||||||
This means that the sidebar is basically a singleton object.</p>
|
This means that the sidebar is basically a singleton<span class="widont"> </span>object.</p>
|
||||||
<p>The Sidebar can be added to the page using the <code>BaSidebar</code> component:</p>
|
<p>The Sidebar can be added to the page using the <code>BaSidebar</code> component:</p>
|
||||||
<pre><code class="lang-html"><span class="tag"><<span class="name">ba-sidebar</span>></span><span class="tag"></<span class="name">ba-sidebar</span>></span>
|
<pre><code class="lang-html"><span class="tag"><<span class="title">ba-sidebar</span>></span><span class="tag"></<span class="title">ba-sidebar</span>></span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>The sidebar contains a <code><ba-menu></ba-menu></code> component which defines and renders the application menu based on routes provided. Generally the <code>ba-menu</code> component can be used separately from <code>ba-sidebar</code>.
|
<p>The sidebar contains a <code><ba-menu></ba-menu></code> component which defines and renders the application menu based on routes provided. Generally the <code>ba-menu</code> component can be used separately from <code>ba-sidebar</code>.
|
||||||
All menu items information is defined inside the <code>data</code> property of a route.</p>
|
All menu items information is defined inside the <code>data</code> property of a<span class="widont"> </span>route.</p>
|
||||||
<h2 id="menu-configuration">Menu Configuration</h2>
|
<h2 id="menu-configuration">Menu Configuration</h2>
|
||||||
<p>All menu items are located inside the <code>src/app/app.routes.ts</code> file. Each route item can have a <code>menu</code> property under <code>data</code> defining a menu item:</p>
|
<p>All menu items are located inside the <code>src/app/app.routes.ts</code> file. Each route item can have a <code>menu</code> property under <code>data</code> defining a menu<span class="widont"> </span>item:</p>
|
||||||
<pre><code class="lang-javascript"> {
|
<pre><code class="lang-javascript"> {
|
||||||
<span class="comment">// first, router configuration</span>
|
<span class="comment">// first, router configuration</span>
|
||||||
path: <span class="string">'dashboard'</span>,
|
path: <span class="string">'dashboard'</span>,
|
||||||
|
|
@ -77,7 +77,7 @@ All menu items information is defined inside the <code>data</code> property of a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>You also can define a list of sub-menu items like this:</p>
|
<p>You also can define a list of sub-menu items like<span class="widont"> </span>this:</p>
|
||||||
<pre><code class="lang-javascript"> {
|
<pre><code class="lang-javascript"> {
|
||||||
<span class="comment">// parent route</span>
|
<span class="comment">// parent route</span>
|
||||||
path: <span class="string">'charts'</span>,
|
path: <span class="string">'charts'</span>,
|
||||||
|
|
@ -110,8 +110,8 @@ All menu items information is defined inside the <code>data</code> property of a
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h1 id="custom-menu-items">Custom menu items</h1>
|
<h1 id="custom-menu-items">Custom menu items</h1>
|
||||||
<p>You also can define a menu item not connected to any existing route in the application:</p>
|
<p>You also can define a menu item not connected to any existing route in the<span class="widont"> </span>application:</p>
|
||||||
<pre><code class="lang-javascript"> {
|
<pre><code class="lang-javascript"> {
|
||||||
path: <span class="string">''</span>, <span class="comment">// just leave the path empty</span>
|
path: <span class="string">''</span>, <span class="comment">// just leave the path empty</span>
|
||||||
data: {
|
data: {
|
||||||
|
|
|
||||||
|
|
@ -52,28 +52,28 @@
|
||||||
<h1>Theme Spinner</h1>
|
<h1>Theme Spinner</h1>
|
||||||
<div class="subHeader"></div><p>Theme Spinner <code>BaThemeSpinner</code> is a small service helper allowing you to show a preloader spinner while
|
<div class="subHeader"></div><p>Theme Spinner <code>BaThemeSpinner</code> is a small service helper allowing you to show a preloader spinner while
|
||||||
executing some long-running tasks.
|
executing some long-running tasks.
|
||||||
This is the same spinner you can see after reloading a page - it is shown while the application is initializing Angular 2 and loading charts and images.</p>
|
This is the same spinner you can see after reloading a page - it is shown while the application is initializing Angular 2 and loading charts and<span class="widont"> </span>images.</p>
|
||||||
<p>The user interface in quite simple: there are two public methods: <code>show</code> and <code>hide</code>.</p>
|
<p>The user interface in quite simple: there are two public methods: <code>show</code> and <code>hide</code>.</p>
|
||||||
<p>Theme Spinner comes with another small helper called <code>BaThemePreloader</code>.
|
<p>Theme Spinner comes with another small helper called <code>BaThemePreloader</code>.
|
||||||
This service is globally integrated into the application and connected to the spinner.</p>
|
This service is globally integrated into the application and connected to the<span class="widont"> </span>spinner.</p>
|
||||||
<p>You can register any promise in any part of the application so that the spinner will be
|
<p>You can register any promise in any part of the application so that the spinner will be
|
||||||
hidden only after your promise is completed (resolved).</p>
|
hidden only after your promise is completed<span class="widont"> </span>(resolved).</p>
|
||||||
<p>You can find an example of usage inside of the <code>app.component.ts</code> file.
|
<p>You can find an example of usage inside of the <code>app.component.ts</code> file.
|
||||||
Here we are registering a loader (<code>this._imageLoader.load</code> just returns a <code>Promise</code>) which loads a background image:</p>
|
Here we are registering a loader (<code>this._imageLoader.load</code> just returns a <code>Promise</code>) which loads a background<span class="widont"> </span>image:</p>
|
||||||
<pre><code class="lang-javascript"> BaThemePreloader.registerLoader(<span class="keyword">this</span>._imageLoader.load(layoutPaths.images.root + <span class="string">'blur-bg-mobile.jpg'</span>));
|
<pre><code class="lang-javascript"> BaThemePreloader.registerLoader(<span class="keyword">this</span>._imageLoader.load(layoutPaths.images.root + <span class="string">'blur-bg-mobile.jpg'</span>));
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Then we are starting all the registered promises and once they all are done - hiding the spinner.</p>
|
<p>Then we are starting all the registered promises and once they all are done - hiding the<span class="widont"> </span>spinner.</p>
|
||||||
<pre><code class="lang-javascript"> BaThemePreloader.load().then((values) => {
|
<pre><code class="lang-javascript"> BaThemePreloader.load().then((values) => {
|
||||||
<span class="keyword">this</span>._spinner.hide();
|
<span class="keyword">this</span>._spinner.hide();
|
||||||
});
|
});
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h2 id="example">Example</h2>
|
<h2 id="example">Example</h2>
|
||||||
<p>You also can register a loader on any page you want.
|
<p>You also can register a loader on any page you want.
|
||||||
Say you have a long-running task on the Charts page (you need to receive some data from a web service) and you want the spinner to be shown while the data is loading.</p>
|
Say you have a long-running task on the Charts page (you need to receive some data from a web service) and you want the spinner to be shown while the data is<span class="widont"> </span>loading.</p>
|
||||||
<p>First thing you need to do is to import BaThemePreloader service:</p>
|
<p>First thing you need to do is to import BaThemePreloader<span class="widont"> </span>service:</p>
|
||||||
<pre><code class="lang-javascript"> <span class="keyword">import</span> {BaThemePreloader} <span class="keyword">from</span> <span class="string">'../../../../theme/services'</span>;
|
<pre><code class="lang-javascript"> <span class="keyword">import</span> {BaThemePreloader} <span class="keyword">from</span> <span class="string">'../../../../theme/services'</span>;
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Then, say you have a method loading some data called <code>_loadData</code>, in our case we just mocked this method with <code>setTimeout</code> to emulate the loading process:</p>
|
<p>Then, say you have a method loading some data called <code>_loadData</code>, in our case we just mocked this method with <code>setTimeout</code> to emulate the loading<span class="widont"> </span>process:</p>
|
||||||
<pre><code class="lang-javascript"> private _loadData():<span class="built_in">Promise</span><any> {
|
<pre><code class="lang-javascript"> private _loadData():<span class="built_in">Promise</span><any> {
|
||||||
<span class="keyword">return</span> <span class="keyword">new</span> <span class="built_in">Promise</span>((resolve, reject) => {
|
<span class="keyword">return</span> <span class="keyword">new</span> <span class="built_in">Promise</span>((resolve, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -82,10 +82,10 @@ Say you have a long-running task on the Charts page (you need to receive some da
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Last thing you need to do is to register your loader:</p>
|
<p>Last thing you need to do is to register your<span class="widont"> </span>loader:</p>
|
||||||
<pre><code class="lang-javascript"> BaThemePreloader.registerLoader(<span class="keyword">this</span>._loadData());
|
<pre><code class="lang-javascript"> BaThemePreloader.registerLoader(<span class="keyword">this</span>._loadData());
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>That’s basically it! Once your data is loaded and all other registered loaders are completed - the spinner will be hidden.</p>
|
<p>That’s basically it! Once your data is loaded and all other registered loaders are completed - the spinner will be<span class="widont"> </span>hidden.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue