summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorSteve <nilslice@gmail.com>2017-04-03 19:48:27 -0400
committerGitHub <noreply@github.com>2017-04-03 19:48:27 -0400
commitb3369892b96c38bdbbcb38346de248af2a145e96 (patch)
tree2838d2403f3bae3c31d57ae236f47340897c150a /system
parentb2fa4a895dea4212806c97c434119e73560e25cd (diff)
parentfaf4c67abcc5211e7b5ff45e908fa8a787bdaff2 (diff)
Merge pull request #108 from ponzu-cms/ponzu-dev
[core] better sort ordering and more reliable content API results
Diffstat (limited to 'system')
-rw-r--r--system/admin/handlers.go9
-rw-r--r--system/db/content.go4
2 files changed, 9 insertions, 4 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index a585faa..c2d67e9 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -941,8 +941,13 @@ func contentsHandler(res http.ResponseWriter, req *http.Request) {
var path = window.location.pathname;
var s = sort.val();
var t = getParam('type');
+ var status = getParam('status');
- window.location.replace(path + '?type=' + t + '&order=' + s)
+ if (status == "") {
+ status = "public";
+ }
+
+ window.location.replace(path + '?type=' + t + '&order=' + s + '&status=' + status);
});
var order = getParam('order');
@@ -1531,7 +1536,7 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
// create a timestamp if one was not set
if ts == "" {
- ts = fmt.Sprintf("%d", int64(time.Nanosecond)*time.Now().UnixNano()/int64(time.Millisecond))
+ ts = fmt.Sprintf("%d", int64(time.Nanosecond)*time.Now().UTC().UnixNano()/int64(time.Millisecond))
req.PostForm.Set("timestamp", ts)
}
diff --git a/system/db/content.go b/system/db/content.go
index 685ac13..4de9342 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -570,9 +570,9 @@ func SortContent(namespace string) {
return err
}
- // encode to json and store as 'i:post.Time()':post
+ // encode to json and store as 'post.Time():i':post
for i := range bb {
- cid := fmt.Sprintf("%d:%d", i, posts[i].Time())
+ cid := fmt.Sprintf("%d:%d", posts[i].Time(), i)
err = b.Put([]byte(cid), bb[i])
if err != nil {
return err