From fd966fc017ee2e167fbf3ba30f9456bd4395d1ac Mon Sep 17 00:00:00 2001 From: Gregory Brzezinski Date: Fri, 17 Mar 2023 19:13:41 +0300 Subject: [PATCH] init --- main.go | 27 +++++++++-- resources/base.css | 29 ++++++++--- resources/kek/kek.tmpl | 1 + resources/personal-properties.html | 11 ++++- .../personal-properies.css | 0 .../personal-properties.js | 4 +- .../personal-properties.tmpl | 30 ++++++++++++ resources/wde.js | 14 ++++-- resources/wdeUI.css | 9 ++-- templates/personal-properties/app.tmpl | 7 +++ templates/posts/index.tmpl | 7 +++ templates/users/index.tmpl | 7 +++ websiteapp/personalprops/personalprops.go | 48 ++++++++++--------- 13 files changed, 148 insertions(+), 46 deletions(-) create mode 100644 resources/kek/kek.tmpl rename resources/{applications => }/personal-properties/personal-properies.css (100%) rename resources/{applications => }/personal-properties/personal-properties.js (80%) create mode 100644 resources/personal-properties/personal-properties.tmpl create mode 100644 templates/personal-properties/app.tmpl create mode 100644 templates/posts/index.tmpl create mode 100644 templates/users/index.tmpl diff --git a/main.go b/main.go index 30f8f82..eb0cfa1 100644 --- a/main.go +++ b/main.go @@ -11,11 +11,27 @@ import ( "github.com/gin-gonic/gin" ) +// func main() { +// router := gin.Default() +// router.LoadHTMLGlob("templates/**/*") +// router.GET("/posts/index", func(c *gin.Context) { +// c.HTML(http.StatusOK, "posts/index.tmpl", gin.H{ +// "title": "Posts", +// }) +// }) +// router.GET("/users/index", func(c *gin.Context) { +// c.HTML(http.StatusOK, "users/index.tmpl", gin.H{ +// "title": "Users", +// }) +// }) +// router.Run(":8080") +// } + func main() { - // hostUrl := "http://192.168.88.10:8080/" + // hostUrl := "http://localhost:8080/" router := gin.New() // router.Use(rateLimit, gin.Recovery()) - router.LoadHTMLGlob("resources/*.html") + router.LoadHTMLGlob("templates/**/*") // router.Static("/static", "resources/static") router.Static("/res", "resources") @@ -49,7 +65,7 @@ func main() { case "getmanifest": ctx.JSON(http.StatusOK, app.GetManifest()) case "gethtml": - ctx.HTML(http.StatusOK, appId+".html", nil) + ctx.HTML(http.StatusOK, "resources/"+appId+"/"+appId+".tmpl", nil) case "app.js": ctx.File("resources/applications/" + appId + "/" + appId + ".js") case "app.css": @@ -73,11 +89,14 @@ func main() { { persPropApp.GET("getcontent", func(ctx *gin.Context) { - ctx.HTML(http.StatusOK, "personal-properties.html", persPropsApp.Render()) + ctx.HTML(http.StatusOK, "personal-properties/app.tmpl", persPropsApp.Render()) }) } } + router.GET("/test", func(ctx *gin.Context) { + ctx.HTML(200, "kek/kek.tmpl", gin.H{}) + }) // router.GET("/room/:roomid", roomGET) // router.POST("/room-post/:roomid", roomPOST) // router.GET("/stream/:roomid", streamRoom) diff --git a/resources/base.css b/resources/base.css index bb02687..ad1de5d 100644 --- a/resources/base.css +++ b/resources/base.css @@ -66,10 +66,12 @@ body{ .WindowFrameTitle{ + pointer-events: none; white-space: nowrap } .WindowDragArea{ + pointer-events: none; /* background-color: antiquewhite; */ width: 100%; height: 100%; @@ -90,14 +92,14 @@ body{ flex-direction: column; align-items: center; padding: 12px; - gap:10px; + gap:16px; width: 100%; height: 100%; background: #DDDDDD; border: 1px solid #000000; - box-shadow: 0.5px 0.5px 0px 0.5px #FFFFFF, -0.5px -0.5px 0px 0.5px rgba(0, 0, 0, 0.25), inset 1px 1px 0px #FFFFFF; + box-shadow: 0.5px 0.5px 0px 0.5px #FFFFFF, -0.5px -0.5px 0px 0.5px rgba(0, 0, 0, 0.25), inset 1px 1px 0px #FFFFFF; /* Inside auto layout */ @@ -119,6 +121,8 @@ body{ gap:15px; } + + .Personal-properties-textbio{ /* width: 100%; height: auto; */ @@ -155,16 +159,17 @@ body{ display: inline-block; max-width: 100%; background-color: #DDDDDD; - left: 12px; - top: -10px; + /* left: 12px; */ + right: 30%; + top: -12px; margin-left: 2px; /* Auto layout */ - display: flex; + /* display: flex; flex-direction: column; align-items: center; padding: 12px; - gap:10px; + gap:10px; */ /* padding: 10px; */ /* border: 1px solid #888888; */ @@ -198,7 +203,17 @@ body{ white-space: nowrap /* font-weight: bold; */ } -.Personal-properties-prop-prop{ +.Personal-properties-prop-values{ width: 55%; + display: flex; + flex-direction: column; + justify-content: left; + padding: 0px; + gap: 5px; + +} + +.Personal-properties-prop-value{ + /* width: 55%; */ } \ No newline at end of file diff --git a/resources/kek/kek.tmpl b/resources/kek/kek.tmpl new file mode 100644 index 0000000..d5f836a --- /dev/null +++ b/resources/kek/kek.tmpl @@ -0,0 +1 @@ +
PIIIIIIZDA
\ No newline at end of file diff --git a/resources/personal-properties.html b/resources/personal-properties.html index 138a686..308119c 100644 --- a/resources/personal-properties.html +++ b/resources/personal-properties.html @@ -8,11 +8,20 @@ {{ range $props := .allprops }}
+
+ Test Title: +
{{range $prop := $props}}
{{.Key}}:
-
{{ .Prop }}
+
+ {{ range $value := .Values }} +
+ {{ $value }} +
+ {{ end }} +
{{ end }}
diff --git a/resources/applications/personal-properties/personal-properies.css b/resources/personal-properties/personal-properies.css similarity index 100% rename from resources/applications/personal-properties/personal-properies.css rename to resources/personal-properties/personal-properies.css diff --git a/resources/applications/personal-properties/personal-properties.js b/resources/personal-properties/personal-properties.js similarity index 80% rename from resources/applications/personal-properties/personal-properties.js rename to resources/personal-properties/personal-properties.js index 720c2ff..dc50706 100644 --- a/resources/applications/personal-properties/personal-properties.js +++ b/resources/personal-properties/personal-properties.js @@ -13,7 +13,7 @@ class PersonalProperties{ this.appElem.innerHTML = WebDesktopEnvironment.GetBasicWindow() let contentFrame = this.appElem.children[0].children[0].children[1] - fetch("http://192.168.88.10:8080/application/personal-properties/getcontent") //TODO Move to wde func + fetch("http://localhost:8080/application/personal-properties/getcontent") //TODO Move to wde func .then((response) => response.text()) .then((html) => { contentFrame.innerHTML = html @@ -23,7 +23,7 @@ class PersonalProperties{ }); // var link = document.createElement( "link" ); - // link.href = "http://192.168.88.10:8080/system/applications/personal-properties/app.css" + // link.href = "http://localhost:8080/system/applications/personal-properties/app.css" // link.type = "text/css"; // link.rel = "stylesheet"; // link.media = "screen,print"; diff --git a/resources/personal-properties/personal-properties.tmpl b/resources/personal-properties/personal-properties.tmpl new file mode 100644 index 0000000..1f0ce1e --- /dev/null +++ b/resources/personal-properties/personal-properties.tmpl @@ -0,0 +1,30 @@ +
+ RIGHT FILE!!!! + +
+
{{ .Name }}
+
{{ .BasicBio }}
+
+
+ +{{ range $props := .allprops }} +
+
+ Test Title: +
+
+ {{range $prop := $props}} +
+
{{.Key}}:
+
+ {{ range $value := .Values }} +
+ {{ $value }} +
+ {{ end }} +
+
+ {{ end }} +
+
+{{ end }} diff --git a/resources/wde.js b/resources/wde.js index a4844e5..8fe89d6 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -1,15 +1,13 @@ document.addEventListener('DOMContentLoaded', function() { wde = new WebDesktopEnvironment - }, false); class WebDesktopEnvironment{ - constructor(){ this.wc = new WindowsCompositor //Get basic window ready frame - fetch("http://192.168.88.10:8080/system/wde/getbasicwindow") //TODO Move to wde func + fetch("http://localhost:8080/system/wde/getbasicwindow") //TODO Move to wde func .then((response) => response.text()) .then((html) => { WebDesktopEnvironment.SetBasicWindow(html) @@ -27,10 +25,15 @@ class WebDesktopEnvironment{ loadApp(appId){ let newApp = document.createElement("application") newApp.setAttribute("id", `application-${appId}`) + newApp.style.display = "inline" //TODO Make multi-window support + newApp.style.position = "absolute" + newApp.style.width = "350px" + newApp.styleheight = "350px" let appElem = document.getElementById("WindowsLayer").appendChild(newApp) + let script = document.createElement("script") - script.setAttribute("src", "http://192.168.88.10:8080/system/applications/personal-properties/app.js") + script.setAttribute("src", "http://localhost:8080/system/applications/personal-properties/app.js") script.setAttribute("async", "false") appElem.appendChild(script) script.addEventListener("load", function () { @@ -101,8 +104,9 @@ class WindowsCompositor{ * @param {MouseEvent} event */ catchClick(event){ + switch (true) { - case event.target.className == "TestWindowHeader": + case event.target.className == "WindowFrameTopBar": this.movingElement = event.target.parentElement.parentElement.parentElement break; default: diff --git a/resources/wdeUI.css b/resources/wdeUI.css index 924f12a..2e999ef 100644 --- a/resources/wdeUI.css +++ b/resources/wdeUI.css @@ -1,17 +1,16 @@ -.WindowFrameTopBarButton{ +.WindowFrameTopBarButton{ width: 11px; height: 11px; padding: 0%; - background: #D9D9D9; + background: linear-gradient(135deg, #999999 18.18%, #FFFFFF 81.82%); border: 1px solid #222222; box-shadow: 0.5px 0.5px 0px 0.5px #FFFFFF, -0.5px -0.5px 0px 0.5px rgba(0, 0, 0, 0.25), - inset 1px 1px 0px #FFFFFF, - inset -1px -1px 0px rgba(0, 0, 0, 0.25); + inset 1px 1px 0px rgba(255, 255, 255, 0.5), + inset -1px -1px 0px rgba(0, 0, 0, 0.27); /* Inside auto layout */ - flex: none; order: 0; flex-grow: 0; diff --git a/templates/personal-properties/app.tmpl b/templates/personal-properties/app.tmpl new file mode 100644 index 0000000..fc029ef --- /dev/null +++ b/templates/personal-properties/app.tmpl @@ -0,0 +1,7 @@ +{{ define "personal-properties/app.tmpl" }} +

+ {{ .title }} +

+

Using posts/index.tmpl

+ +{{ end }} \ No newline at end of file diff --git a/templates/posts/index.tmpl b/templates/posts/index.tmpl new file mode 100644 index 0000000..88f493d --- /dev/null +++ b/templates/posts/index.tmpl @@ -0,0 +1,7 @@ +{{ define "posts/index.tmpl" }} +

+ {{ .title }} +

+

Using posts/index.tmpl

+ +{{ end }} \ No newline at end of file diff --git a/templates/users/index.tmpl b/templates/users/index.tmpl new file mode 100644 index 0000000..1d76b6e --- /dev/null +++ b/templates/users/index.tmpl @@ -0,0 +1,7 @@ +{{ define "users/index.tmpl" }} +

+ {{ .title }} +

+

Using users/index.tmpl

+ +{{ end }} \ No newline at end of file diff --git a/websiteapp/personalprops/personalprops.go b/websiteapp/personalprops/personalprops.go index f17d72a..5e48121 100644 --- a/websiteapp/personalprops/personalprops.go +++ b/websiteapp/personalprops/personalprops.go @@ -37,33 +37,37 @@ func (p *PersonalPropertiesApp) Render() gin.H { // Title: "Title 2", // Author: "Author 2", // }) - allProps := make([][]Prop, 0) + allProps := make([][]PropElement, 0) - basicInfo := make([]Prop, 0) + basicInfo := make([]PropElement, 0) - basicInfo = append(basicInfo, Prop{ - Key: "", - Prop: "Greg Brzezinski", + basicInfo = append(basicInfo, PropElement{ + Key: "", + Values: []string{"Greg Brzezinski"}, }) - basicInfo = append(basicInfo, Prop{ - Key: "", - Prop: "Saint-Petersburg", + basicInfo = append(basicInfo, PropElement{ + Key: "", + Values: []string{"Saint-Petersburg"}, }) // careerkeys := make([]Prop, 0) - careerkeys := []Prop{ + careerkeys := []PropElement{ { - Key: "VR lab assistant", - Prop: "111", + Key: "VR lab assistant", + Values: []string{"February 2019 - March 2020", "Teaching lessons for students in Unreal Engine 4, Unity and Blender editor courses", "Training students for World Skills Russia"}, }, { - Key: "3d artist", - Prop: "qweqwe", + Key: "3d artist", + Values: []string{"March 2020 - June 2020", "Creating 3d assets for VR game"}, }, { - Key: "Jr. Techartist", - Prop: "qweqwaaae", + Key: "Jr. Techartist", + Values: []string{"Game content integration and production", "Shader coding", "Optimization asset production in artists pipeline"}, + }, + { + Key: "Techartist", + Values: []string{"Game content optimization and production", "Profiling and debugging render pipeline", "Creating in-house tools for pipeline software", "Working process pipeline integration and maintenance", "Linux servers administration"}, }, } // careerkeys = append(careerkeys, Prop{ @@ -75,10 +79,10 @@ func (p *PersonalPropertiesApp) Render() gin.H { // Prop: "qweqwe", // }) // careerkeys = append(careerkeys, Prop{}) - testKeys := []Prop{} - testKeys = append(testKeys, Prop{ - Key: "Urrtt", - Prop: "BakaBaka", + testKeys := []PropElement{} + testKeys = append(testKeys, PropElement{ + Key: "Urrtt", + Values: []string{"BakaBaka"}, }) allProps = append(allProps, careerkeys, testKeys, testKeys, testKeys) @@ -97,9 +101,9 @@ type Book struct { Author string } -type Prop struct { - Key string - Prop string +type PropElement struct { + Key string + Values []string } // func (p *PersonalPropertiesApp) GetContent(ctx *gin.Context) interface{} {