diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..fc7360c4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,40 @@ + +# 0.3.0 (2016-06-29) + +### Bug Fixes + +* Sidebar menu angle fixed +* Sidebar menu selected item fixed + +### Features + +* Angular updated to rc.3 +* Dependencies updated accordingly + +### How to update + +* Remove `node_modules` and `typings` folders +* run `npm install` + + +# 0.2.1 (2016-06-21) + + +### Bug Fixes + +* Multiple bugfixes + +### Features + +* Angular updated to rc.2 +* Dependencies updated accordingly +* Login page component [Demo](http://akveo.com/ng2-admin/#/login) +* Sign up page component [Demo](http://akveo.com/ng2-admin/#/register) + +### BREAKING CHANGES +* `$` renamed to `jQuery` because of name resolution conflicts + +### How to update + +* Remove `node_modules` and `typings` folders +* run `npm install` \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ba084f6d..eb90881c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,16 @@ FROM node:latest -COPY . /var/www -WORKDIR /var/www - -#Install rimraf globally, so root can perform delete operation -RUN npm install --global rimraf -RUN npm run clean - -#install bower and dependcies with --allow-root flag -RUN npm install --global bower -RUN bower install --allow-root - -#install right version of typings -RUN npm install --global typings@0.8.1 -RUN npm run typings -- install - -#install all -RUN npm install --global webpack webpack-dev-server typescript -RUN npm install - -#build -RUN npm run prebuild:prod -RUN npm run build:prod +RUN git clone https://github.com/akveo/ng2-admin.git /var/www \ + && cd /var/www \ + && npm install --global rimraf \ + && npm run clean \ + && npm install --global bower typings webpack webpack-dev-server typescript \ + && bower install --allow-root \ + && npm run typings -- install \ + && npm install \ + && npm run prebuild:prod && npm run build:prod EXPOSE 8080 +WORKDIR /var/www ENTRYPOINT ["npm", "run", "server:prod"] - -#to build image - docker quick terminal, navigate to folder, docker build -t [your docker hub account]/ng2-admin . -#to run docker run -p 8080:8080 [your docker hub account]/ng2-admin -#or you can simply pull from my registry - docker pull dimkk/ng2-admin, docker run -p8080:8080 dimkk/ng2-admin -#now you can navigate to docker-machine (assuming you are on windows or osx) in browser - 192.168.99.100:8080 \ No newline at end of file diff --git a/_VERSION b/_VERSION new file mode 100644 index 00000000..a673804b --- /dev/null +++ b/_VERSION @@ -0,0 +1 @@ +_VERSION=0.3.0 diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..48d814e4 --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +_tag=$1 + +if [ -z "${_tag}" ]; then + source _VERSION + _tag=${_VERSION} +fi + +docker build --tag "ng2-admin:${_tag}" --no-cache=true . diff --git a/config/webpack.common.js b/config/webpack.common.js index 34c2d39a..979d8d2b 100644 --- a/config/webpack.common.js +++ b/config/webpack.common.js @@ -87,7 +87,9 @@ module.exports = { loader: 'source-map-loader', exclude: [ // these packages have problems with their sourcemaps - helpers.root('node_modules/rxjs') + helpers.root('node_modules/rxjs'), + helpers.root('node_modules/ng2-bootstrap'), + helpers.root('node_modules/ng2-branchy') ] } diff --git a/config/webpack.dev.js b/config/webpack.dev.js index e5a8b1c5..1c553394 100644 --- a/config/webpack.dev.js +++ b/config/webpack.dev.js @@ -80,7 +80,7 @@ module.exports = webpackMerge(commonConfig, { * * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename */ - sourceMapFilename: '[name].map', + sourceMapFilename: '[file].map', /** The filename of non-entry chunks as relative path * inside the output.path directory. diff --git a/config/webpack.prod.js b/config/webpack.prod.js index 3c5d8c3d..9a113851 100644 --- a/config/webpack.prod.js +++ b/config/webpack.prod.js @@ -72,7 +72,7 @@ module.exports = webpackMerge(commonConfig, { * * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename */ - sourceMapFilename: '[name].[chunkhash].bundle.map', + sourceMapFilename: '[file].map', /** * The filename of non-entry chunks as relative path @@ -154,10 +154,7 @@ module.exports = webpackMerge(commonConfig, { beautify: false, //prod - mangle: { - screw_ie8 : true, - keep_fnames: true - }, //prod + mangle: false, //prod compress: { screw_ie8: true diff --git a/package.json b/package.json index dd91fe7c..9da4336d 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,20 @@ { "name": "ng2-admin", - "version": "0.0.1", + "version": "0.3.0", "description": "Angular 2 and Bootstrap 4 Admin Template.", "author": "akveo", "homepage": "http://akveo.github.io/ng2-admin/", "license": "MIT", "dependencies": { - "@angular/common": "2.0.0-rc.1", - "@angular/compiler": "2.0.0-rc.1", - "@angular/core": "2.0.0-rc.1", - "@angular/http": "2.0.0-rc.1", - "@angular/platform-browser": "2.0.0-rc.1", - "@angular/platform-browser-dynamic": "2.0.0-rc.1", - "@angular/platform-server": "2.0.0-rc.1", - "@angular/router": "2.0.0-rc.1", - "@angular/router-deprecated": "2.0.0-rc.1", + "@angular/common": "2.0.0-rc.4", + "@angular/compiler": "2.0.0-rc.4", + "@angular/core": "2.0.0-rc.4", + "@angular/http": "2.0.0-rc.4", + "@angular/platform-browser": "2.0.0-rc.4", + "@angular/platform-browser-dynamic": "2.0.0-rc.4", + "@angular/platform-server": "2.0.0-rc.4", + "@angular/router": "3.0.0-beta.2", + "@angular/forms":"0.2.0", "amcharts3": "github:amcharts/amcharts3", "ammap3": "github:amcharts/ammap3", "animate.css": "^3.5.1", @@ -22,7 +22,8 @@ "bootstrap-loader": "^1.0.8", "chart.js": "^1.1.1", "chartist": "^0.9.7", - "core-js": "^2.2.2", + "ckeditor": "^4.5.9", + "core-js": "^2.4.0", "easy-pie-chart": "^2.1.7", "extract-text-webpack-plugin": "^1.0.1", "font-awesome": "^4.6.1", @@ -34,18 +35,21 @@ "leaflet": "^0.7.7", "leaflet-map": "^0.2.1", "lodash": "^4.12.0", - "ng2-bootstrap": "^1.0.16", + "ng2-bootstrap": "^1.0.20", + "ng2-ckeditor": "^1.0.4", + "ng2-branchy": "^0.0.2-5", + "ng2-uploader": "^0.5.2", "normalize.css": "^4.1.1", "rxjs": "5.0.0-beta.6", "tether": "^1.2.4", "zone.js": "~0.6.12" }, "devDependencies": { - "angular2-hmr": "~0.6.0", - "awesome-typescript-loader": "~0.17.0", + "angular2-hmr": "~0.7.0", + "awesome-typescript-loader": "1.1.1", "codelyzer": "~0.0.19", "compression-webpack-plugin": "^0.3.1", - "copy-webpack-plugin": "^2.1.3", + "copy-webpack-plugin": "^3.0.1", "css-loader": "^0.23.1", "es6-promise": "^3.1.2", "es6-promise-loader": "^1.0.1", @@ -68,17 +72,17 @@ "source-map-loader": "^0.1.5", "style-loader": "^0.13.1", "ts-helpers": "1.1.1", - "ts-node": "^0.7.1", + "ts-node": "^0.9.0", "tslint": "^3.7.1", "tslint-loader": "^2.1.3", - "typedoc": "^0.3.12", + "typedoc": "^0.4.4", "typescript": "~1.8.9", - "typings": "^0.8.1", + "typings": "^1.0.5", "url-loader": "^0.5.7", - "webpack": "^1.12.14", + "webpack": "^1.13.1", "webpack-dev-server": "^1.14.1", "webpack-md5-hash": "^0.0.5", - "webpack-merge": "^0.12.0" + "webpack-merge": "^0.14.0" }, "scripts": { "rimraf": "rimraf", diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 22271f7d..8a074e89 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,15 +1,10 @@ import './app.loader.ts'; - -import {Component, ViewEncapsulation} from '@angular/core'; -import {RouteConfig} from '@angular/router-deprecated'; - -import {Pages} from './pages'; -import {AppState} from './app.state'; -import {BaThemeConfigProvider, BaThemeConfig} from './theme'; -import {BaThemeRun} from './theme/directives'; -import {BaImageLoaderService, BaThemePreloader, BaThemeSpinner} from './theme/services'; - -import {layoutPaths} from './theme/theme.constants'; +import {Component, ViewEncapsulation} from "@angular/core"; +import {AppState} from "./app.state"; +import {BaThemeConfigProvider, BaThemeConfig} from "./theme"; +import {BaThemeRun} from "./theme/directives"; +import {BaImageLoaderService, BaThemePreloader, BaThemeSpinner} from "./theme/services"; +import {layoutPaths} from "./theme/theme.constants"; /* * App Component @@ -29,21 +24,6 @@ import {layoutPaths} from './theme/theme.constants'; ` }) -@RouteConfig([ - { - path: '/pages/...', - name: 'Pages', - component: Pages, - useAsDefault: true - }, - // handle any non-registered route - // and simply redirects back to dashboard page - // you can specify any customer 404 page while it's not built in ito ng2-admin - { - path: '/**', - redirectTo: ['Pages'] - } -]) export class App { isMenuCollapsed:boolean = false; diff --git a/src/app/app.menu.ts b/src/app/app.menu.ts deleted file mode 100644 index 7749e602..00000000 --- a/src/app/app.menu.ts +++ /dev/null @@ -1,144 +0,0 @@ -export const menuItems = [ - { - title: 'Dashboard', - component: 'Dashboard', - icon: 'ion-android-home', - selected: false, - expanded: false, - order: 0 - }, - { - title: 'Charts', - component: 'Charts', - icon: 'ion-stats-bars', - selected: false, - expanded: false, - order: 200, - subMenu: [ - { - title: 'Chartist.Js', - component: 'ChartistJs', - }, - ] - }, - { - title: 'UI Features', - component: 'Ui', - icon: 'ion-android-laptop', - selected: false, - expanded: false, - order: 300, - subMenu: [ - { - title: 'Typography', - component: 'Typography', - }, - { - title: 'Buttons', - component: 'Buttons', - }, - { - title: 'Icons', - component: 'Icons', - }, - { - title: 'Grid', - component: 'Grid', - }, - ] - }, - { - title: 'Form Elements', - component: 'Forms', - icon: 'ion-compose', - selected: false, - expanded: false, - order: 400, - subMenu: [ - { - title: 'Form Inputs', - component: 'Inputs', - }, - { - title: 'Form Layouts', - component: 'Layouts', - }, - ] - }, - { - title: 'Tables', - component: 'Tables', - icon: 'ion-grid', - selected: false, - expanded: false, - order: 500, - subMenu: [ - { - title: 'Basic Tables', - component: 'BasicTables', - } - ] - }, - { - title: 'Maps', - component: 'Maps', - icon: 'ion-ios-location-outline', - selected: false, - expanded: false, - order: 600, - subMenu: [ - { - title: 'Google Maps', - component: 'GoogleMaps', - }, - { - title: 'Leaflet Maps', - component: 'LeafletMaps', - }, - { - title: 'Bubble Maps', - component: 'BubbleMaps', - }, - { - title: 'Line Maps', - component: 'LineMaps', - } - ] - }, - { - title: 'Menu Level 1', - icon: 'ion-ios-more', - selected: false, - expanded: false, - order: 700, - subMenu: [ - { - title: 'Menu Level 1.1', - url: '#', - disabled: true, - selected: false, - expanded: false - }, - { - title: 'Menu Level 1.2', - url: '#', - subMenu: [{ - title: 'Menu Level 1.2.1', - url: '#', - disabled: true, - selected: false, - expanded: false - }] - } - ] - }, - { - title: 'External Link', - url: 'http://akveo.com', - icon: 'ion-android-exit', - selected: false, - expanded: false, - order: 800, - target: '_blank' - } -]; diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts new file mode 100644 index 00000000..af54c8e4 --- /dev/null +++ b/src/app/app.routes.ts @@ -0,0 +1,18 @@ +import {provideRouter, RouterConfig} from '@angular/router'; +import {LoginRoutes} from "./pages/login/login.routes"; +import {PagesRoutes} from "./pages/pages.routes"; +import {RegisterRoutes} from "./pages/register/register.routes"; + +export const routes:RouterConfig = [ + ...LoginRoutes, + ...RegisterRoutes, + ...PagesRoutes, + { + path: '**', + redirectTo: '/pages/dashboard' + }, +]; + +export const APP_ROUTER_PROVIDERS = [ + provideRouter(routes) +]; diff --git a/src/app/pages/charts/charts.component.ts b/src/app/pages/charts/charts.component.ts index 62cf1879..366a277c 100644 --- a/src/app/pages/charts/charts.component.ts +++ b/src/app/pages/charts/charts.component.ts @@ -1,8 +1,6 @@ -import {Component} from '@angular/core'; -import {RouteConfig} from '@angular/router-deprecated'; +import {Component} from "@angular/core"; // import {ChartJs} from "./components/chartJs"; -import {ChartistJs} from "./components/chartistJs/chartistJs.component"; @Component({ selector: 'maps', @@ -11,19 +9,6 @@ import {ChartistJs} from "./components/chartistJs/chartistJs.component"; styles: [], template: `` }) -@RouteConfig([ - { - name: 'ChartistJs', - component: ChartistJs, - path: '/chartist-js', - useAsDefault: true, - }, - // { - // name: 'ChartJs', - // component: ChartJs, - // path: '/chart-js', - // }, -]) export class Charts { constructor() { diff --git a/src/app/pages/components/components.component.ts b/src/app/pages/components/components.component.ts new file mode 100644 index 00000000..41891ad5 --- /dev/null +++ b/src/app/pages/components/components.component.ts @@ -0,0 +1,15 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'components', + pipes: [], + providers: [], + styles: [], + template: `` +}) +export class Components { + + constructor() { + } + +} diff --git a/src/app/pages/components/components.scss b/src/app/pages/components/components.scss new file mode 100644 index 00000000..1999f610 --- /dev/null +++ b/src/app/pages/components/components.scss @@ -0,0 +1 @@ +@import '../../theme/sass/treeView'; diff --git a/src/app/pages/components/components/treeView/index.ts b/src/app/pages/components/components/treeView/index.ts new file mode 100644 index 00000000..15f949fe --- /dev/null +++ b/src/app/pages/components/components/treeView/index.ts @@ -0,0 +1 @@ +export * from './treeView.component'; diff --git a/src/app/pages/components/components/treeView/treeView.component.ts b/src/app/pages/components/components/treeView/treeView.component.ts new file mode 100644 index 00000000..ccded400 --- /dev/null +++ b/src/app/pages/components/components/treeView/treeView.component.ts @@ -0,0 +1,37 @@ +import {Component} from '@angular/core'; +import {BranchyComponent, TreeModel} from 'ng2-branchy'; +import {BaCard} from '../../../../theme/components/baCard'; + +@Component({ + selector: 'tree-view', + directives: [BranchyComponent, BaCard], + template: require('./treeView.html'), +}) + +export class TreeView { + + constructor() { + } + private tree: TreeModel = { + value: 'Programming languages by programming paradigm', + children: [ + { + value: 'Object-oriented programming', + children: [ + {value: 'Java'}, + {value: 'C++'}, + {value: 'C#'}, + ] + }, + { + value: 'Prototype-based programming', + children: [ + {value: 'JavaScript'}, + {value: 'CoffeeScript'}, + {value: 'Lua'}, + ] + } + ] + }; + +} diff --git a/src/app/pages/components/components/treeView/treeView.html b/src/app/pages/components/components/treeView/treeView.html new file mode 100644 index 00000000..df018c41 --- /dev/null +++ b/src/app/pages/components/components/treeView/treeView.html @@ -0,0 +1,5 @@ +
+ + + +
diff --git a/src/app/pages/components/index.ts b/src/app/pages/components/index.ts new file mode 100644 index 00000000..86211eac --- /dev/null +++ b/src/app/pages/components/index.ts @@ -0,0 +1 @@ +export * from './components.component'; diff --git a/src/app/pages/dashboard/calendar/calendar.component.ts b/src/app/pages/dashboard/calendar/calendar.component.ts index ac0d9a1f..2ea9dca5 100644 --- a/src/app/pages/dashboard/calendar/calendar.component.ts +++ b/src/app/pages/dashboard/calendar/calendar.component.ts @@ -1,7 +1,7 @@ import {Component, ViewEncapsulation} from '@angular/core'; import {BaFullCalendar} from '../../../theme/components'; -import {CalendarService} from "./calendar.service"; +import {CalendarService} from './calendar.service'; @Component({ selector: 'calendar', @@ -36,9 +36,9 @@ export class Calendar { start: start, end: end }; - $(this._calendar).fullCalendar('renderEvent', eventData, true); + jQuery(this._calendar).fullCalendar('renderEvent', eventData, true); } - $(this._calendar).fullCalendar('unselect'); + jQuery(this._calendar).fullCalendar('unselect'); } } } diff --git a/src/app/pages/dashboard/pieChart/pieChart.component.ts b/src/app/pages/dashboard/pieChart/pieChart.component.ts index 4aa9d829..c2bd29d9 100644 --- a/src/app/pages/dashboard/pieChart/pieChart.component.ts +++ b/src/app/pages/dashboard/pieChart/pieChart.component.ts @@ -33,14 +33,14 @@ export class PieChart { private _loadPieCharts() { - $('.chart').each(function () { - let chart = $(this); + jQuery('.chart').each(function () { + let chart = jQuery(this); chart.easyPieChart({ easing: 'easeOutBounce', onStep: function (from, to, percent) { - $(this.el).find('.percent').text(Math.round(percent)); + jQuery(this.el).find('.percent').text(Math.round(percent)); }, - barColor: $(this).attr('data-rel'), + barColor: jQuery(this).attr('data-rel'), trackColor: 'rgba(0,0,0,0)', size: 84, scaleLength: 0, @@ -54,8 +54,8 @@ export class PieChart { private _updatePieCharts() { let getRandomArbitrary = (min, max) => { return Math.random() * (max - min) + min }; - $('.pie-charts .chart').each(function(index, chart) { - $(chart).data('easyPieChart').update(getRandomArbitrary(55, 90)); + jQuery('.pie-charts .chart').each(function(index, chart) { + jQuery(chart).data('easyPieChart').update(getRandomArbitrary(55, 90)); }); } } diff --git a/src/app/pages/dashboard/trafficChart/trafficChart.component.ts b/src/app/pages/dashboard/trafficChart/trafficChart.component.ts index cdbca10a..4702b733 100644 --- a/src/app/pages/dashboard/trafficChart/trafficChart.component.ts +++ b/src/app/pages/dashboard/trafficChart/trafficChart.component.ts @@ -25,7 +25,7 @@ export class TrafficChart { } private _loadDoughnutCharts() { - let el = $('.chart-area').get(0); + let el = jQuery('.chart-area').get(0); new Chart(el.getContext('2d')).Doughnut(this.doughnutData, { segmentShowStroke: false, percentageInnerCutout : 64, diff --git a/src/app/pages/editors/components/ckeditor/ckeditor.component.ts b/src/app/pages/editors/components/ckeditor/ckeditor.component.ts new file mode 100644 index 00000000..94c7a6b2 --- /dev/null +++ b/src/app/pages/editors/components/ckeditor/ckeditor.component.ts @@ -0,0 +1,22 @@ +import {Component} from '@angular/core'; +import {CKEditor} from 'ng2-ckeditor'; +import {BaCard} from '../../../../theme/components/baCard'; + +import './ckeditor.loader.ts'; + +@Component({ + selector: 'ckeditor', + directives: [CKEditor, BaCard], + template: require('./ckeditor.html') +}) + +export class Ckeditor { + public ckeditorContent:string = '

Hello CKEditor

'; + public config = { + uiColor: '#F0F3F4', + height: '600' + }; + + constructor() { + } +} diff --git a/src/app/pages/editors/components/ckeditor/ckeditor.html b/src/app/pages/editors/components/ckeditor/ckeditor.html new file mode 100644 index 00000000..f589a987 --- /dev/null +++ b/src/app/pages/editors/components/ckeditor/ckeditor.html @@ -0,0 +1,7 @@ +
+
+ + + +
+
diff --git a/src/app/pages/editors/components/ckeditor/ckeditor.loader.ts b/src/app/pages/editors/components/ckeditor/ckeditor.loader.ts new file mode 100644 index 00000000..56804502 --- /dev/null +++ b/src/app/pages/editors/components/ckeditor/ckeditor.loader.ts @@ -0,0 +1,2 @@ +window['CKEDITOR_BASEPATH'] = '//cdn.ckeditor.com/4.5.9/standard/'; +require('ckeditor'); diff --git a/src/app/pages/editors/components/ckeditor/index.ts b/src/app/pages/editors/components/ckeditor/index.ts new file mode 100644 index 00000000..464d6812 --- /dev/null +++ b/src/app/pages/editors/components/ckeditor/index.ts @@ -0,0 +1 @@ +export * from './ckeditor.component'; diff --git a/src/app/pages/editors/editors.component.ts b/src/app/pages/editors/editors.component.ts new file mode 100644 index 00000000..53eeb282 --- /dev/null +++ b/src/app/pages/editors/editors.component.ts @@ -0,0 +1,10 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'editors', + template: `` +}) +export class Editors { + constructor() { + } +} diff --git a/src/app/pages/editors/index.ts b/src/app/pages/editors/index.ts new file mode 100644 index 00000000..842e3fc2 --- /dev/null +++ b/src/app/pages/editors/index.ts @@ -0,0 +1 @@ +export * from './editors.component'; diff --git a/src/app/pages/forms/components/inputs/components/ratinginputs/index.ts b/src/app/pages/forms/components/inputs/components/ratinginputs/index.ts new file mode 100644 index 00000000..9a62ed6f --- /dev/null +++ b/src/app/pages/forms/components/inputs/components/ratinginputs/index.ts @@ -0,0 +1 @@ +export * from './ratinginputs.component'; diff --git a/src/app/pages/forms/components/inputs/components/ratinginputs/ratinginputs.component.ts b/src/app/pages/forms/components/inputs/components/ratinginputs/ratinginputs.component.ts new file mode 100644 index 00000000..0e4b2e2d --- /dev/null +++ b/src/app/pages/forms/components/inputs/components/ratinginputs/ratinginputs.component.ts @@ -0,0 +1,20 @@ +import { RatingComponent } from 'ng2-bootstrap/ng2-bootstrap'; +import { Component } from '@angular/core'; + +@Component({ + selector: 'rating-inputs', + directives: [RatingComponent], + template: require('./ratinginputs.html') +}) + +export class Rating { + private _rate1:number = 3; + private _rate2:number = 4; + + private _max1:number = 5; + private _max2:number = 10; + + constructor() { + } + +} diff --git a/src/app/pages/forms/components/inputs/components/ratinginputs/ratinginputs.html b/src/app/pages/forms/components/inputs/components/ratinginputs/ratinginputs.html new file mode 100644 index 00000000..d8b7cf5a --- /dev/null +++ b/src/app/pages/forms/components/inputs/components/ratinginputs/ratinginputs.html @@ -0,0 +1,9 @@ +
+ + Rate: {{_rate1}} +
+ +
+ + Rate: {{_rate2}} +
diff --git a/src/app/pages/forms/components/inputs/inputs.component.ts b/src/app/pages/forms/components/inputs/inputs.component.ts index 34f59dbe..e2914188 100644 --- a/src/app/pages/forms/components/inputs/inputs.component.ts +++ b/src/app/pages/forms/components/inputs/inputs.component.ts @@ -6,11 +6,13 @@ import {StandardInputs} from './components/standardInputs'; import {ValidationInputs} from './components/validationInputs'; import {GroupInputs} from './components/groupInputs'; import {CheckboxInputs} from './components/checkboxInputs'; +import {Rating} from './components/ratinginputs'; + @Component({ selector: 'inputs', encapsulation: ViewEncapsulation.None, - directives: [BaCard, StandardInputs, ValidationInputs, GroupInputs, CheckboxInputs], + directives: [BaCard, StandardInputs, ValidationInputs, GroupInputs, CheckboxInputs, Rating], template: require('./inputs.html'), }) export class Inputs { diff --git a/src/app/pages/forms/components/inputs/inputs.html b/src/app/pages/forms/components/inputs/inputs.html index d9db5970..96155321 100644 --- a/src/app/pages/forms/components/inputs/inputs.html +++ b/src/app/pages/forms/components/inputs/inputs.html @@ -19,6 +19,10 @@ + + + + diff --git a/src/app/pages/forms/components/layouts/layouts.component.ts b/src/app/pages/forms/components/layouts/layouts.component.ts index fb5565f8..ec134a8b 100644 --- a/src/app/pages/forms/components/layouts/layouts.component.ts +++ b/src/app/pages/forms/components/layouts/layouts.component.ts @@ -7,16 +7,25 @@ import {BlockForm} from './components/blockForm'; import {HorizontalForm} from './components/horizontalForm'; import {BasicForm} from './components/basicForm'; import {WithoutLabelsForm} from './components/withoutLabelsForm'; +import {BaPictureUploader} from '../../../../theme/components'; @Component({ selector: 'layouts', encapsulation: ViewEncapsulation.None, - directives: [BaCard, InlineForm, BlockForm, HorizontalForm, BasicForm, WithoutLabelsForm], + directives: [BaCard, InlineForm, BlockForm, HorizontalForm, BasicForm, WithoutLabelsForm, BaPictureUploader], styles: [], template: require('./layouts.html'), }) export class Layouts { + public defaultPicture = 'assets/img/theme/no-photo.png'; + public profile:any = { + picture: 'assets/img/app/profile/Nasta.png' + }; + public uploaderOptions:any = { + // url: 'http://website.com/upload' + }; + constructor() { } diff --git a/src/app/pages/forms/components/layouts/layouts.html b/src/app/pages/forms/components/layouts/layouts.html index 5ba46e97..c3fb5eda 100644 --- a/src/app/pages/forms/components/layouts/layouts.html +++ b/src/app/pages/forms/components/layouts/layouts.html @@ -35,4 +35,11 @@ +
+
+ + + +
+
diff --git a/src/app/pages/forms/forms.component.ts b/src/app/pages/forms/forms.component.ts index 05bde0bf..763390c1 100644 --- a/src/app/pages/forms/forms.component.ts +++ b/src/app/pages/forms/forms.component.ts @@ -1,8 +1,4 @@ import {Component} from '@angular/core'; -import {RouteConfig} from '@angular/router-deprecated'; - -import {Inputs} from './components/inputs'; -import {Layouts} from './components/layouts'; @Component({ selector: 'forms', @@ -11,19 +7,6 @@ import {Layouts} from './components/layouts'; styles: [], template: `` }) -@RouteConfig([ - { - name: 'Inputs', - component: Inputs, - path: '/inputs', - useAsDefault: true - }, - { - name: 'Layouts', - component: Layouts, - path: '/layouts', - } -]) export class Forms { constructor() { diff --git a/src/app/pages/login/index.ts b/src/app/pages/login/index.ts new file mode 100644 index 00000000..69c16441 --- /dev/null +++ b/src/app/pages/login/index.ts @@ -0,0 +1 @@ +export * from './login.component'; diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts new file mode 100644 index 00000000..b02adda0 --- /dev/null +++ b/src/app/pages/login/login.component.ts @@ -0,0 +1,35 @@ +import {Component, ViewEncapsulation} from '@angular/core'; +import {FormGroup, AbstractControl, FormBuilder, Validators} from '@angular/forms'; + +@Component({ + selector: 'login', + encapsulation: ViewEncapsulation.None, + directives: [], + styles: [require('./login.scss')], + template: require('./login.html'), +}) +export class Login { + + public form:FormGroup; + public email:AbstractControl; + public password:AbstractControl; + public submitted:boolean = false; + + constructor(fb:FormBuilder) { + this.form = fb.group({ + 'email': ['', Validators.compose([Validators.required, Validators.minLength(4)])], + 'password': ['', Validators.compose([Validators.required, Validators.minLength(4)])] + }); + + this.email = this.form.controls['email']; + this.password = this.form.controls['password']; + } + + public onSubmit(values:Object):void { + this.submitted = true; + if (this.form.valid) { + // your code goes here + // console.log(values); + } + } +} diff --git a/src/app/pages/login/login.html b/src/app/pages/login/login.html new file mode 100644 index 00000000..9ca1ef9f --- /dev/null +++ b/src/app/pages/login/login.html @@ -0,0 +1,39 @@ +
+
+

Sign in to ng2-admin

+ New to ng2-admin? Sign up! + +
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+
+ + Forgot password? +
+
+
+ +
or Sign in with one click
+ + +
+
diff --git a/src/app/pages/login/login.routes.ts b/src/app/pages/login/login.routes.ts new file mode 100644 index 00000000..2bf1df36 --- /dev/null +++ b/src/app/pages/login/login.routes.ts @@ -0,0 +1,10 @@ +import {RouterConfig} from '@angular/router'; +import {Login} from './login.component'; + +//noinspection TypeScriptValidateTypes +export const LoginRoutes: RouterConfig = [ + { + path: 'login', + component: Login + } +]; diff --git a/src/app/pages/login/login.scss b/src/app/pages/login/login.scss new file mode 100644 index 00000000..cb03e3ee --- /dev/null +++ b/src/app/pages/login/login.scss @@ -0,0 +1 @@ +@import '../../theme/sass/auth'; diff --git a/src/app/pages/maps/maps.component.ts b/src/app/pages/maps/maps.component.ts index cc890fd8..072cb4e7 100644 --- a/src/app/pages/maps/maps.component.ts +++ b/src/app/pages/maps/maps.component.ts @@ -1,10 +1,4 @@ -import {Component, ViewEncapsulation} from '@angular/core'; -import {RouteConfig} from '@angular/router-deprecated'; - -import {GoogleMaps} from './components/googleMaps'; -import {LeafletMaps} from "./components/leafletMaps"; -import {BubbleMaps} from "./components/bubbleMaps"; -import {LineMaps} from "./components/lineMaps"; +import {Component} from '@angular/core'; @Component({ selector: 'maps', @@ -13,29 +7,6 @@ import {LineMaps} from "./components/lineMaps"; styles: [], template: `` }) -@RouteConfig([ - { - name: 'GoogleMaps', - component: GoogleMaps, - path: '/google-maps', - useAsDefault: true - }, - { - name: 'LeafletMaps', - component: LeafletMaps, - path: '/leaflet-maps', - }, - { - name: 'BubbleMaps', - component: BubbleMaps, - path: '/bubble-maps', - }, - { - name: 'LineMaps', - component: LineMaps, - path: '/line-maps', - }, -]) export class Maps { constructor() { diff --git a/src/app/pages/pages.component.ts b/src/app/pages/pages.component.ts index 67711628..3f2a77c4 100644 --- a/src/app/pages/pages.component.ts +++ b/src/app/pages/pages.component.ts @@ -1,15 +1,6 @@ import {Component, ViewEncapsulation} from '@angular/core'; -import {RouteConfig} from '@angular/router-deprecated'; - import {BaPageTop, BaContentTop, BaSidebar, BaBackTop} from '../theme/components'; -import {Dashboard} from './dashboard'; -import {Ui} from './ui'; -import {Maps} from './maps'; -import {Charts} from './charts'; -import {Forms} from './forms'; -import {Tables} from './tables'; - @Component({ selector: 'pages', encapsulation: ViewEncapsulation.None, @@ -39,39 +30,6 @@ import {Tables} from './tables'; ` }) -@RouteConfig([ - { - name: 'Dashboard', - component: Dashboard, - path: '/dashboard', - useAsDefault: true, - }, - { - name: 'Ui', - component: Ui, - path: '/ui/...', - }, - { - name: 'Maps', - component: Maps, - path: '/maps/...', - }, - { - name: 'Charts', - component: Charts, - path: '/charts/...', - }, - { - name: 'Forms', - component: Forms, - path: '/forms/...', - }, - { - name: 'Tables', - component: Tables, - path: '/tables/...', - } -]) export class Pages { constructor() { diff --git a/src/app/pages/pages.routes.ts b/src/app/pages/pages.routes.ts new file mode 100644 index 00000000..36ffe8da --- /dev/null +++ b/src/app/pages/pages.routes.ts @@ -0,0 +1,333 @@ +import {RouterConfig} from '@angular/router'; +import {Dashboard} from './dashboard/dashboard.component'; +import {Charts} from './charts/charts.component'; +import {ChartistJs} from './charts/components/chartistJs/chartistJs.component'; +import {Pages} from './pages.component'; +import {Ui} from './ui/ui.component'; +import {Typography} from './ui/components/typography/typography.component'; +import {Buttons} from './ui/components/buttons/buttons.component'; +import {Icons} from './ui/components/incons/icons.component'; +import {Grid} from './ui/components/grid/grid.component'; +import {Forms} from './forms/forms.component'; +import {Inputs} from './forms/components/inputs/inputs.component'; +import {Layouts} from './forms/components/layouts/layouts.component'; +import {BasicTables} from './tables/components/basicTables/basicTables.component'; +import {Tables} from './tables/tables.component'; +import {Maps} from './maps/maps.component'; +import {GoogleMaps} from './maps/components/googleMaps/googleMaps.component'; +import {LeafletMaps} from './maps/components/leafletMaps/leafletMaps.component'; +import {BubbleMaps} from './maps/components/bubbleMaps/bubbleMaps.component'; +import {LineMaps} from './maps/components/lineMaps/lineMaps.component'; +import {Editors} from './editors/editors.component'; +import {Ckeditor} from './editors/components/ckeditor/ckeditor.component'; +import {Components} from './components/components.component'; +import {TreeView} from './components/components/treeView/treeView.component'; + +//noinspection TypeScriptValidateTypes +export const PagesRoutes:RouterConfig = [ + { + path: 'pages', + component: Pages, + children: [ + { + path: 'dashboard', + component: Dashboard, + data: { + menu: { + title: 'Dashboard', + icon: 'ion-android-home', + selected: false, + expanded: false, + order: 0 + } + } + }, + { + path: 'editors', + component: Editors, + data: { + menu: { + title: 'Editors', + icon: 'ion-edit', + selected: false, + expanded: false, + order: 100, + } + }, + children: [ + { + path: 'ckeditor', + component: Ckeditor, + data: { + menu: { + title: 'CKEditor', + } + } + } + ] + }, + { + path: 'components', + component: Components, + data: { + menu: { + title: 'Components', + icon: 'ion-gear-a', + selected: false, + expanded: false, + order: 250, + } + }, + children: [ + { + path: 'treeview', + component: TreeView, + data: { + menu: { + title: 'Tree View', + } + } + } + ] + }, + { + path: 'charts', + component: Charts, + data: { + menu: { + title: 'Charts', + icon: 'ion-stats-bars', + selected: false, + expanded: false, + order: 200, + } + }, + children: [ + { + path: 'chartist-js', + component: ChartistJs, + data: { + menu: { + title: 'Chartist.Js', + } + } + } + ] + }, + { + path: 'ui', + component: Ui, + data: { + menu: { + title: 'UI Features', + icon: 'ion-android-laptop', + selected: false, + expanded: false, + order: 300, + } + }, + children: [ + { + path: 'typography', + component: Typography, + data: { + menu: { + title: 'Typography', + } + } + }, + { + path: 'buttons', + component: Buttons, + data: { + menu: { + title: 'Buttons', + } + } + }, + { + path: 'icons', + component: Icons, + data: { + menu: { + title: 'Icons', + } + } + }, + { + path: 'grid', + component: Grid, + data: { + menu: { + title: 'Grid', + } + } + }, + ] + }, + { + path: 'forms', + component: Forms, + data: { + menu: { + title: 'Form Elements', + icon: 'ion-compose', + selected: false, + expanded: false, + order: 400, + } + }, + children: [ + { + path: 'inputs', + component: Inputs, + data: { + menu: { + title: 'Form Inputs', + } + } + }, + { + path: 'layouts', + component: Layouts, + data: { + menu: { + title: 'Form Layouts', + } + } + } + ] + }, + { + path: 'tables', + component: Tables, + data: { + menu: { + title: 'Tables', + icon: 'ion-grid', + selected: false, + expanded: false, + order: 500, + } + }, + children: [ + { + path: 'basictables', + component: BasicTables, + data: { + menu: { + title: 'Basic Tables', + } + } + } + ] + }, + { + path: 'maps', + component: Maps, + data: { + menu: { + title: 'Maps', + icon: 'ion-ios-location-outline', + selected: false, + expanded: false, + order: 600, + } + }, + children: [ + { + path: 'googlemaps', + component: GoogleMaps, + data: { + menu: { + title: 'Google Maps', + } + } + }, + { + path: 'leafletmaps', + component: LeafletMaps, + data: { + menu: { + title: 'Leaflet Maps', + } + } + }, + { + path: 'bubblemaps', + component: BubbleMaps, + data: { + menu: { + title: 'Bubble Maps', + } + } + }, + { + path: 'linemaps', + component: LineMaps, + data: { + menu: { + title: 'Line Maps', + } + } + } + ] + }, + { + path: '', + data: { + menu: { + title: 'Menu Level 1', + icon: 'ion-ios-more', + selected: false, + expanded: false, + order: 700, + } + }, + children: [ + { + path: '', + data: { + menu: { + title: 'Menu Level 1.1', + url: '#' + } + } + }, + { + path: '', + data: { + menu: { + title: 'Menu Level 1.2', + url: '#' + } + }, + children: [ + { + path: '', + data: { + menu: { + title: 'Menu Level 1.2.1', + url: '#' + } + } + } + ] + } + ] + }, + { + path: '', + data: { + menu: { + title: 'External Link', + url: 'http://akveo.com', + icon: 'ion-android-exit', + order: 800, + target: '_blank' + } + } + } + ] + } +]; diff --git a/src/app/pages/register/index.ts b/src/app/pages/register/index.ts new file mode 100644 index 00000000..55388b6e --- /dev/null +++ b/src/app/pages/register/index.ts @@ -0,0 +1 @@ +export * from './register.component'; diff --git a/src/app/pages/register/register.component.ts b/src/app/pages/register/register.component.ts new file mode 100644 index 00000000..9af4e225 --- /dev/null +++ b/src/app/pages/register/register.component.ts @@ -0,0 +1,48 @@ +import {Component, ViewEncapsulation} from '@angular/core'; +import {FormGroup, AbstractControl, FormBuilder, Validators} from '@angular/forms'; +import {EmailValidator, EqualPasswordsValidator} from '../../theme/validators'; + +@Component({ + selector: 'register', + encapsulation: ViewEncapsulation.None, + directives: [], + styles: [require('./register.scss')], + template: require('./register.html'), +}) +export class Register { + + public form:FormGroup; + public name:AbstractControl; + public email:AbstractControl; + public password:AbstractControl; + public repeatPassword:AbstractControl; + public passwords:FormGroup; + + public submitted:boolean = false; + + constructor(fb:FormBuilder) { + + this.form = fb.group({ + 'name': ['', Validators.compose([Validators.required, Validators.minLength(4)])], + 'email': ['', Validators.compose([Validators.required, EmailValidator.validate])], + 'passwords': fb.group({ + 'password': ['', Validators.compose([Validators.required, Validators.minLength(4)])], + 'repeatPassword': ['', Validators.compose([Validators.required, Validators.minLength(4)])] + }, {validator: EqualPasswordsValidator.validate('password', 'repeatPassword')}) + }); + + this.name = this.form.controls['name']; + this.email = this.form.controls['email']; + this.passwords = this.form.controls['passwords']; + this.password = this.passwords.controls['password']; + this.repeatPassword = this.passwords.controls['repeatPassword']; + } + + public onSubmit(values:Object):void { + this.submitted = true; + if (this.form.valid) { + // your code goes here + // console.log(values); + } + } +} diff --git a/src/app/pages/register/register.html b/src/app/pages/register/register.html new file mode 100644 index 00000000..a82baf6d --- /dev/null +++ b/src/app/pages/register/register.html @@ -0,0 +1,53 @@ +
+
+

Sign up to ng2-admin

+ Already have an ng2-admin account? Sign in! + +
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ + Passwords don't match. +
+
+
+
+ +
+
+
+ +
or Sign up with one click
+ + +
+
diff --git a/src/app/pages/register/register.routes.ts b/src/app/pages/register/register.routes.ts new file mode 100644 index 00000000..a6d577a8 --- /dev/null +++ b/src/app/pages/register/register.routes.ts @@ -0,0 +1,10 @@ +import {RouterConfig} from '@angular/router'; +import {Register} from './register.component'; + +//noinspection TypeScriptValidateTypes +export const RegisterRoutes: RouterConfig = [ + { + path: 'register', + component: Register + } +]; diff --git a/src/app/pages/register/register.scss b/src/app/pages/register/register.scss new file mode 100644 index 00000000..cb03e3ee --- /dev/null +++ b/src/app/pages/register/register.scss @@ -0,0 +1 @@ +@import '../../theme/sass/auth'; diff --git a/src/app/pages/tables/tables.component.ts b/src/app/pages/tables/tables.component.ts index 13e1f44e..1091f8e6 100644 --- a/src/app/pages/tables/tables.component.ts +++ b/src/app/pages/tables/tables.component.ts @@ -1,7 +1,4 @@ import {Component} from '@angular/core'; -import {RouteConfig} from '@angular/router-deprecated'; - -import {BasicTables} from './components/basicTables'; @Component({ selector: 'forms', @@ -10,14 +7,6 @@ import {BasicTables} from './components/basicTables'; styles: [], template: `` }) -@RouteConfig([ - { - name: 'BasicTables', - component: BasicTables, - path: '/basic', - useAsDefault: true - } -]) export class Tables { constructor() { diff --git a/src/app/pages/ui/ui.component.ts b/src/app/pages/ui/ui.component.ts index a59df0ae..bd1461b9 100644 --- a/src/app/pages/ui/ui.component.ts +++ b/src/app/pages/ui/ui.component.ts @@ -1,10 +1,4 @@ import {Component} from '@angular/core'; -import {RouteConfig} from '@angular/router-deprecated'; - -import {Typography} from './components/typography'; -import {Buttons} from './components/buttons'; -import {Icons} from './components/incons'; -import {Grid} from './components/grid'; @Component({ selector: 'ui', @@ -13,29 +7,6 @@ import {Grid} from './components/grid'; styles: [], template: `` }) -@RouteConfig([ - { - name: 'Typography', - component: Typography, - path: '/typography', - useAsDefault: true - }, - { - name: 'Buttons', - component: Buttons, - path: '/buttons', - }, - { - name: 'Icons', - component: Icons, - path: '/icons', - }, - { - name: 'Grid', - component: Grid, - path: '/grid', - } -]) export class Ui { constructor() { diff --git a/src/app/theme/components/baBackTop/baBackTop.component.ts b/src/app/theme/components/baBackTop/baBackTop.component.ts index 3832adb7..3bcdb94a 100644 --- a/src/app/theme/components/baBackTop/baBackTop.component.ts +++ b/src/app/theme/components/baBackTop/baBackTop.component.ts @@ -21,13 +21,13 @@ export class BaBackTop { @HostListener('click') _onClick():boolean { - $('html, body').animate({scrollTop:0}, {duration:this.moveSpeed}); + jQuery('html, body').animate({scrollTop:0}, {duration:this.moveSpeed}); return false; } @HostListener('window:scroll') _onWindowScroll():void { let el = this._selector.nativeElement; - window.scrollY > this.position ? $(el).fadeIn(this.showSpeed) : $(el).fadeOut(this.showSpeed); + window.scrollY > this.position ? jQuery(el).fadeIn(this.showSpeed) : jQuery(el).fadeOut(this.showSpeed); } } diff --git a/src/app/theme/components/baCard/baCard.component.ts b/src/app/theme/components/baCard/baCard.component.ts index 8c700c08..f49807b0 100644 --- a/src/app/theme/components/baCard/baCard.component.ts +++ b/src/app/theme/components/baCard/baCard.component.ts @@ -1,5 +1,4 @@ -import {Component, ViewEncapsulation, Input} from '@angular/core'; - +import {Component, ViewEncapsulation, ViewChild, Input} from '@angular/core'; import {BaCardBlur} from './baCardBlur.directive'; @Component({ diff --git a/src/app/theme/components/baCard/index.ts b/src/app/theme/components/baCard/index.ts index b04caf13..8a8fa6c2 100644 --- a/src/app/theme/components/baCard/index.ts +++ b/src/app/theme/components/baCard/index.ts @@ -1,2 +1 @@ -export * from './baCard.component.ts'; -export * from './baCardBlur.directive'; +export * from './baCard.component'; diff --git a/src/app/theme/components/baFullCalendar/baFullCalendar.component.ts b/src/app/theme/components/baFullCalendar/baFullCalendar.component.ts index ef1fd623..b9e71b72 100644 --- a/src/app/theme/components/baFullCalendar/baFullCalendar.component.ts +++ b/src/app/theme/components/baFullCalendar/baFullCalendar.component.ts @@ -16,7 +16,7 @@ export class BaFullCalendar { @ViewChild('baFullCalendar') private _selector:ElementRef; ngAfterViewInit() { - let calendar = $(this._selector.nativeElement).fullCalendar(this.baFullCalendarConfiguration); + let calendar = jQuery(this._selector.nativeElement).fullCalendar(this.baFullCalendarConfiguration); this.onCalendarReady.emit(calendar); } } diff --git a/src/app/theme/components/baMenu/baMenu.component.ts b/src/app/theme/components/baMenu/baMenu.component.ts new file mode 100644 index 00000000..c20f2756 --- /dev/null +++ b/src/app/theme/components/baMenu/baMenu.component.ts @@ -0,0 +1,71 @@ +import {Component, ViewEncapsulation, Input, Output, EventEmitter} from '@angular/core'; +import {Router, RouterConfig, NavigationEnd} from '@angular/router'; +import {Subscription} from 'rxjs/Rx'; + +import {BaSlimScroll} from '../../../theme/directives'; +import {BaMenuService} from './baMenu.service'; +import {BaMenuItem} from './components/baMenuItem'; + +@Component({ + selector: 'ba-menu', + encapsulation: ViewEncapsulation.None, + styles: [require('./baMenu.scss')], + template: require('./baMenu.html'), + providers: [BaMenuService], + directives: [BaMenuItem, BaSlimScroll] +}) +export class BaMenu { + + @Input() menuRoutes:RouterConfig = []; + @Input() sidebarCollapsed:boolean = false; + @Input() menuHeight:number; + + @Output() expandMenu = new EventEmitter(); + + public menuItems:any[]; + public showHoverElem:boolean; + public hoverElemHeight:number; + public hoverElemTop:number; + protected _onRouteChange:Subscription; + public outOfArea:number = -200; + + constructor(private _router:Router, private _service:BaMenuService) { + + this._onRouteChange = this._router.events.subscribe((event) => { + if (this.menuItems && event instanceof NavigationEnd) { + this.menuItems = this._service.selectMenuItem(this.menuItems); + } + }); + } + + public ngOnInit():void { + this.menuItems = this._service.convertRoutesToMenus(this.menuRoutes); + } + + public ngOnDestroy():void { + this._onRouteChange.unsubscribe(); + } + + public hoverItem($event):void { + this.showHoverElem = true; + this.hoverElemHeight = $event.currentTarget.clientHeight; + // TODO: get rid of magic 66 constant + this.hoverElemTop = $event.currentTarget.getBoundingClientRect().top - 66; + } + + public toggleSubMenu($event):boolean { + var submenu = jQuery($event.currentTarget).next(); + + if (this.sidebarCollapsed) { + this.expandMenu.emit(null); + if (!$event.item.expanded) { + $event.item.expanded = true; + } + } else { + $event.item.expanded = !$event.item.expanded; + submenu.slideToggle(); + } + + return false; + } +} diff --git a/src/app/theme/components/baMenu/baMenu.html b/src/app/theme/components/baMenu/baMenu.html new file mode 100644 index 00000000..ebe22ab7 --- /dev/null +++ b/src/app/theme/components/baMenu/baMenu.html @@ -0,0 +1,11 @@ + diff --git a/src/app/theme/components/baMenu/baMenu.scss b/src/app/theme/components/baMenu/baMenu.scss new file mode 100644 index 00000000..c909ac72 --- /dev/null +++ b/src/app/theme/components/baMenu/baMenu.scss @@ -0,0 +1 @@ +@import '../../sass/conf/conf'; diff --git a/src/app/theme/components/baMenu/baMenu.service.ts b/src/app/theme/components/baMenu/baMenu.service.ts new file mode 100644 index 00000000..71ca44bb --- /dev/null +++ b/src/app/theme/components/baMenu/baMenu.service.ts @@ -0,0 +1,103 @@ +import {Injectable} from '@angular/core'; +import {Router, UrlTree, RouterConfig} from '@angular/router'; + +@Injectable() +export class BaMenuService { + + constructor(private _router:Router) { + } + + public convertRoutesToMenus(routes:RouterConfig):any[] { + let items = this._convertArrayToItems(routes); + return this._skipEmpty(items); + } + + public selectMenuItem(menuItems:any[]):any[] { + let items = []; + menuItems.forEach((item) => { + this._selectItem(item); + + if (item.children && item.children.length > 0) { + item.children = this.selectMenuItem(item.children); + } + items.push(item); + }); + return items; + } + + protected _skipEmpty(items:any[]):any[] { + let menu = []; + items.forEach((item) => { + let menuItem; + if (item.skip) { + if (item.children && item.children.length > 0) { + menuItem = item.children; + } + } else { + menuItem = item; + } + + if (menuItem) { + menu.push(menuItem); + } + }); + + return [].concat.apply([], menu); + } + + protected _convertArrayToItems(routes:any[], parent?:any):any[] { + let items = []; + routes.forEach((route) => { + items.push(this._convertObjectToItem(route, parent)); + }); + return items; + } + + protected _convertObjectToItem(object, parent?:any):any { + let item:any = {}; + if (object.data && object.data.menu) { + // this is a menu object + item = object.data.menu; + item.route = object; + delete item.route.data.menu; + } else { + item.route = object; + item.skip = true; + } + + // we have to collect all paths to correctly build the url then + item.route.paths = parent && parent.route && parent.route.paths ? parent.route.paths.slice(0) : []; + item.route.paths.push(item.route.path); + + if (object.children && object.children.length > 0) { + item.children = this._convertArrayToItems(object.children, item); + } + + let prepared = this._prepareItem(item); + + // if current item is selected or expanded - then parent is expanded too + if ((prepared.selected || prepared.expanded) && parent) { + parent.expanded = true; + } + + return prepared; + } + + protected _prepareItem(object:any):any { + if (!object.skip) { + + let itemUrl = this._router.serializeUrl(this._router.createUrlTree(object.route.paths)); + object.url = object.url ? object.url : '/#' + itemUrl; + + object.target = object.target || ''; + return this._selectItem(object); + } + + return object; + } + + protected _selectItem(object:any):any { + object.selected = object.url == ('/#' + this._router.url); + return object; + } +} diff --git a/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.component.ts b/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.component.ts new file mode 100644 index 00000000..46fc3a7f --- /dev/null +++ b/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.component.ts @@ -0,0 +1,28 @@ +import {Component, ViewEncapsulation, Input, Output, EventEmitter} from '@angular/core'; + +@Component({ + selector: 'ba-menu-item', + encapsulation: ViewEncapsulation.None, + styles: [require('./baMenuItem.scss')], + template: require('./baMenuItem.html'), + providers: [], + directives: [BaMenuItem] +}) +export class BaMenuItem { + + @Input() menuItem:any; + @Input() child:boolean = false; + + @Output() itemHover = new EventEmitter(); + @Output() toggleSubMenu = new EventEmitter(); + + public onHoverItem($event):void { + this.itemHover.emit($event); + } + + public onToggleSubMenu($event, item):boolean { + $event.item = item; + this.toggleSubMenu.emit($event); + return false; + } +} diff --git a/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.html b/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.html new file mode 100644 index 00000000..7f009ab3 --- /dev/null +++ b/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.html @@ -0,0 +1,21 @@ +
  • + + + + {{ menuItem.title }} + + + + {{ menuItem.title }} + + + +
      + +
    + +
  • diff --git a/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.scss b/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.scss new file mode 100644 index 00000000..00bb0106 --- /dev/null +++ b/src/app/theme/components/baMenu/components/baMenuItem/baMenuItem.scss @@ -0,0 +1 @@ +@import '../../../../sass/conf/conf'; diff --git a/src/app/theme/components/baMenu/components/baMenuItem/index.ts b/src/app/theme/components/baMenu/components/baMenuItem/index.ts new file mode 100644 index 00000000..5ee5509a --- /dev/null +++ b/src/app/theme/components/baMenu/components/baMenuItem/index.ts @@ -0,0 +1 @@ +export * from './baMenuItem.component'; diff --git a/src/app/theme/components/baMenu/index.ts b/src/app/theme/components/baMenu/index.ts new file mode 100644 index 00000000..99f5ff1f --- /dev/null +++ b/src/app/theme/components/baMenu/index.ts @@ -0,0 +1 @@ +export * from './baMenu.component.ts'; diff --git a/src/app/theme/components/baPictureUploader/baPictureUploader.component.ts b/src/app/theme/components/baPictureUploader/baPictureUploader.component.ts new file mode 100644 index 00000000..1d97dd21 --- /dev/null +++ b/src/app/theme/components/baPictureUploader/baPictureUploader.component.ts @@ -0,0 +1,90 @@ +import {Component, ViewChild, Input, Output, EventEmitter, ElementRef, Renderer} from '@angular/core'; +import {Ng2Uploader} from 'ng2-uploader/ng2-uploader'; + +@Component({ + selector: 'ba-picture-uploader', + styles: [require('./baPictureUploader.scss')], + template: require('./baPictureUploader.html'), + providers: [Ng2Uploader] +}) +export class BaPictureUploader { + + @Input() defaultPicture:string = ''; + @Input() picture:string = ''; + + @Input() uploaderOptions:any = {}; + @Input() canDelete:boolean = true; + + onUpload:EventEmitter = new EventEmitter(); + onUploadCompleted:EventEmitter = new EventEmitter(); + + @ViewChild('fileUpload') protected _fileUpload:ElementRef; + + public uploadInProgress:boolean = false; + + constructor(private renderer:Renderer, protected _uploader:Ng2Uploader) { + } + + public ngOnInit():void { + if (this._canUploadOnServer()) { + setTimeout(() => { + this._uploader.setOptions(this.uploaderOptions); + }); + + this._uploader._emitter.subscribe((data) => { + this._onUpload(data); + }); + } else { + console.warn('Please specify url parameter to be able to upload the file on the back-end'); + } + } + + public onFiles():void { + let files = this._fileUpload.nativeElement.files; + + if (files.length) { + const file = files[0]; + this._changePicture(file); + + if (this._canUploadOnServer()) { + this.uploadInProgress = true; + this._uploader.addFilesToQueue(files); + } + } + } + + public bringFileSelector():boolean { + this.renderer.invokeElementMethod(this._fileUpload.nativeElement, 'click'); + return false; + } + + public removePicture():boolean { + this.picture = ''; + return false; + } + + protected _changePicture(file:File):void { + const reader = new FileReader(); + reader.addEventListener('load', (event:Event) => { + this.picture = ( event.target).result; + }, false); + reader.readAsDataURL(file); + } + + protected _onUpload(data):void { + if (data['done'] || data['abort'] || data['error']) { + this._onUploadCompleted(data); + } else { + this.onUpload.emit(data); + } + } + + protected _onUploadCompleted(data):void { + this.uploadInProgress = false; + this.onUploadCompleted.emit(data); + } + + protected _canUploadOnServer():boolean { + return !!this.uploaderOptions['url']; + } +} diff --git a/src/app/theme/components/baPictureUploader/baPictureUploader.html b/src/app/theme/components/baPictureUploader/baPictureUploader.html new file mode 100644 index 00000000..78c58684 --- /dev/null +++ b/src/app/theme/components/baPictureUploader/baPictureUploader.html @@ -0,0 +1,16 @@ +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    + + Change profile Picture + +
    diff --git a/src/app/theme/components/baPictureUploader/baPictureUploader.scss b/src/app/theme/components/baPictureUploader/baPictureUploader.scss new file mode 100644 index 00000000..28cb6b59 --- /dev/null +++ b/src/app/theme/components/baPictureUploader/baPictureUploader.scss @@ -0,0 +1,114 @@ +@import '../../sass/conf/conf'; + +.picture-group { + border: 1px dashed #b8b8b8; + width: 202px; + height: 202px; + position: relative; + cursor: pointer; + .picture-wrapper { + width: 200px; + height: 200px; + overflow: hidden; + display: flex; + justify-content: center; + align-items: center; + } + img { + max-width: 100%; + max-height: 100%; + } + i { + display: none; + position: absolute; + font-size: 32px; + background: $default; + cursor: pointer; + color: $primary; + top: -11px; + right: -11px; + height: 26px; + border-radius: 50%; + &:before { + line-height: 26px; + } + &:hover { + color: $danger; + } + } + a.change-picture { + display: none; + width: 202px; + background: rgba(0, 0, 0, 0.7); + transition: all 200ms ease-in-out; + color: $default-text; + text-decoration: none; + position: absolute; + bottom: -1px; + left: -1px; + line-height: 32px; + text-align: center; + } + &:hover { + i { + display: block; + } + .change-picture { + display: block; + } + } + + .loading { + width: 100%; + height: 100%; + left: 0; + display: flex; + position: absolute; + justify-content: center; + align-items: center; + } + .spinner { + width: 60px; + height: 60px; + position: relative; + } + + .double-bounce1, .double-bounce2 { + width: 100%; + height: 100%; + border-radius: 50%; + background-color: #fff; + opacity: 0.6; + position: absolute; + top: 0; + left: 0; + + -webkit-animation: sk-bounce 2.0s infinite ease-in-out; + animation: sk-bounce 2.0s infinite ease-in-out; + } + + .double-bounce2 { + -webkit-animation-delay: -1.0s; + animation-delay: -1.0s; + } + + @-webkit-keyframes sk-bounce { + 0%, 100% { + -webkit-transform: scale(0.0) + } + 50% { + -webkit-transform: scale(1.0) + } + } + + @keyframes sk-bounce { + 0%, 100% { + transform: scale(0.0); + -webkit-transform: scale(0.0); + } + 50% { + transform: scale(1.0); + -webkit-transform: scale(1.0); + } + } +} diff --git a/src/app/theme/components/baPictureUploader/index.ts b/src/app/theme/components/baPictureUploader/index.ts new file mode 100644 index 00000000..8a89813d --- /dev/null +++ b/src/app/theme/components/baPictureUploader/index.ts @@ -0,0 +1 @@ +export * from './baPictureUploader.component.ts'; diff --git a/src/app/theme/components/baSidebar/baSidebar.component.ts b/src/app/theme/components/baSidebar/baSidebar.component.ts index cfc48527..c8825733 100644 --- a/src/app/theme/components/baSidebar/baSidebar.component.ts +++ b/src/app/theme/components/baSidebar/baSidebar.component.ts @@ -1,41 +1,32 @@ import {Component, ElementRef, HostListener, ViewEncapsulation} from '@angular/core'; -import {Router} from '@angular/router-deprecated'; - import {AppState} from '../../../app.state'; import {layoutSizes} from '../../../theme'; -import {BaSlimScroll} from '../../../theme/directives'; -import {BaSidebarService} from './baSidebar.service'; +import {BaMenu} from '../baMenu'; +import {routes} from '../../../../app/app.routes'; @Component({ selector: 'ba-sidebar', encapsulation: ViewEncapsulation.None, styles: [require('./baSidebar.scss')], template: require('./baSidebar.html'), - providers: [BaSidebarService], - directives: [BaSlimScroll] + providers: [], + directives: [BaMenu] }) export class BaSidebar { - public menuItems:Array; + // here we declare which routes we want to use as a menu in our sidebar + public routes = routes; + public menuHeight:number; public isMenuCollapsed:boolean = false; - - public showHoverElem:boolean; - public hoverElemHeight:number; - public hoverElemTop:number; - - public outOfArea:number = -200; - public isMenuShouldCollapsed:boolean = false; - constructor(private _elementRef:ElementRef, - private _router:Router, - private _sidebarService:BaSidebarService, - private _state:AppState) { - this.menuItems = this._sidebarService.getMenuItems(); - this._router.root.subscribe((path) => this._selectMenuItem(path)); - this._state.subscribe('menu.isCollapsed', (isCollapsed) => { this.isMenuCollapsed = isCollapsed; }); + constructor(private _elementRef:ElementRef, private _state:AppState) { + + this._state.subscribe('menu.isCollapsed', (isCollapsed) => { + this.isMenuCollapsed = isCollapsed; + }); } public ngOnInit():void { @@ -45,7 +36,7 @@ export class BaSidebar { } public ngAfterViewInit():void { - this.updateSidebarHeight(); + setTimeout(() => this.updateSidebarHeight()); } @HostListener('window:resize') @@ -73,45 +64,12 @@ export class BaSidebar { this._state.notifyDataChanged('menu.isCollapsed', this.isMenuCollapsed); } - public hoverItem($event):void { - this.showHoverElem = true; - this.hoverElemHeight = $event.currentTarget.clientHeight; - // TODO: get rid of magic 66 constant - this.hoverElemTop = $event.currentTarget.getBoundingClientRect().top - 66; - } - public updateSidebarHeight():void { // TODO: get rid of magic 84 constant this.menuHeight = this._elementRef.nativeElement.childNodes[0].clientHeight - 84; } - public toggleSubMenu($event, item):boolean { - var submenu = $($event.currentTarget).next(); - - if (this.isMenuCollapsed) { - this.menuExpand(); - if (!item.expanded) { - item.expanded = true; - } - } else { - item.expanded = !item.expanded; - submenu.slideToggle(); - } - - return false; - } - private _shouldMenuCollapse():boolean { return window.innerWidth <= layoutSizes.resWidthCollapseSidebar; } - - private _selectMenuItem(currentPath = null):void { - - let currentMenu = this._sidebarService.setRouter(this._router).selectMenuItem(this.menuItems, currentPath); - this._state.notifyDataChanged('menu.activeLink', currentMenu); - // hide menu after natigation on mobile devises - if (this._shouldMenuCollapse()) { - this.menuCollapse(); - } - } } diff --git a/src/app/theme/components/baSidebar/baSidebar.html b/src/app/theme/components/baSidebar/baSidebar.html index a393c8df..62e9eab9 100644 --- a/src/app/theme/components/baSidebar/baSidebar.html +++ b/src/app/theme/components/baSidebar/baSidebar.html @@ -1,55 +1,6 @@ diff --git a/src/app/theme/components/baSidebar/baSidebar.scss b/src/app/theme/components/baSidebar/baSidebar.scss index b5de70a3..1f843eee 100644 --- a/src/app/theme/components/baSidebar/baSidebar.scss +++ b/src/app/theme/components/baSidebar/baSidebar.scss @@ -135,7 +135,7 @@ a.al-sidebar-list-link { &.expanded { display: block; } - > li { + > ba-menu-item > li { display: block; float: none; padding: 0; diff --git a/src/app/theme/components/baSidebar/baSidebar.service.ts b/src/app/theme/components/baSidebar/baSidebar.service.ts deleted file mode 100644 index 198811d8..00000000 --- a/src/app/theme/components/baSidebar/baSidebar.service.ts +++ /dev/null @@ -1,62 +0,0 @@ -import {Injectable} from '@angular/core'; -import {menuItems} from '../../../app.menu'; - -@Injectable() -export class BaSidebarService { - - private _router; - - public getMenuItems():Array { - return menuItems; - } - - public setRouter(router): BaSidebarService { - this._router = router; - return this; - } - - public selectMenuItem(items:Array, currentPath:string) { - let currentMenu; - - let assignCurrent = (menu) => (menu.selected ? currentMenu = menu : null); - - items.forEach((menu: any) => { - - this._selectItem(currentPath, [menu.component], menu); - assignCurrent(menu); - - if (menu.subMenu) { - menu.subMenu.forEach((subMenu) => { - this._selectItem(currentPath, [menu.component, subMenu.component], subMenu, menu); - assignCurrent(subMenu); - }); - } - }); - return currentMenu; - } - - private _selectItem(currentPath, instructions, item, parentMenu = null) { - let route = this._generateRoute(instructions); - item.selected = !item.disabled && this._isCurrent(route) && this._resolvePath(route, '') == currentPath; - if (parentMenu) { - parentMenu.expanded = parentMenu.expanded || item.selected; - } - } - - private _isCurrent(route) { - return route ? this._router.isRouteActive(route) : false; - } - - private _generateRoute(instructions) { - return instructions.filter(i => typeof i !== 'undefined').length > 0 ? this._router.generate(instructions) : null; - } - - private _resolvePath(instruction, collected) { - if (instruction !== null) { - collected += instruction.urlPath + '/'; - return this._resolvePath(instruction.child, collected) - } else { - return collected.slice(0, -1); - } - } -} diff --git a/src/app/theme/components/index.ts b/src/app/theme/components/index.ts index 4d80824e..a96111fc 100644 --- a/src/app/theme/components/index.ts +++ b/src/app/theme/components/index.ts @@ -1,9 +1,11 @@ export * from './baPageTop'; export * from './baMsgCenter'; export * from './baSidebar'; +export * from './baMenu'; export * from './baContentTop'; export * from './baCard'; export * from './baAmChart'; export * from './baChartistChart'; export * from './baBackTop'; export * from './baFullCalendar'; +export * from './baPictureUploader'; diff --git a/src/app/theme/directives/baSlimScroll/baSlimScroll.directive.ts b/src/app/theme/directives/baSlimScroll/baSlimScroll.directive.ts index 246f4097..2b5a2c83 100644 --- a/src/app/theme/directives/baSlimScroll/baSlimScroll.directive.ts +++ b/src/app/theme/directives/baSlimScroll/baSlimScroll.directive.ts @@ -22,10 +22,10 @@ export class BaSlimScroll { } private _init() { - $(this._elementRef.nativeElement).slimScroll(this.baSlimScrollOptions); + jQuery(this._elementRef.nativeElement).slimScroll(this.baSlimScrollOptions); } private _destroy() { - $(this._elementRef.nativeElement).slimScroll({ destroy: true }); + jQuery(this._elementRef.nativeElement).slimScroll({ destroy: true }); } } diff --git a/src/app/theme/sass/_auth.scss b/src/app/theme/sass/_auth.scss new file mode 100644 index 00000000..9423448e --- /dev/null +++ b/src/app/theme/sass/_auth.scss @@ -0,0 +1,127 @@ +@import 'conf/conf'; + +$text-color: #ffffff; + + +.auth-main { + display: flex; + align-items: center; + height: 100%; + width: 100%; + position: absolute; +} + +.auth-block { + width: 540px; + margin: 0 auto; + border-radius: 5px; + @include bg-translucent-dark(0.55); + color: #fff; + padding: 32px; + h1 { + font-weight: $font-light; + margin-bottom: 28px; + text-align: center; + } + p { + font-size: 16px; + } + a { + text-decoration: none; + outline: none; + transition: all 0.2s ease; + color: $primary; + &:hover { + color: $primary-dark; + } + } + + .control-label { + padding-top: 11px; + color: $text-color; + } + + .form-group { + margin-bottom: 12px; + } +} + +.auth-input { + width: 300px; + margin-bottom: 24px; + input { + display: block; + width: 100%; + border: none; + font-size: 16px; + padding: 4px 10px; + outline: none; + } +} + +a.forgot-pass { + display: block; + text-align: right; + margin-bottom: -20px; + float: right; + z-index: 2; + position: relative; +} + +.auth-link { + display: block; + font-size: 16px; + text-align: center; + margin-bottom: 33px; +} + +.auth-sep { + margin-top: 36px; + margin-bottom: 24px; + line-height: 20px; + font-size: 16px; + text-align: center; + display: block; + position: relative; + & > span { + display: table-cell; + width: 30%; + white-space: nowrap; + padding: 0 24px; + color: $text-color; + & > span { + margin-top: -12px; + display: block; + } + } + &:before, &:after { + border-top: solid 1px $text-color; + content: ""; + height: 1px; + width: 35%; + display: table-cell; + } +} + +.al-share-auth { + text-align: center; + .al-share { + float: none; + margin: 0; + padding: 0; + display: inline-block; + li { + margin-left: 24px; + &:first-child { + margin-left: 0; + } + i { + font-size: 24px; + } + } + } +} + +.btn-auth { + color: #ffffff!important; +} diff --git a/src/app/theme/sass/_form.scss b/src/app/theme/sass/_form.scss index 2a7b0d8c..29b60ada 100644 --- a/src/app/theme/sass/_form.scss +++ b/src/app/theme/sass/_form.scss @@ -582,3 +582,11 @@ label.custom-input-danger { .sub-little-text { font-size: 12px; } + +.rating { + font-size: 20px; +} + +rating-inputs span { + vertical-align: middle; +} diff --git a/src/app/theme/sass/_layout.scss b/src/app/theme/sass/_layout.scss index 7c1acdca..53d06608 100644 --- a/src/app/theme/sass/_layout.scss +++ b/src/app/theme/sass/_layout.scss @@ -66,7 +66,7 @@ a { .al-footer { height: 34px; - padding: 0px 18px 0 $left-space; + padding: 0 18px 0 200px; width: 100%; position: absolute; display: block; diff --git a/src/app/theme/sass/_treeView.scss b/src/app/theme/sass/_treeView.scss new file mode 100644 index 00000000..fd03a679 --- /dev/null +++ b/src/app/theme/sass/_treeView.scss @@ -0,0 +1,27 @@ +#tree-view .tree { + & .node-value { + color: white; + } + & .folding { + &.node-expanded::before { + color: white; + } + &.node-collapsed::before { + color: white; + } + &.node-leaf::before { + color: white; + } + } + & .over-drop-target { + border: 4px solid ghostwhite; + } + & .node-value{ + & .node-selected::after { + background-color: white; + } + &:after { + background-color: white; + } + } +} diff --git a/src/app/theme/theme.configProvider.ts b/src/app/theme/theme.configProvider.ts index 4eb404ba..7450a4e9 100644 --- a/src/app/theme/theme.configProvider.ts +++ b/src/app/theme/theme.configProvider.ts @@ -1,5 +1,6 @@ import {Injectable} from '@angular/core'; import {colorHelper} from './theme.constants'; +import * as _ from 'lodash'; @Injectable() export class BaThemeConfigProvider { diff --git a/src/app/theme/theme.scss b/src/app/theme/theme.scss index 4f38c1d0..f1f411b2 100644 --- a/src/app/theme/theme.scss +++ b/src/app/theme/theme.scss @@ -8,3 +8,4 @@ @import "sass/socicon"; @import "sass/table"; @import "sass/form"; +@import "sass/treeView"; diff --git a/src/app/theme/validators/email.validator.ts b/src/app/theme/validators/email.validator.ts new file mode 100644 index 00000000..a23f8533 --- /dev/null +++ b/src/app/theme/validators/email.validator.ts @@ -0,0 +1,14 @@ +import {AbstractControl} from '@angular/forms'; + +export class EmailValidator { + + public static validate(c:AbstractControl) { + let EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i; + + return EMAIL_REGEXP.test(c.value) ? null : { + validateEmail: { + valid: false + } + }; + } +} diff --git a/src/app/theme/validators/equalPasswords.validator.ts b/src/app/theme/validators/equalPasswords.validator.ts new file mode 100644 index 00000000..d5cbc40e --- /dev/null +++ b/src/app/theme/validators/equalPasswords.validator.ts @@ -0,0 +1,16 @@ +import {FormGroup} from '@angular/forms'; + +export class EqualPasswordsValidator { + + public static validate(firstField, secondField) { + + return (c:FormGroup) => { + + return (c.controls && c.controls[firstField].value == c.controls[secondField].value) ? null : { + passwordsEqual: { + valid: false + } + }; + } + } +} diff --git a/src/app/theme/validators/index.ts b/src/app/theme/validators/index.ts new file mode 100644 index 00000000..f1bab666 --- /dev/null +++ b/src/app/theme/validators/index.ts @@ -0,0 +1,2 @@ +export * from './email.validator'; +export * from './equalPasswords.validator'; \ No newline at end of file diff --git a/src/custom-typings.d.ts b/src/custom-typings.d.ts index 772f1988..ac2c0c9c 100644 --- a/src/custom-typings.d.ts +++ b/src/custom-typings.d.ts @@ -29,7 +29,7 @@ import * as _ from 'lodash' * */ -declare var $:any; +declare var jQuery:any; declare var GoogleMapsLoader:any; declare var L:any; declare var AmCharts:any; diff --git a/src/platform/browser/directives.ts b/src/platform/browser/directives.ts index 7693bb4b..0b63ed5f 100644 --- a/src/platform/browser/directives.ts +++ b/src/platform/browser/directives.ts @@ -5,11 +5,14 @@ import {PLATFORM_DIRECTIVES} from '@angular/core'; // Angular 2 Router -import {ROUTER_DIRECTIVES} from '@angular/router-deprecated'; +import {ROUTER_DIRECTIVES} from '@angular/router'; +// Angular 2 forms +import { REACTIVE_FORM_DIRECTIVES } from '@angular/forms'; // application_directives: directives that are global through out the application export const APPLICATION_DIRECTIVES = [ - ...ROUTER_DIRECTIVES + ...ROUTER_DIRECTIVES, + ...REACTIVE_FORM_DIRECTIVES ]; export const DIRECTIVES = [ diff --git a/src/platform/browser/providers.ts b/src/platform/browser/providers.ts index 9027794d..6f9dfa8f 100644 --- a/src/platform/browser/providers.ts +++ b/src/platform/browser/providers.ts @@ -7,18 +7,24 @@ import {FORM_PROVIDERS, LocationStrategy, HashLocationStrategy} from '@angular/c // Angular 2 Http import {HTTP_PROVIDERS} from '@angular/http'; -// Angular 2 Router -import {ROUTER_PROVIDERS} from '@angular/router-deprecated'; +import {APP_ROUTER_PROVIDERS} from '../../app/app.routes'; + + +// Angular 2 forms +import {disableDeprecatedForms, provideForms} from '@angular/forms'; /* -* Application Providers/Directives/Pipes -* providers/directives/pipes that only live in our browser environment -*/ + * Application Providers/Directives/Pipes + * providers/directives/pipes that only live in our browser environment + */ export const APPLICATION_PROVIDERS = [ - ...FORM_PROVIDERS, + // new Angular 2 forms + disableDeprecatedForms(), + provideForms(), ...HTTP_PROVIDERS, - ...ROUTER_PROVIDERS, - {provide: LocationStrategy, useClass: HashLocationStrategy } + ...APP_ROUTER_PROVIDERS, + {provide: LocationStrategy, useClass: HashLocationStrategy}, + {provide: LocationStrategy, useClass: HashLocationStrategy} ]; export const PROVIDERS = [ diff --git a/src/platform/environment.ts b/src/platform/environment.ts index 252bc2ac..a1b1b4ee 100644 --- a/src/platform/environment.ts +++ b/src/platform/environment.ts @@ -1,25 +1,39 @@ // Angular 2 -import {enableProdMode} from '@angular/core'; - +// rc2 workaround +import { enableDebugTools, disableDebugTools } from '@angular/platform-browser'; +import { enableProdMode } from '@angular/core'; // Environment Providers -let PROVIDERS = []; +let PROVIDERS = [ + // common env directives +]; + +// Angular debug tools in the dev console +// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md +let _decorateComponentRef = function identity(value) { return value; }; if ('production' === ENV) { // Production + disableDebugTools(); enableProdMode(); PROVIDERS = [ - ...PROVIDERS + ...PROVIDERS, + // custom providers in production ]; } else { + + _decorateComponentRef = (cmpRef) => enableDebugTools(cmpRef); + // Development PROVIDERS = [ - ...PROVIDERS + ...PROVIDERS, + // custom providers in development ]; } +export const decorateComponentRef = _decorateComponentRef; export const ENV_PROVIDERS = [ ...PROVIDERS diff --git a/src/vendor.ts b/src/vendor.ts index a5c5b6cd..3ace4485 100644 --- a/src/vendor.ts +++ b/src/vendor.ts @@ -9,7 +9,7 @@ import '@angular/platform-browser-dynamic'; import '@angular/core'; import '@angular/common'; import '@angular/http'; -import '@angular/router-deprecated'; +import '@angular/router'; // RxJS import 'rxjs/add/operator/map'; diff --git a/tsconfig.json b/tsconfig.json index d9c9298b..c8ea38d1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,19 +8,9 @@ "noEmitHelpers": true }, "exclude": [ - "node_modules", - "typings/main.d.ts", - "typings/main" - ], - "filesGlob": [ - "./src/**/*.ts", - "./test/**/*.ts", - "!./node_modules/**/*.ts", - "src/custom-typings.d.ts", - "typings/browser.d.ts" + "node_modules" ], "awesomeTypescriptLoaderOptions": { - "resolveGlobs": true, "forkChecker": true }, "compileOnSave": false, diff --git a/tslint.json b/tslint.json index f16b4dee..dd143204 100644 --- a/tslint.json +++ b/tslint.json @@ -1,6 +1,6 @@ { "rulesDirectory": [ - "node_modules/codelyzer/dist/src" + "node_modules/codelyzer" ], "rules": { "member-access": false, @@ -133,19 +133,6 @@ "check-separator", "check-type" ], - - "directive-selector-name": [true, "kebab-case"], - "component-selector-name": [true, "kebab-case"], - "directive-selector-type": [true, "attribute"], - "component-selector-type": [true, "element"], - "directive-selector-prefix": false, - "component-selector-prefix": false, - "host-parameter-decorator": true, - "input-parameter-decorator": true, - "output-parameter-decorator": true, - "attribute-parameter-decorator": false, - "input-property-directive": true, - "output-property-directive": true, - "call-forward-ref":true + "import-destructuring-spacing": true } } diff --git a/typings.json b/typings.json index 005a79b0..7c44bf64 100644 --- a/typings.json +++ b/typings.json @@ -1,13 +1,16 @@ { - "dependencies": { - "zone.js": "github:gdi2290/typed-zone.js#66ea8a3451542bb7798369306840e46be1d6ec89" + "globalDependencies": { + "angular-protractor": "registry:dt/angular-protractor#1.5.0+20160425143459", + "core-js": "registry:dt/core-js#0.0.0+20160602141332", + "hammerjs": "registry:dt/hammerjs#2.0.4+20160417130828", + "jasmine": "registry:dt/jasmine#2.2.0+20160621224255", + "node": "registry:dt/node#6.0.0+20160621231320", + "selenium-webdriver": "registry:dt/selenium-webdriver#2.44.0+20160317120654", + "source-map": "registry:dt/source-map#0.0.0+20160317120654", + "uglify-js": "registry:dt/uglify-js#2.6.1+20160316155526", + "webpack": "registry:dt/webpack#1.12.9+20160523035535" }, - "devDependencies": {}, - "ambientDependencies": { - "core-js": "registry:dt/core-js#0.0.0+20160317120654", - "hammerjs": "github:DefinitelyTyped/DefinitelyTyped/hammerjs/hammerjs.d.ts#74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7", - "lodash": "registry:dt/lodash#3.10.0+20160330154726", - "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729", - "webpack": "github:DefinitelyTyped/DefinitelyTyped/webpack/webpack.d.ts#95c02169ba8fa58ac1092422efbd2e3174a206f4" + "dependencies": { + "lodash": "registry:npm/lodash#4.0.0+20160416211519" } }