diff --git a/classes/project.js b/classes/project.js index 32e5801df56627104cf567d69e93d3f21ccc6eb6..85dafab3830e16ea3db1c50802a4a3a38e2988ed 100644 --- a/classes/project.js +++ b/classes/project.js @@ -1,10 +1,11 @@ class Project { - constructor(ownerGitlabId, id, name, desc, logo) { + constructor(ownerGitlabId, id, name, desc, logo, path) { this.ownerGitlabId = ownerGitlabId this.id = id this.name = name this.desc = desc this.logo = logo + this.path = path } // getter @@ -23,6 +24,9 @@ class Project { getLogo() { return this.logo } + getPath() { + return this.path + } // setter setOwnerGitlabId(newOwnerGitlabId){ this.ownerGitlabId = newOwnerGitlabId @@ -36,9 +40,12 @@ class Project { setDesc(newDesc) { this.desc = newDesc } - setLogo(newLogoUrl){ + setLogo(newLogoUrl) { this.logo = newLogoUrl } + setPath(newPath) { + this.path = newPath + } } module.exports = Project \ No newline at end of file diff --git a/classes/website.js b/classes/website.js index 2906e0152f62e70d8989f04943b60ad1acc5042d..981892698296c7df2d5ffeeedd86cc0765ccdbda 100644 --- a/classes/website.js +++ b/classes/website.js @@ -1,8 +1,8 @@ const Project = require("./project"); class Website extends Project { - constructor(ownerGitlabId, id, name, desc, logo, settingUrl, kontaktUrl, isPublished) { - super(ownerGitlabId, id, name, desc, logo) + constructor(ownerGitlabId, id, name, desc, logo, path, settingUrl, kontaktUrl, isPublished) { + super(ownerGitlabId, id, name, desc, logo, path) this.settingUrl = settingUrl this.kontaktUrl = kontaktUrl this.isPublished = isPublished diff --git a/routes/routes-account.js b/routes/routes-account.js index 6715dddaf45f7fbb6b356b292fe7f4feb3637e8c..5baa62a47ba564f5f21c1e047216e9d39762c8f3 100644 --- a/routes/routes-account.js +++ b/routes/routes-account.js @@ -216,10 +216,11 @@ module.exports = function (app, config, passport, i18n) { isWebsitePublished = true } 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) } 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) } } @@ -498,7 +499,7 @@ module.exports = function (app, config, passport, i18n) { } else { let projectName = req.body.name.toLowerCase().replace(/\s/g, '-') 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) { res.flash('error', 'Bitte geben Sie ein Projektlogo an.') @@ -525,6 +526,7 @@ module.exports = function (app, config, passport, i18n) { } else { newInformation.setId(result.id) newInformation.setLogo(result.avatar_url) + newInformation.setPath(result.path) 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') @@ -568,12 +570,13 @@ module.exports = function (app, config, passport, i18n) { informationStatus = false } 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++){ if (gitlabData[i].id == req.query.id) { curInformation.setName(gitlabData[i].name) curInformation.setDesc(gitlabData[i].description) 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.setKontaktUrl(tpGitlabURL+gitlabData[i].path_with_namespace+'/-/edit/master/public/kontakt.html') @@ -604,7 +607,7 @@ module.exports = function (app, config, passport, i18n) { if (req.body.isPublished == "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 async.waterfall([ @@ -630,6 +633,7 @@ module.exports = function (app, config, passport, i18n) { } } else { updatedInformation.setLogo(result.avatar_url) + updatedInformation.setPath(result.path) 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') res.flash("success", "Your website has been updated") diff --git a/views/DE/account/services.pug b/views/DE/account/services.pug index f1a08b61888bef7821dbfdc9e50c38172a67efc2..09d2efe5f714166f0f151ef4d8d4bf47256bc85a 100644 --- a/views/DE/account/services.pug +++ b/views/DE/account/services.pug @@ -35,6 +35,12 @@ html(lang="de") i(class="fa fa-sign-out-alt fa-fw") span(class="d-none d-md-inline") Logout 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") h3(class="pb-2") Dienste div(class="col-sm-12") @@ -54,13 +60,15 @@ html(lang="de") for item in gitlabPages - let img = item.logo - let editNewPageLink = "/account/updateInformation?id="+item.id + - let websiteURL = "https://transfer.hft-stuttgart.de/pages/"+item.path tr td img(src=img, width="45", height="45") if item.isPublished td 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 td a(href=editNewPageLink+"&s=n" class="link-dark") #{item.name} diff --git a/views/DE/account/updateInformation.pug b/views/DE/account/updateInformation.pug index c525c14c6010c0e62ff67905ddb5f7e458574f54..4641aea8f8a43dd2dcbfa3e747b2f654dae3717d 100644 --- a/views/DE/account/updateInformation.pug +++ b/views/DE/account/updateInformation.pug @@ -35,6 +35,14 @@ html(lang="de") i(class="fa fa-sign-out-alt fa-fw") span(class="d-none d-md-inline") Logout 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 div.alert.alert-success.alert-dismissible #{flash.success} a(class="close", href="#", data-dismiss="alert", aria-label="close") × @@ -51,7 +59,7 @@ html(lang="de") label(for="name", class="col-sm-2") Name div(class="col-sm-8") 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") label(for="description", class="col-sm-2") Beschreibung div(class="col-sm-8") @@ -106,21 +114,6 @@ html(lang="de") // M4_LAB script(src="/js/headfoot.js") 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() { $.post("/sendPublishRequest", {projectName: $("#name").val()}, function(resp){ alert(resp)