1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

added folder icon to folder button

This commit is contained in:
Braun Patrik 2016-04-24 20:56:54 +02:00
parent ec482c6346
commit 156c29a81e
5 changed files with 29 additions and 10 deletions

View File

@ -4,13 +4,18 @@ export class DatabaseManager{
private static _instance:DatabaseManager = null; private static _instance:DatabaseManager = null;
private connectionError = false; private connectionError = false;
constructor(onError?:(err)=>void){ constructor(onError?:(err)=>void,onConnected?:() =>void){
mongoose.connection.on('error', function (err) { mongoose.connection.on('error', function (err) {
this.connectionError = true; this.connectionError = true;
if(onError){ if(onError){
onError(err); onError(err);
} }
}); });
mongoose.connection.on('connected', function () {
if(onConnected){
onConnected();
}
});
try { try {
mongoose.connect('mongodb://localhost/EQZT6L'); mongoose.connect('mongodb://localhost/EQZT6L');
}catch(ex){ }catch(ex){
@ -21,9 +26,13 @@ export class DatabaseManager{
} }
} }
public static getInstance(onError?:(err)=>void){ public static getInstance(onError?:(err)=>void,onConnected?:() =>void){
if(DatabaseManager._instance === null){ if(DatabaseManager._instance === null){
DatabaseManager._instance = new DatabaseManager(onError); DatabaseManager._instance = new DatabaseManager(onError,onConnected);
}else{
if(DatabaseManager._instance.connectionError === false && onConnected){
onConnected();
}
} }
return DatabaseManager._instance; return DatabaseManager._instance;
} }

View File

@ -1 +1,3 @@
<a [routerLink]="['Gallery',{directory: getDirectoryPath()}]">{{directory.name}}</a> <a md-raised-button class="md-raised " [routerLink]="['Gallery',{directory: getDirectoryPath()}]" aria-label="More">
<i md-icon>folder</i> {{directory.name}}
</a>

View File

@ -4,11 +4,15 @@ import {Component, Input, OnInit} from 'angular2/core';
import {Directory} from "../../../../common/entities/Directory"; import {Directory} from "../../../../common/entities/Directory";
import {RouterLink} from "angular2/router"; import {RouterLink} from "angular2/router";
import {Utils} from "../../../../common/Utils"; import {Utils} from "../../../../common/Utils";
import {MATERIAL_BROWSER_PROVIDERS} from "ng2-material/all";
import {ViewportHelper} from "ng2-material/all";
import {MATERIAL_DIRECTIVES} from "ng2-material/all";
@Component({ @Component({
selector: 'gallery-directory', selector: 'gallery-directory',
templateUrl: 'app/gallery/directory/directory.gallery.component.html', templateUrl: 'app/gallery/directory/directory.gallery.component.html',
directives:[RouterLink] directives:[RouterLink,MATERIAL_DIRECTIVES],
providers:[MATERIAL_BROWSER_PROVIDERS, ViewportHelper]
}) })
export class GalleryDirectoryComponent{ export class GalleryDirectoryComponent{
@Input() directory: Directory; @Input() directory: Directory;

View File

@ -24,7 +24,7 @@
"dependencies": { "dependencies": {
"angular2": "^2.0.0-beta.15", "angular2": "^2.0.0-beta.15",
"body-parser": "^1.15.0", "body-parser": "^1.15.0",
"core-js": "^2.2.2", "core-js": "^2.3.0",
"debug": "^2.2.0", "debug": "^2.2.0",
"ejs": "^2.4.1", "ejs": "^2.4.1",
"express": "^4.13.4", "express": "^4.13.4",
@ -37,13 +37,14 @@
"mongoose": "^4.4.13", "mongoose": "^4.4.13",
"morgan": "^1.7.0", "morgan": "^1.7.0",
"ng2-cookies": "^0.1.5", "ng2-cookies": "^0.1.5",
"ng2-material": "^0.3.6", "ng2-material": "^0.3.7",
"optimist": "^0.6.1", "optimist": "^0.6.1",
"remap-istanbul": "^0.6.3", "remap-istanbul": "^0.6.3",
"rxjs": "5.0.0-beta.2", "rxjs": "5.0.0-beta.2",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"ts-loader": "^0.8.2", "ts-loader": "^0.8.2",
"tslint": "^3.8.0", "tslint": "^3.8.0",
"tslint-loader": "^2.1.4",
"typescript": "^1.8.10", "typescript": "^1.8.10",
"typings": "^0.7.9", "typings": "^0.7.9",
"webpack": "^1.13.0", "webpack": "^1.13.0",

View File

@ -2,7 +2,10 @@
import {MongoUserManager} from "../../backend/model/mongoose/MongoUserManager"; import {MongoUserManager} from "../../backend/model/mongoose/MongoUserManager";
import {User, UserRoles} from "../../common/entities/User"; import {User, UserRoles} from "../../common/entities/User";
import {DatabaseManager} from "../../backend/model/mongoose/DatabaseManager"; import {DatabaseManager} from "../../backend/model/mongoose/DatabaseManager";
let userManager = new MongoUserManager();
userManager.createUser(new User(0,"demo","demo@demo.hu","demo",UserRoles.Developer),(err)=>{ DatabaseManager.getInstance((err)=>{},()=>{
DatabaseManager.getInstance().disconnect(); let userManager = new MongoUserManager();
userManager.createUser(new User(0,"demo","demo@demo.hu","demo",UserRoles.Developer),(err)=>{
DatabaseManager.getInstance().disconnect();
});
}); });