init
This commit is contained in:
parent
c0cdb3f7ab
commit
fd966fc017
27
main.go
27
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)
|
||||
|
@ -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%; */
|
||||
|
||||
}
|
1
resources/kek/kek.tmpl
Normal file
1
resources/kek/kek.tmpl
Normal file
@ -0,0 +1 @@
|
||||
<div id="PIZDA">PIIIIIIZDA</div>
|
@ -8,11 +8,20 @@
|
||||
|
||||
{{ range $props := .allprops }}
|
||||
<div id="prop" class="Personal-properties-prop">
|
||||
<div class="Personal-properties-prop-header">
|
||||
Test Title:
|
||||
</div>
|
||||
<div class="Personal-properties-prop-content">
|
||||
{{range $prop := $props}}
|
||||
<div class="Personal-properties-prop-row">
|
||||
<div class="Personal-properties-prop-key">{{.Key}}:</div>
|
||||
<div class="Personal-properties-prop-prop">{{ .Prop }}</div>
|
||||
<div class="Personal-properties-prop-values">
|
||||
{{ range $value := .Values }}
|
||||
<div class="Personal-properties-prop-value">
|
||||
{{ $value }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
@ -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";
|
30
resources/personal-properties/personal-properties.tmpl
Normal file
30
resources/personal-properties/personal-properties.tmpl
Normal file
@ -0,0 +1,30 @@
|
||||
<div class="Personal-properties-bio">
|
||||
RIGHT FILE!!!!
|
||||
<img src="res/img/default-avatar-photo-placeholder-profile-picture-vector.jpg" style="width: 48px;height: 48px;">
|
||||
<div class="Personal-properties-textbio">
|
||||
<div>{{ .Name }}</div>
|
||||
<div>{{ .BasicBio }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ range $props := .allprops }}
|
||||
<div id="prop" class="Personal-properties-prop">
|
||||
<div class="Personal-properties-prop-header">
|
||||
Test Title:
|
||||
</div>
|
||||
<div class="Personal-properties-prop-content">
|
||||
{{range $prop := $props}}
|
||||
<div class="Personal-properties-prop-row">
|
||||
<div class="Personal-properties-prop-key">{{.Key}}:</div>
|
||||
<div class="Personal-properties-prop-values">
|
||||
{{ range $value := .Values }}
|
||||
<div class="Personal-properties-prop-value">
|
||||
{{ $value }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
@ -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:
|
||||
|
@ -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;
|
||||
|
7
templates/personal-properties/app.tmpl
Normal file
7
templates/personal-properties/app.tmpl
Normal file
@ -0,0 +1,7 @@
|
||||
{{ define "personal-properties/app.tmpl" }}
|
||||
<html><h1>
|
||||
{{ .title }}
|
||||
</h1>
|
||||
<p>Using posts/index.tmpl</p>
|
||||
</html>
|
||||
{{ end }}
|
7
templates/posts/index.tmpl
Normal file
7
templates/posts/index.tmpl
Normal file
@ -0,0 +1,7 @@
|
||||
{{ define "posts/index.tmpl" }}
|
||||
<html><h1>
|
||||
{{ .title }}
|
||||
</h1>
|
||||
<p>Using posts/index.tmpl</p>
|
||||
</html>
|
||||
{{ end }}
|
7
templates/users/index.tmpl
Normal file
7
templates/users/index.tmpl
Normal file
@ -0,0 +1,7 @@
|
||||
{{ define "users/index.tmpl" }}
|
||||
<html><h1>
|
||||
{{ .title }}
|
||||
</h1>
|
||||
<p>Using users/index.tmpl</p>
|
||||
</html>
|
||||
{{ end }}
|
@ -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{} {
|
||||
|
Loading…
Reference in New Issue
Block a user