diff --git a/main.go b/main.go index 1891c7b..d4c0558 100644 --- a/main.go +++ b/main.go @@ -118,10 +118,16 @@ func (web Web) createQuery(c *gin.Context) { c.Redirect(http.StatusSeeOther, "/watch/new") return } + typ := c.PostForm("type") + if typ == "" { + c.Redirect(http.StatusSeeOther, "/watch/new") + return + } query_model := &Query{ URLID: uint(url_id), Name: name, + Type: typ, Query: query, } web.db.Create(query_model) diff --git a/models.go b/models.go index 153b26a..d1d7551 100644 --- a/models.go +++ b/models.go @@ -23,5 +23,6 @@ type Query struct { gorm.Model URLID uint Name string + Type string Query string } diff --git a/templates/viewWatch.html b/templates/viewWatch.html index a885618..f029334 100644 --- a/templates/viewWatch.html +++ b/templates/viewWatch.html @@ -1,87 +1,89 @@ {{define "content"}} -
- - - - - - - - - - - - {{ range .URLs }} - - - - - - - {{ range .Queries }} - - - - - - - {{ end }} - - - - - - - - - - - - - {{ end }} - - - - - - - -
-
-
-
-

{{ .Name }}

-
-
-

{{ $.Interval }}

-
-
-
-
URL NameQuery NameURL / Query-
{{ .Name }}{{ .URL }} -
- - -
-
{{ .Name }}{{ .Query }} -
- - -
-
-
- - - - - -
-
-
- - - - -
-
+
+
+
+ {{ .Name }} +
+
+ {{ $.Interval }} +
+
-{{end}} \ No newline at end of file +{{ range .URLs }} +
+
+
{{ .Name }}
+
+
+
{{ .URL }}
+
+
+
+ + + + + + + + + + + {{ range .Queries }} + + + + + + + {{ end }} + + + + + + + +
NameTypeQuery
{{ .Name }}{{ .Type }}{{ .Query }}Delete
+ + + + + + + +
+ + + + + +
+
+
+{{ end }} +
+
+
New URL
+
+
+
+
+ +
+
+ +
+ + + +
+
+
+ +{{ end }}