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

add path and breadcrumb

parent 3a75a617
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
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
......
......@@ -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")
......
......@@ -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}
......
......@@ -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") &times;
......@@ -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)
......
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