From f60fbdd97aec5d0b98fcf5de40b61c91d755c14d Mon Sep 17 00:00:00 2001
From: Rosanny <rosanny.sihombing@hft-stuttgart.de>
Date: Thu, 11 Feb 2021 18:59:31 +0100
Subject: [PATCH] add a new page

---
 views/DE/account/updateInformation.pug | 118 +++++++++++++++++++++++++
 1 file changed, 118 insertions(+)
 create mode 100644 views/DE/account/updateInformation.pug

diff --git a/views/DE/account/updateInformation.pug b/views/DE/account/updateInformation.pug
new file mode 100644
index 00000000..dbf7d5c9
--- /dev/null
+++ b/views/DE/account/updateInformation.pug
@@ -0,0 +1,118 @@
+doctype html
+html(lang="de")
+  head
+    title= "Update a website"
+    meta(charset="UTF-8")
+    meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no")
+    link(rel="stylesheet", type="text/css", href="https://m4lab.hft-stuttgart.de/css/bootstrap.min.css")
+    link(rel="stylesheet", type="text/css", href="https://m4lab.hft-stuttgart.de/css/m4lab.css")
+    link(rel="stylesheet", href="https://use.fontawesome.com/releases/v5.8.2/css/all.css", integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay", crossorigin="anonymous")
+  body
+    div(class="container")
+        div(class="row min-vh-100 flex-column flex-md-row")
+            aside(class="col-12 col-md-3 p-0 flex-shrink-1")
+                nav(class="navbar navbar-expand flex-md-column flex-row align-items-start py-2")
+                    div(class="collapse navbar-collapse")
+                        ul(class="flex-md-column flex-row navbar-nav w-100 justify-content-between")
+                            li(class="nav-item")
+                                a(class="nav-link pl-0 text-nowrap" href="/account/")
+                                    span(class="font-weight-bold" style="color:black;") #{user.fullName}
+                            li(class="nav-item")
+                                a(class="nav-link pl-0" href="/account/profile")
+                                    i(class="fa fa-user fa-fw")
+                                    span(class="d-none d-md-inline") Benutzerprofil
+                            if user.m4lab_idp == 1
+                                li(class="nav-item")
+                                    a(class="nav-link pl-0" href="/account/security")
+                                        i(class="fa fa-lock fa-fw")
+                                        span(class="d-none d-md-inline") Sicherheitseinstellungen
+                            li(class="nav-item")
+                                a(class="nav-link pl-0" href="/account/services")
+                                    i(class="fa fa-tasks fa-fw" style="color:black;")
+                                    span(class="d-none d-md-inline" style="color:black;") Projekte und Dienste
+                            li(class="nav-item")
+                                a(class="nav-link pl-0" href="/logout" style="color:red;")
+                                    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")
+                if flash.success
+                    div.alert.alert-success.alert-dismissible #{flash.success}
+                        a(class="close", href="#", data-dismiss="alert", aria-label="close") &times;
+                if flash.error
+                    div.alert.alert-danger.alert-dismissible.fade.show #{flash.error}
+                        a(class="close", href="#", data-dismiss="alert", aria-label="close") &times;
+                h3(class="pb-2") Update Information
+                div(class="mx-4")
+                    if !information.isPublished
+                        h4(class="pb-1") Step 1: Setup
+                        p Please fill-in all fields
+                    form(method="POST", encType="multipart/form-data")
+                        div(class='form-group row')
+                            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>your website will be published on this URL: <strong>https://transfer.hft-stuttgart.de/pages/<span id="websiteName"></span></strong></small></p>
+                        div(class="form-group row")
+                            label(for="description", class="col-sm-2") Description
+                            div(class="col-sm-8")
+                                textarea#description(name="description", type="text", class="form-control", placeholder="Description", maxlength="500" required) #{information.desc}
+                        div(class="form-group row")    
+                            label(for="logo", class="col-sm-2") Logo
+                            div(class="col-sm-8")
+                                div(class="form-group row")
+                                    img(src=information.logo, width="100" height="100")
+                                div(class="form-group row")
+                                    input#logo(name="logo", class="form-control-file", type="file")
+                        input(type="submit", class="btn btn-primary", value="Update")
+                hr
+                div(class="mx-4")
+                    if !information.isPublished
+                        h4(class="pb-1") Step 2: Complete
+                        p Please make sure you have completed the following before you publish your website.
+                        ul
+                            li project name, link, logo: <a href=#{information.settingUrl} target="_blank">setting.js</a>
+                            li contact person: <a href=#{information.kontaktUrl} target="_blank">kontakt.html</a>
+                    else    
+                        p NOTE:
+                        ul
+                            li Some parameters(?) can be updated here: <a href=#{information.settingUrl} target="_blank">setting.js</a>
+                            li and the Contact Person here: <a href=#{information.kontaktUrl} target="_blank">kontakt.html</a>
+                hr
+                div(class="mx-4")
+                    if !information.isPublished
+                        h4(class="pb-1") Step 3: Publish
+                        p The following request email will be sent to the Transferportal Admin to publish your new website/information:
+                        table(class="table-secondary")
+                            tr
+                                td Guten Tag, <br><br> hiermit beantrage Ich die Freischaltung einer Webseite auf dem Transferportal für folgendes Projekt:<br>#{information.name}<br><br>Vielen Dank,<br> #{user.fullName}
+                        br
+                        button(type="button", class="btn btn-primary", onclick="sendPublishRequest()") Send Request
+
+    // jQuery
+    script(src="https://code.jquery.com/jquery-3.3.1.min.js")
+    script(src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js", integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1", crossorigin="anonymous")
+    // Bootstrap
+    script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous")
+    // 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)
+            })
+        }
\ No newline at end of file
-- 
GitLab