Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
m4lab_tv1
User Account
Commits
6447e044
Commit
6447e044
authored
3 years ago
by
Rosanny Sihombing
Browse files
Options
Download
Email Patches
Plain Diff
add default logo
parent
6e6719ea
master
MLAB-677
devel
reset-jul13
reset-merge
testing
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
public/default/logo.png
+0
-0
public/default/logo.png
routes/routes-account.js
+34
-30
routes/routes-account.js
views/DE/account/newInformation.pug
+1
-0
views/DE/account/newInformation.pug
views/DE/account/updateInformation.pug
+1
-0
views/DE/account/updateInformation.pug
with
36 additions
and
30 deletions
+36
-30
public/default/logo.png
0 → 100644
+
0
-
0
View file @
6447e044
84.7 KB
This diff is collapsed.
Click to expand it.
routes/routes-account.js
+
34
-
30
View file @
6447e044
...
...
@@ -12,6 +12,7 @@ const async = require('async')
const
crypto
=
require
(
'
crypto
'
)
const
mailer
=
require
(
'
./mailer
'
)
const
logoDir
=
'
public/upload/
'
const
defaultLogo
=
'
public/default/logo.png
'
const
tpGitlabURL
=
'
https://transfer.hft-stuttgart.de/gitlab/
'
const
tpGitlabPagesURL
=
'
https://transfer.hft-stuttgart.de/pages/
'
...
...
@@ -493,46 +494,49 @@ module.exports = function (app, config, passport, i18n) {
let
projectDesc
=
req
.
body
.
description
let
projectTemplate
=
req
.
body
.
template
let
newInformation
=
new
projectInformation
(
loggedInUser
.
getGitlabUserId
(),
null
,
projectName
,
projectDesc
,
null
,
null
)
if
(
!
req
.
files
)
{
res
.
flash
(
'
error
'
,
'
Bitte geben Sie ein Projektlogo an.
'
)
res
.
redirect
(
'
/account/newInformation
'
)
}
else
{
let
newLogoFile
=
req
.
files
.
logo
async
.
waterfall
([
function
(
callback
){
// upload logo
let
newLogoFile
=
defaultLogo
if
(
req
.
files
)
{
newLogoFile
=
req
.
files
.
logo
}
async
.
waterfall
([
function
(
callback
){
// upload logo
if
(
!
req
.
files
)
{
callback
(
null
,
newLogoFile
)
}
else
{
newLogoFile
.
mv
(
logoDir
+
newLogoFile
.
name
,
function
(
err
)
{
newLogoFile
=
logoDir
+
newLogoFile
.
name
callback
(
err
,
newLogoFile
)
})
},
async
function
(
newLogoFile
){
// create a new GitLab Page
let
newPages
=
await
gitlab
.
createNewPages
(
newInformation
,
newLogoFile
,
projectTemplate
)
if
(
newPages
.
error
)
{
if
(
newPages
.
data
.
message
.
name
==
"
has already been taken
"
)
{
res
.
flash
(
"
error
"
,
"
Der Projektname '
"
+
newInformation
.
getName
()
+
"
' ist bereits vergeben, bitte wählen Sie einen anderen Namen.
"
)
}
else
{
res
.
flash
(
"
error
"
,
"
Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.
"
)
}
res
.
redirect
(
'
/account/newInformation
'
)
}
},
async
function
(
newLogoFile
){
// create a new GitLab Page
let
newPages
=
await
gitlab
.
createNewPages
(
newInformation
,
newLogoFile
,
projectTemplate
)
if
(
newPages
.
error
)
{
if
(
newPages
.
data
.
message
.
name
==
"
has already been taken
"
)
{
res
.
flash
(
"
error
"
,
"
Der Projektname '
"
+
newInformation
.
getName
()
+
"
' ist bereits vergeben, bitte wählen Sie einen anderen Namen.
"
)
}
else
{
let
newPagesData
=
newPages
.
data
res
.
flash
(
"
success
"
,
"
Ihre Webseite wurde erstellt, aber noch nicht veröffentlicht. Um Ihre Webseite endgültig zu veröffentlichen,
"
+
"
schließen Sie die Einrichtung gemäß unten stehender Anleitung ab.
"
)
/* res.flash("success", "Your website will be published AFTER you complete your website by following the provided guideline below."+
"\r\n Your website URL: "+tpGitlabPagesURL+newPagesData.path_with_namespace+"/home/") */
res
.
redirect
(
'
/account/updateInformation?id=
'
+
newPagesData
.
id
)
res
.
flash
(
"
error
"
,
"
Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.
"
)
}
res
.
redirect
(
'
/account/newInformation
'
)
}
else
{
let
newPagesData
=
newPages
.
data
res
.
flash
(
"
success
"
,
"
Ihre Webseite wurde erstellt, aber noch nicht veröffentlicht. Um Ihre Webseite endgültig zu veröffentlichen,
"
+
"
schließen Sie die Einrichtung gemäß unten stehender Anleitung ab.
"
)
/* res.flash("success", "Your website will be published AFTER you complete your website by following the provided guideline below."+
"\r\n Your website URL: "+tpGitlabPagesURL+newPagesData.path_with_namespace+"/home/") */
res
.
redirect
(
'
/account/updateInformation?id=
'
+
newPagesData
.
id
)
}
],
function
(
err
)
{
if
(
err
)
console
.
log
(
err
)
// remove logo
}
],
function
(
err
)
{
if
(
err
)
console
.
log
(
err
)
// remove logo
if
(
req
.
files
)
{
fs
.
unlink
(
newLogoFile
,
(
err
)
=>
{
if
(
err
)
console
.
log
(
err
)
})
}
)
}
}
}
)
}
}
})
...
...
This diff is collapsed.
Click to expand it.
views/DE/account/newInformation.pug
+
1
-
0
View file @
6447e044
...
...
@@ -80,6 +80,7 @@ html(lang="de")
img(src=defaultLogo, width="100" height="100")
div(class="form-group row px-3")
input#logo(name="logo", class="form-control-file", type="file")
p <small>(Max file size is 80 KB.)</small>
input(type="submit", class="btn btn-primary", value="Senden")
hr
div(class="mx-4", style="color: gray;")
...
...
This diff is collapsed.
Click to expand it.
views/DE/account/updateInformation.pug
+
1
-
0
View file @
6447e044
...
...
@@ -67,6 +67,7 @@ html(lang="de")
img(src=information.logo, width="100" height="100")
div(class="form-group row")
input#logo(name="logo", class="form-control-file", type="file")
p <small>(Max file size is 80 KB.)</small>
input(type="submit", class="btn btn-primary", value="Speichern")
hr
div(class="mx-4")
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets