This commit is contained in:
Xuan Sang LE 2018-02-21 11:55:15 +01:00
parent 755a922c48
commit cbd5762d36
3 changed files with 21 additions and 3 deletions

View File

@ -18,7 +18,7 @@
<afx-label text = "To:" style="text-align:center;" data-width= "70"></afx-label> <afx-label text = "To:" style="text-align:center;" data-width= "70"></afx-label>
<input type = "text" name="end" input-class = "user-input"/> <input type = "text" name="end" input-class = "user-input"/>
</afx-hbox> </afx-hbox>
<afx-label data-height = "30" text = "Content*:" style = "margin-left:5px;"/> <afx-label data-height = "30" text = "Content:" style = "margin-left:5px;"/>
<textarea name="content" input-class = "user-input" style = "margin-left:5px; margin-right:5px;" /> <textarea name="content" input-class = "user-input" style = "margin-left:5px; margin-right:5px;" />
<afx-hbox data-height = "30"> <afx-hbox data-height = "30">
<div></div> <div></div>

View File

@ -65,7 +65,7 @@ class BloggerCVSectionDiaglog extends this.OS.GUI.BaseDialog
console.log inputs console.log inputs
data[v.name] = ($ v).val() for v in inputs data[v.name] = ($ v).val() for v in inputs
return me.notify "Title must not be blank" if data.title is "" return me.notify "Title must not be blank" if data.title is ""
return me.notify "Content must not be blank" if data.content is "" #return me.notify "Content must not be blank" if data.content is ""
data.id = me.data.id if me.data and me.data.id data.id = me.data.id if me.data and me.data.id
me.handler data if me.handler me.handler data if me.handler
me.quit() me.quit()

View File

@ -69,7 +69,8 @@ class Blogger extends this.OS.GUI.BaseApplication
me.openDialog "YesNoDialog", me.openDialog "YesNoDialog",
(d) -> (d) ->
return unless d return unless d
console.log "delete all child + theirs content" me.deleteCVCat cat
me.refreshCVCat()
, "Delete cagegory" , , "Delete cagegory" ,
{ iconclass: "fa fa-question-circle", text: "Do you really want to delete: #{cat.name} ?" } { iconclass: "fa fa-question-circle", text: "Do you really want to delete: #{cat.name} ?" }
@ -206,6 +207,23 @@ class Blogger extends this.OS.GUI.BaseApplication
#v.nodes = null if v.nodes.length is 0 #v.nodes = null if v.nodes.length is 0
data.nodes.push v data.nodes.push v
deleteCVCat: (cat) ->
me = @
ids = []
func = (c) ->
ids.push c.id
func(v) for v in c.nodes if c.nodes
func(cat)
console.log dis
return
#delete all child
@deleteCVCat v for v in cat.nodes if cat.nodes
# delete all content
@cvsecdb.delete { "=": { cid: cat.id } }, (r) ->
return me.error "Cannot delete all content of: #{cat.name} [#{r.error}]" if r.error
me.cvcatdb.delete cat.id, (re) ->
return me.error "Cannot delete the category: #{cat.name} [#{re.error}]" if re.error
CVSectionByCID: (cid) -> CVSectionByCID: (cid) ->
me = @ me = @
cond = cond =