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

add path and breadcrumb

parent 3a75a617
class Project { class Project {
constructor(ownerGitlabId, id, name, desc, logo) { constructor(ownerGitlabId, id, name, desc, logo, path) {
this.ownerGitlabId = ownerGitlabId this.ownerGitlabId = ownerGitlabId
this.id = id this.id = id
this.name = name this.name = name
this.desc = desc this.desc = desc
this.logo = logo this.logo = logo
this.path = path
} }
// getter // getter
...@@ -23,6 +24,9 @@ class Project { ...@@ -23,6 +24,9 @@ class Project {
getLogo() { getLogo() {
return this.logo return this.logo
} }
getPath() {
return this.path
}
// setter // setter
setOwnerGitlabId(newOwnerGitlabId){ setOwnerGitlabId(newOwnerGitlabId){
this.ownerGitlabId = newOwnerGitlabId this.ownerGitlabId = newOwnerGitlabId
...@@ -36,9 +40,12 @@ class Project { ...@@ -36,9 +40,12 @@ class Project {
setDesc(newDesc) { setDesc(newDesc) {
this.desc = newDesc this.desc = newDesc
} }
setLogo(newLogoUrl){ setLogo(newLogoUrl) {
this.logo = newLogoUrl this.logo = newLogoUrl
} }
setPath(newPath) {
this.path = newPath
}
} }
module.exports = Project module.exports = Project
\ No newline at end of file
const Project = require("./project"); const Project = require("./project");
class Website extends Project { class Website extends Project {
constructor(ownerGitlabId, id, name, desc, logo, settingUrl, kontaktUrl, isPublished) { constructor(ownerGitlabId, id, name, desc, logo, path, settingUrl, kontaktUrl, isPublished) {
super(ownerGitlabId, id, name, desc, logo) super(ownerGitlabId, id, name, desc, logo, path)
this.settingUrl = settingUrl this.settingUrl = settingUrl
this.kontaktUrl = kontaktUrl this.kontaktUrl = kontaktUrl
this.isPublished = isPublished this.isPublished = isPublished
......
...@@ -216,10 +216,11 @@ module.exports = function (app, config, passport, i18n) { ...@@ -216,10 +216,11 @@ module.exports = function (app, config, passport, i18n) {
isWebsitePublished = true isWebsitePublished = true
} }
let page = new projectInformation(loggedInUser.getGitlabUserId(), gitlabData[i].id, gitlabData[i].name, gitlabData[i].description, let page = new projectInformation(loggedInUser.getGitlabUserId(), gitlabData[i].id, gitlabData[i].name, gitlabData[i].description,
gitlabData[i].avatar_url, null, null, isWebsitePublished) gitlabData[i].avatar_url, gitlabData[i].path, null, null, isWebsitePublished)
gitlabPagesArr.push(page) gitlabPagesArr.push(page)
} else { } else {
let repo = new projectRepo(loggedInUser.getGitlabUserId(), gitlabData[i].id, gitlabData[i].name, gitlabData[i].description, gitlabData[i].avatar_url) let repo = new projectRepo(loggedInUser.getGitlabUserId(), gitlabData[i].id, gitlabData[i].name, gitlabData[i].description,
gitlabData[i].avatar_url, gitlabData[i].path)
gitlabReposArr.push(repo) gitlabReposArr.push(repo)
} }
} }
...@@ -498,7 +499,7 @@ module.exports = function (app, config, passport, i18n) { ...@@ -498,7 +499,7 @@ module.exports = function (app, config, passport, i18n) {
} else { } else {
let projectName = req.body.name.toLowerCase().replace(/\s/g, '-') let projectName = req.body.name.toLowerCase().replace(/\s/g, '-')
let projectDesc = req.body.description let projectDesc = req.body.description
let newInformation = new projectInformation(loggedInUser.getGitlabUserId(), null, projectName, projectDesc, null, null, null, false) let newInformation = new projectInformation(loggedInUser.getGitlabUserId(), null, projectName, projectDesc, null, null, null, null, false)
if (!req.files) { if (!req.files) {
res.flash('error', 'Bitte geben Sie ein Projektlogo an.') res.flash('error', 'Bitte geben Sie ein Projektlogo an.')
...@@ -525,6 +526,7 @@ module.exports = function (app, config, passport, i18n) { ...@@ -525,6 +526,7 @@ module.exports = function (app, config, passport, i18n) {
} else { } else {
newInformation.setId(result.id) newInformation.setId(result.id)
newInformation.setLogo(result.avatar_url) newInformation.setLogo(result.avatar_url)
newInformation.setPath(result.path)
newInformation.setSettingUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/settings.js') newInformation.setSettingUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/settings.js')
newInformation.setKontaktUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/kontakt.html') newInformation.setKontaktUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/kontakt.html')
...@@ -568,12 +570,13 @@ module.exports = function (app, config, passport, i18n) { ...@@ -568,12 +570,13 @@ module.exports = function (app, config, passport, i18n) {
informationStatus = false informationStatus = false
} }
let gitlabData = data.data let gitlabData = data.data
let curInformation = new projectInformation(loggedInUser.getGitlabUserId(), req.query.id, null, null, null, null, null, informationStatus) let curInformation = new projectInformation(loggedInUser.getGitlabUserId(), req.query.id, null, null, null, null, null, null, informationStatus)
for(let i = 0; i < gitlabData.length; i++){ for(let i = 0; i < gitlabData.length; i++){
if (gitlabData[i].id == req.query.id) { if (gitlabData[i].id == req.query.id) {
curInformation.setName(gitlabData[i].name) curInformation.setName(gitlabData[i].name)
curInformation.setDesc(gitlabData[i].description) curInformation.setDesc(gitlabData[i].description)
curInformation.setLogo(gitlabData[i].avatar_url) curInformation.setLogo(gitlabData[i].avatar_url)
curInformation.setPath(gitlabData[i].path)
curInformation.setSettingUrl(tpGitlabURL+gitlabData[i].path_with_namespace+'/-/edit/master/public/settings.js') curInformation.setSettingUrl(tpGitlabURL+gitlabData[i].path_with_namespace+'/-/edit/master/public/settings.js')
curInformation.setKontaktUrl(tpGitlabURL+gitlabData[i].path_with_namespace+'/-/edit/master/public/kontakt.html') curInformation.setKontaktUrl(tpGitlabURL+gitlabData[i].path_with_namespace+'/-/edit/master/public/kontakt.html')
...@@ -604,7 +607,7 @@ module.exports = function (app, config, passport, i18n) { ...@@ -604,7 +607,7 @@ module.exports = function (app, config, passport, i18n) {
if (req.body.isPublished == "false") { if (req.body.isPublished == "false") {
isProjectPublished = false isProjectPublished = false
} }
let updatedInformation = new projectInformation(loggedInUser.getGitlabUserId(), req.query.id, projectName, projectDesc, null, null, null, isProjectPublished) let updatedInformation = new projectInformation(loggedInUser.getGitlabUserId(), req.query.id, projectName, projectDesc, null, null, null, null, isProjectPublished)
let newLogoFile let newLogoFile
async.waterfall([ async.waterfall([
...@@ -630,6 +633,7 @@ module.exports = function (app, config, passport, i18n) { ...@@ -630,6 +633,7 @@ module.exports = function (app, config, passport, i18n) {
} }
} else { } else {
updatedInformation.setLogo(result.avatar_url) updatedInformation.setLogo(result.avatar_url)
updatedInformation.setPath(result.path)
updatedInformation.setSettingUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/settings.js') updatedInformation.setSettingUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/settings.js')
updatedInformation.setKontaktUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/kontakt.html') updatedInformation.setKontaktUrl(tpGitlabURL+result.namespace.path+'/'+result.name+'/-/edit/master/public/kontakt.html')
res.flash("success", "Your website has been updated") res.flash("success", "Your website has been updated")
......
...@@ -35,6 +35,12 @@ html(lang="de") ...@@ -35,6 +35,12 @@ html(lang="de")
i(class="fa fa-sign-out-alt fa-fw") i(class="fa fa-sign-out-alt fa-fw")
span(class="d-none d-md-inline") Logout span(class="d-none d-md-inline") Logout
main(class="col bg-faded py-3 flex-grow-1") main(class="col bg-faded py-3 flex-grow-1")
nav(aria-label="breadcrumb")
ol(class="breadcrumb")
li(class="breadcrumb-item")
a(href="/account") Konto
li(class="breadcrumb-item active" aria-current="page") Projekte und Dienste
div(class="container") div(class="container")
h3(class="pb-2") Dienste h3(class="pb-2") Dienste
div(class="col-sm-12") div(class="col-sm-12")
...@@ -54,13 +60,15 @@ html(lang="de") ...@@ -54,13 +60,15 @@ html(lang="de")
for item in gitlabPages for item in gitlabPages
- let img = item.logo - let img = item.logo
- let editNewPageLink = "/account/updateInformation?id="+item.id - let editNewPageLink = "/account/updateInformation?id="+item.id
- let websiteURL = "https://transfer.hft-stuttgart.de/pages/"+item.path
tr tr
td td
img(src=img, width="45", height="45") img(src=img, width="45", height="45")
if item.isPublished if item.isPublished
td td
a(href=editNewPageLink+"&s=y" class="link-dark") #{item.name} a(href=editNewPageLink+"&s=y" class="link-dark") #{item.name}
td veröffentlicht td
a(href=websiteURL target="_blank" class="link-dark") veröffentlicht
else else
td td
a(href=editNewPageLink+"&s=n" class="link-dark") #{item.name} a(href=editNewPageLink+"&s=n" class="link-dark") #{item.name}
......
...@@ -35,6 +35,14 @@ html(lang="de") ...@@ -35,6 +35,14 @@ html(lang="de")
i(class="fa fa-sign-out-alt fa-fw") i(class="fa fa-sign-out-alt fa-fw")
span(class="d-none d-md-inline") Logout span(class="d-none d-md-inline") Logout
main(class="col bg-faded py-3 flex-grow-1") main(class="col bg-faded py-3 flex-grow-1")
nav(aria-label="breadcrumb")
ol(class="breadcrumb")
li(class="breadcrumb-item")
a(href="/account") Konto
li(class="breadcrumb-item")
a(href="/account/services") Projekte und Dienste
li(class="breadcrumb-item active" aria-current="page") Information aktualisieren
if flash.success if flash.success
div.alert.alert-success.alert-dismissible #{flash.success} div.alert.alert-success.alert-dismissible #{flash.success}
a(class="close", href="#", data-dismiss="alert", aria-label="close") &times; a(class="close", href="#", data-dismiss="alert", aria-label="close") &times;
...@@ -51,7 +59,7 @@ html(lang="de") ...@@ -51,7 +59,7 @@ html(lang="de")
label(for="name", class="col-sm-2") Name label(for="name", class="col-sm-2") Name
div(class="col-sm-8") div(class="col-sm-8")
input#name(name="name", type="text", class="form-control", value=information.name, placeholder="Name", maxlength="75" required) input#name(name="name", type="text", class="form-control", value=information.name, placeholder="Name", maxlength="75" required)
| <p id="nameInfo" class="font-italic font-weight-light"><small>Ihre Webseite wird unter folgender URL veröffentlicht: <strong>https://transfer.hft-stuttgart.de/pages/<span id="websiteName"></span></strong></small></p> | <p id="nameInfo" class="font-italic font-weight-light"><small>Ihre Webseite URL: <strong>https://transfer.hft-stuttgart.de/pages/#{information.path}</strong></small></p>
div(class="form-group row") div(class="form-group row")
label(for="description", class="col-sm-2") Beschreibung label(for="description", class="col-sm-2") Beschreibung
div(class="col-sm-8") div(class="col-sm-8")
...@@ -106,21 +114,6 @@ html(lang="de") ...@@ -106,21 +114,6 @@ html(lang="de")
// M4_LAB // M4_LAB
script(src="/js/headfoot.js") script(src="/js/headfoot.js")
script. script.
function showWebsiteURL() {
if ($("#name").val()) {
$("#nameInfo").show();
let webName = $("#name").val().toLowerCase().replace(/\s/g, '-');
document.getElementById("websiteName").innerText = webName;
}
else {
$("#nameInfo").hide()
}
}
$('#name').on('input',function(e){
showWebsiteURL()
})
showWebsiteURL()
function sendPublishRequest() { function sendPublishRequest() {
$.post("/sendPublishRequest", {projectName: $("#name").val()}, function(resp){ $.post("/sendPublishRequest", {projectName: $("#name").val()}, function(resp){
alert(resp) alert(resp)
......
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