First working version
This commit is contained in:
parent
e341b3fd8d
commit
6603399d96
3 changed files with 4 additions and 45 deletions
16
main.go
16
main.go
|
@ -11,10 +11,11 @@ func NewApp() *gin.Engine {
|
|||
|
||||
r := gin.Default()
|
||||
|
||||
r.LoadHTMLGlob("templates/*.tmpl")
|
||||
r.LoadHTMLGlob("templates/index.tmpl")
|
||||
r.Static("/static", "./static")
|
||||
|
||||
r.GET("/", func(c *gin.Context) {
|
||||
c.HTML(200, "index.tmpl", gin.H{
|
||||
c.HTML(200, "users/index.tmpl", gin.H{
|
||||
"pubTo": "Users",
|
||||
})
|
||||
})
|
||||
|
@ -31,17 +32,6 @@ func NewApp() *gin.Engine {
|
|||
c.String(403, "")
|
||||
})
|
||||
|
||||
// Get user value
|
||||
r.GET("/user/:name", func(c *gin.Context) {
|
||||
user := c.Params.ByName("name")
|
||||
value, ok := DB[user]
|
||||
if ok {
|
||||
c.JSON(200, gin.H{"user": user, "value": value})
|
||||
} else {
|
||||
c.JSON(200, gin.H{"user": user, "status": "no value"})
|
||||
}
|
||||
})
|
||||
|
||||
return r
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Hacker Slides</title>
|
||||
|
||||
<link rel="stylesheet" href="/static/css/index.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="edit-pane">
|
||||
<div id="controls">
|
||||
<a href="{{ publishing_root }}" target="_blank" onclick="save();"> Present</a>
|
||||
</div>
|
||||
<div id="editor"></div>
|
||||
</div>
|
||||
|
||||
<div id="preview">
|
||||
<iframe id="slides-frame" src="/static/slides.html?preview"></iframe>
|
||||
</div>
|
||||
|
||||
<script src="/static/revealjs/js/ace-1.1.8/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/revealjs/js/jquery-2.1.3.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/revealjs/js/jquery-debounce-1.0.5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/js/save.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="/static/js/index.js" type="text/javascript" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -14,11 +14,10 @@
|
|||
<body>
|
||||
<div id="edit-pane">
|
||||
<div id="controls">
|
||||
<a href="{{ .pubTo }}" target="_blank" onclick="save();"> Present</a>
|
||||
<a href="" target="_blank" onclick="save();"> Present</a>
|
||||
</div>
|
||||
<div id="editor"></div>
|
||||
</div>
|
||||
|
||||
<div id="preview">
|
||||
<iframe id="slides-frame" src="/static/slides.html?preview"></iframe>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue