From e586df6aa47ff8b36be6e55085acdf47cec00c59 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Fri, 19 May 2017 00:45:43 +0200 Subject: [PATCH] Add node_env-var for serverstart; Add Signature preview and link copy --- api/server.js | 8 +++----- package.json | 2 +- static/package.json | 1 + static/src/app/app.module.ts | 3 ++- static/src/app/army/army-member.component.html | 11 +++++++++++ static/src/app/army/army-member.component.ts | 5 +++++ 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/api/server.js b/api/server.js index 0c7a723..d0216d5 100644 --- a/api/server.js +++ b/api/server.js @@ -35,6 +35,8 @@ mongoose.Promise = global.Promise; // app creation const app = express(); +// Middlewares ************************************************* + // setup CORS-middleware const corsOptions = { methods: ['GET'], @@ -42,17 +44,13 @@ const corsOptions = { }; app.use(cors(corsOptions)); -// Middlewares ************************************************* - app.use(favicon(path.join(__dirname + '/..', 'public', 'favicon.ico'))); app.use(express.static(path.join(__dirname + '/..', 'public'))); app.use(bodyParser.json()); - // API request checks for API-version and JSON etc. app.use(restAPIchecks); - // Routes ****************************************************** app.use(urls.signatures, signatureRouter); @@ -62,7 +60,7 @@ if (!process.env.NODE_ENV) { app.use(requestLogger('dev')); } else if (process.env.NODE_ENV !== config.test.env) { // production logging, apache style - app.use(requestLogger(':date :remote-addr :method :url :status :response-time ms')); + app.use(requestLogger(':date[iso] :remote-addr :method :url :status :response-time ms')); } app.use(urls.auth, authenticateRouter); diff --git a/package.json b/package.json index afff3ca..b29196f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "private": true, "scripts": { - "start": "npm run deploy-static-prod && node ./api/server.js", + "start": "npm run deploy-static-prod && NODE_ENV=production node ./api/server.js", "dev": "npm run deploy-static && nodemon ./api/server.js", "deploy-static": "cd ./static && ng build && ln -s ../api/resource/ ../public/resource", "deploy-static-prod": "cd ./static && ng build --env=prod && ln -s ../api/resource/ ../public/resource", diff --git a/static/package.json b/static/package.json index 217bf21..abd362e 100644 --- a/static/package.json +++ b/static/package.json @@ -23,6 +23,7 @@ "jquery": "^3.1.0", "jquery-ui": "^1.12.0", "jquery-ui-bundle": "^1.11.4", + "ngx-clipboard": "^8.0.2", "rxjs": "^5.2.0", "socket.io-client": "^1.4.8", "ts-helpers": "^1.1.1", diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 31fbe14..df9ba0f 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -26,9 +26,10 @@ import {LoginGuard} from "./login/login.guard"; import {AwardingService} from "./services/awarding-service/awarding.service"; import {HttpClient} from "./services/http-client"; import {ArmyService} from "./services/army-service/army.service"; +import { ClipboardModule } from 'ngx-clipboard'; @NgModule({ - imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule], + imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule], providers: [ HttpClient, LoginService, diff --git a/static/src/app/army/army-member.component.html b/static/src/app/army/army-member.component.html index da0b6ae..b684844 100644 --- a/static/src/app/army/army-member.component.html +++ b/static/src/app/army/army-member.component.html @@ -9,6 +9,17 @@
+
+ +
+
+ + + + +
+
diff --git a/static/src/app/army/army-member.component.ts b/static/src/app/army/army-member.component.ts index 3d5808e..c8fb143 100644 --- a/static/src/app/army/army-member.component.ts +++ b/static/src/app/army/army-member.component.ts @@ -16,6 +16,10 @@ export class ArmyMemberComponent { user: User = {}; + signatureUrl; + + isCopied = false; + constructor(private router: Router, private route: ActivatedRoute, private userService: UserService) { @@ -28,6 +32,7 @@ export class ArmyMemberComponent { .flatMap(id => this.userService.getUser(id)) .subscribe(user => { this.user = user; + this.signatureUrl = window.location.origin + '/resource/signature/' + user._id + '.png'; }); };