summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/item.go11
-rw-r--r--management/editor/editor.go10
-rw-r--r--management/manager/manager.go2
-rw-r--r--system/api/handlers.go2
4 files changed, 21 insertions, 4 deletions
diff --git a/content/item.go b/content/item.go
index e96a34e..09f0760 100644
--- a/content/item.go
+++ b/content/item.go
@@ -1,8 +1,13 @@
package content
+import "time"
+
// Item should only be embedded into content type structs.
type Item struct {
- ID int `json:"id"`
- Slug string `json:"slug"`
- Timestamp string `json:"timestamp"`
+ ID int `json:"id"`
+ Slug string `json:"slug"`
+ Time string `json:"time"`
+ Date string `json:"date"`
+ Timestamp time.Time `json:"timestamp"`
+ Updated time.Time `json:"updated"`
}
diff --git a/management/editor/editor.go b/management/editor/editor.go
index f8b1970..486c22f 100644
--- a/management/editor/editor.go
+++ b/management/editor/editor.go
@@ -87,9 +87,17 @@ func addFieldToEditorView(e *Editor, f Field) {
func addPostDefaultFieldsToEditorView(p Editable, e *Editor) {
defaults := []Field{
Field{
- View: Input("Timestamp", p, map[string]string{
+ View: Input("Date", p, map[string]string{
"label": "Publish Date",
"type": "date",
+ "class": "date __ponzu",
+ }),
+ },
+ Field{
+ View: Input("Time", p, map[string]string{
+ "label": "Publish Time",
+ "type": "time",
+ "class": "time __ponzu",
}),
},
Field{
diff --git a/management/manager/manager.go b/management/manager/manager.go
index c0056ac..75680d7 100644
--- a/management/manager/manager.go
+++ b/management/manager/manager.go
@@ -13,6 +13,8 @@ const managerHTML = `
<form method="post" action="/admin/edit" enctype="multipart/form-data">
<input type="hidden" name="id" value="{{.ID}}"/>
<input type="hidden" name="type" value="{{.Kind}}"/>
+ <input type="hidden" name="timestamp" value="" />
+ <input type="hidden" name="updated" value="" />
{{ .Editor }}
</form>
<script>
diff --git a/system/api/handlers.go b/system/api/handlers.go
index 5fb79bc..0c9139f 100644
--- a/system/api/handlers.go
+++ b/system/api/handlers.go
@@ -32,6 +32,8 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
// num := q.Get("num")
// page := q.Get("page")
+ // TODO: inplement time-based ?after=time.Time, ?before=time.Time between=time.Time|time.Time
+
if t == "" {
res.WriteHeader(http.StatusBadRequest)
return