Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
m4lab_tv1
User Account
Commits
c302e88c
Commit
c302e88c
authored
Mar 20, 2020
by
Wolfgang Knopki
Browse files
project_overview ported
parent
d82e8324
Pipeline
#561
passed with stage
in 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
routes/methods.js
View file @
c302e88c
...
...
@@ -149,7 +149,19 @@ var methods = {
dbconn
.
project
.
query
(
'
CALL getAllLists
'
,
function
(
err
,
rows
,
fields
){
if
(
err
)
throw
err
;
callback
(
rows
[
0
],
err
);
})
})
},
getProjectOverviewById
:
function
(
projectId
,
callback
)
{
dbconn
.
project
.
query
(
'
CALL GetProjectInformationByProjectID(
'
+
projectId
+
'
)
'
,
function
(
err
,
rows
,
fields
){
if
(
err
)
throw
err
;
callback
(
rows
[
0
],
err
);
})
},
getProjectImagesById
:
function
(
projectId
,
callback
)
{
dbconn
.
project
.
query
(
'
CALL getImagesByProjectID(
'
+
projectId
+
'
)
'
,
function
(
err
,
rows
,
fields
){
if
(
err
)
throw
err
;
callback
(
rows
[
0
],
err
);
})
},
addProjectOverview
:
function
(
data
,
callback
)
{
dbconn
.
project
.
query
(
'
INSERT INTO project_overview SET ?
'
,
data
,
function
(
err
,
results
,
fields
){
...
...
routes/routes-project.js
View file @
c302e88c
const
methods
=
require
(
'
./methods
'
)
const
async
=
require
(
'
async
'
)
const
helpers
=
require
(
'
./helpers
'
)
module
.
exports
=
function
(
app
)
{
...
...
@@ -230,5 +231,49 @@ module.exports = function (app) {
app
.
post
(
'
/updateprojectoverview
'
,
function
(
req
,
res
)
{
// only their own project
})
app
.
get
(
'
/projectoverview
'
,
function
(
req
,
res
){
async
.
waterfall
([
function
(
done
)
{
methods
.
getProjectOverviewById
(
req
.
query
.
projectID
,
function
(
projectOverview
,
err
)
{
if
(
!
err
)
{
done
(
err
,
projectOverview
)
}
})
},
function
(
projectOverview
,
done
){
methods
.
getProjectImagesById
(
req
.
query
.
projectID
,
function
(
projectImages
,
err
)
{
if
(
!
err
)
{
done
(
err
,
projectImages
,
projectOverview
)
}
})
},
// render projectOverview page
function
(
projectImages
,
projectOverview
,
done
)
{
console
.
log
(
projectImages
);
partnerWebsites
=
helpers
.
stringToArray
(
projectOverview
[
0
].
partner_website
);
partnerNames
=
helpers
.
stringToArray
(
projectOverview
[
0
].
partner_name
);
awardSites
=
helpers
.
stringToArray
(
projectOverview
[
0
].
award_website
);
awardNames
=
helpers
.
stringToArray
(
projectOverview
[
0
].
award_name
);
sponsorWebsites
=
helpers
.
stringToArray
(
projectOverview
[
0
].
sponsor_website
);
sponsorImgs
=
helpers
.
stringToArray
(
projectOverview
[
0
].
sponsor_img
);
sponsorNames
=
helpers
.
stringToArray
(
projectOverview
[
0
].
sponsor_name
);
res
.
render
(
lang
+
'
/project/projectOverview
'
,
{
isUserAuthenticated
:
req
.
isAuthenticated
(),
user
:
req
.
user
,
projectOV
:
projectOverview
,
projectImgs
:
projectImages
,
partnerWS
:
partnerWebsites
,
partnerN
:
partnerNames
,
awardWS
:
awardSites
,
awardN
:
awardNames
,
sponsorWS
:
sponsorWebsites
,
sponsorIMG
:
sponsorImgs
,
sponsorN
:
sponsorNames
});
}
])
})
};
\ No newline at end of file
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