From e82ae68634df85b06ff816525aa64a72ac9d8771 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Mon, 17 Oct 2016 15:04:29 -0700 Subject: adding partial time helper and hard coding date & time inputs --- content/item.go | 2 -- management/editor/editor.go | 28 ++++++++++++++-------------- management/manager/manager.go | 22 ++++++++++++++++------ system/admin/static/common/js/util.js | 11 +++++++++++ 4 files changed, 41 insertions(+), 22 deletions(-) diff --git a/content/item.go b/content/item.go index 09f0760..c9aa423 100644 --- a/content/item.go +++ b/content/item.go @@ -6,8 +6,6 @@ import "time" type Item struct { 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 486c22f..c7500b6 100644 --- a/management/editor/editor.go +++ b/management/editor/editor.go @@ -43,6 +43,20 @@ func Form(post Editable, fields ...Field) ([]byte, error) { // content items with Item embedded have some default fields we need to render editor.ViewBuf.Write([]byte(``)) + + publishTime := ` +
+ + +
+
+ + +
+ ` + + editor.ViewBuf.Write([]byte(publishTime)) + addPostDefaultFieldsToEditorView(post, editor) submit := ` @@ -86,20 +100,6 @@ func addFieldToEditorView(e *Editor, f Field) { func addPostDefaultFieldsToEditorView(p Editable, e *Editor) { defaults := []Field{ - Field{ - 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{ View: Input("Slug", p, map[string]string{ "label": "URL Slug", diff --git a/management/manager/manager.go b/management/manager/manager.go index 75680d7..46ee82a 100644 --- a/management/manager/manager.go +++ b/management/manager/manager.go @@ -13,15 +13,25 @@ const managerHTML = `
- - + + {{ .Editor }}
diff --git a/system/admin/static/common/js/util.js b/system/admin/static/common/js/util.js index d45d9e3..1e798d6 100644 --- a/system/admin/static/common/js/util.js +++ b/system/admin/static/common/js/util.js @@ -20,4 +20,15 @@ function replaceBadChars(text) { s = s.replace(/[\u02DC\u00A0]/g, " "); return s; +} + + +// Returns a local partial time based on unix timestamp +function getPartialTime(date) { + var parts = []; + parts.push(date.getHours()) + parts.push(date.getMinutes()) + parts.push(date.getSeconds()) + + return parts.join(":"); } \ No newline at end of file -- cgit v1.2.3