mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 17:58:22 +01:00
improve database reading in Blogger
This commit is contained in:
parent
88a78c7eef
commit
241b8caa6b
@ -162,9 +162,11 @@ class Blogger extends this.OS.GUI.BaseApplication
|
|||||||
@bloglist.set "onlistselect", (e) ->
|
@bloglist.set "onlistselect", (e) ->
|
||||||
sel = me.bloglist.get "selected"
|
sel = me.bloglist.get "selected"
|
||||||
return unless sel
|
return unless sel
|
||||||
me.editor.value atob(sel.content)
|
me.blogdb.get Number(sel.id), (r) ->
|
||||||
me.inputtags.value = sel.tags
|
me.error "Cannot fetch the entry content" if r.error
|
||||||
(me.find "blog-publish").set "swon", (if Number(sel.publish) then true else false)
|
me.editor.value atob(r.result.content)
|
||||||
|
me.inputtags.value = r.result.tags
|
||||||
|
(me.find "blog-publish").set "swon", (if Number(r.result.publish) then true else false)
|
||||||
|
|
||||||
@.bloglist.set "onitemclose", (e) ->
|
@.bloglist.set "onitemclose", (e) ->
|
||||||
me.openDialog "YesNoDialog", (b) ->
|
me.openDialog "YesNoDialog", (b) ->
|
||||||
@ -356,13 +358,19 @@ class Blogger extends this.OS.GUI.BaseApplication
|
|||||||
cond =
|
cond =
|
||||||
order:
|
order:
|
||||||
ctime: "DESC"
|
ctime: "DESC"
|
||||||
|
fields: [
|
||||||
|
"id",
|
||||||
|
"title",
|
||||||
|
"ctimestr",
|
||||||
|
"utimestr"
|
||||||
|
]
|
||||||
@blogdb.find cond, (r) ->
|
@blogdb.find cond, (r) ->
|
||||||
return me.notify "No post found: #{r.error}" if r.error
|
return me.notify "No post found: #{r.error}" if r.error
|
||||||
|
console.log r.result
|
||||||
for v in r.result
|
for v in r.result
|
||||||
v.text = v.title
|
v.text = v.title
|
||||||
v.complex = true
|
v.complex = true
|
||||||
v.closable = true
|
v.closable = true
|
||||||
v.content = v.content.unescape()
|
|
||||||
v.detail = [
|
v.detail = [
|
||||||
{ text: "Created: #{v.ctimestr}", class: "blog-dates" },
|
{ text: "Created: #{v.ctimestr}", class: "blog-dates" },
|
||||||
{ text: "Updated: #{v.utimestr}", class: "blog-dates" }]
|
{ text: "Updated: #{v.utimestr}", class: "blog-dates" }]
|
||||||
|
Loading…
Reference in New Issue
Block a user