Commit d625f1f8 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

show project list in a table

parent 7df3b7a0
...@@ -558,16 +558,80 @@ module.exports = function (app, config, passport, i18n) { ...@@ -558,16 +558,80 @@ module.exports = function (app, config, passport, i18n) {
// ======== APP ROUTES - PROJECT LIST ==================== // ======== APP ROUTES - PROJECT LIST ====================
app.get('/project', function (req, res) { app.get('/project', function (req, res) {
if (req.isAuthenticated()) { async.waterfall([
res.render(lang+'/projectList/projects', { // get all projects from projectdb
isUserAuthenticated: true function(done) {
}); methods.getAllProjects(function(projectsOverview, err) {
} if (!err) {
else { done(err, projectsOverview)
res.render(lang+'/projectList/projects', { }
isUserAuthenticated: false })
}); },
} // create JSON object of projects and user status for front-end
function(projectsOverview, done) {
// var allProjects = []
var activeProjects = []
var nonActiveProjects = []
/*
for (var i = 0; i < projectsOverview.length; i++) {
allProjects.push({
id: projectsOverview[i].id,
status: projectsOverview[i].projectstatus,
logo: projectsOverview[i].logo,
akronym: projectsOverview[i].pname,
title: projectsOverview[i].title,
summary: projectsOverview[i].onelinesummary,
category: projectsOverview[i].category,
cp: projectsOverview[i].contact_email
})
}
*/
for (var i = 0; i < projectsOverview.length; i++) {
if (projectsOverview[i].projectstatus == 0) {
nonActiveProjects.push({
id: projectsOverview[i].id,
logo: projectsOverview[i].logo,
akronym: projectsOverview[i].pname,
title: projectsOverview[i].title,
summary: projectsOverview[i].onelinesummary,
category: projectsOverview[i].category,
cp: projectsOverview[i].contact_email
})
}
else if (projectsOverview[i].projectstatus == 1) {
activeProjects.push({
id: projectsOverview[i].id,
logo: projectsOverview[i].logo,
akronym: projectsOverview[i].pname,
title: projectsOverview[i].title,
summary: projectsOverview[i].onelinesummary,
category: projectsOverview[i].category,
cp: projectsOverview[i].contact_email
})
}
}
// render the page
if (req.isAuthenticated()) {
res.render(lang+'/projectList/projects', {
isUserAuthenticated: true,
//project: allProjects
nonActive: nonActiveProjects,
active: activeProjects
});
}
else {
res.render(lang+'/projectList/projects', {
isUserAuthenticated: false,
//project: allProjects
nonActive: nonActiveProjects,
active: activeProjects
});
}
}
])
}) })
}; };
...@@ -33,11 +33,57 @@ html(lang="de") ...@@ -33,11 +33,57 @@ html(lang="de")
} }
body body
div(class="container-fluid") div(class="container-fluid")
div(class="row") h3(class="mb-3 font-weight-bold") Aktive Projekte
div(class="col-md-6 offset-md-2") table(class="table table-striped")
h3(class="mb-3 font-weight-bold") Hello World thead
div(class="col-md-6 offset-md-3") tr
p Content: Project List in a table th Logo
th Akronym
th Title
th Kernziel
th Kategorie
th Ansprechpartner
th Projektinhalte
tbody
for item in active
tr
//td #{item.status}
td
img(src=item.logo, width="40", height="40")
td #{item.akronym}
td #{item.title}
td #{item.summary}
td #{item.category}
td
a(class="nav-link", href="mailto:"+ item.cp) #{item.cp}
td
a(class="nav-link", href="https://m4lab.hft-stuttgart.de/projectoverview?projectID="+ item.id) Zur Projektübersicht
br
h3(class="mb-3 font-weight-bold") Abgeschlossene Projekte
table(class="table table-striped")
thead
tr
th Logo
th Akronym
th Title
th Kernziel
th Kategorie
th Ansprechpartner
th Projektinhalte
tbody
for item in nonActive
tr
//td #{item.status}
td
img(src=item.logo, width="40", height="40")
td #{item.akronym}
td #{item.title}
td #{item.summary}
td #{item.category}
td
a(class="nav-link", href="mailto:"+ item.cp) #{item.cp}
td
a(class="nav-link", href="https://m4lab.hft-stuttgart.de/projectoverview?projectID="+ item.id) Zur Projektübersicht
// jQuery // jQuery
script(src="https://code.jquery.com/jquery-3.3.1.min.js") script(src="https://code.jquery.com/jquery-3.3.1.min.js")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment