mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 11:19:47 +02:00
add shared library support
This commit is contained in:
@ -4,7 +4,7 @@ jsfiles =
|
||||
|
||||
cssfiles = main.css
|
||||
|
||||
copyfiles = scheme.html package.json
|
||||
copyfiles = scheme.html cvsection.html package.json
|
||||
|
||||
|
||||
PKG_NAME=Blogger
|
||||
|
28
src/packages/Blogger/cvsection.html
Normal file
28
src/packages/Blogger/cvsection.html
Normal file
@ -0,0 +1,28 @@
|
||||
<afx-app-window data-id = "blogger-cv-sec-win" apptitle="Porforlio section" width="450" height="400">
|
||||
<afx-vbox >
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label data-width= "70" text = "Title*:"></afx-label>
|
||||
<input type = "text" name="title" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label text = "Subtitle:" data-width= "70"></afx-label>
|
||||
<input type = "text" name="subtitle" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label text = "Location:" data-width= "70"></afx-label>
|
||||
<input type = "text" name="location" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label text = "From:" data-width= "70"></afx-label>
|
||||
<input type = "text" name="start" input-class = "user-input"/>
|
||||
<afx-label text = "To:" style="text-align:center;" data-width= "70"></afx-label>
|
||||
<input type = "text" name="end" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<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;" />
|
||||
<afx-hbox data-height = "30">
|
||||
<div></div>
|
||||
<afx-button iconclass = "fa fa-save" data-id = "bt-cv-sec-save" data-width="55" text = "Save"/>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
@ -44,4 +44,30 @@ class BloggerCategoryDialog extends this.OS.GUI.BasicDialog
|
||||
}
|
||||
|
||||
|
||||
this.OS.register "BloggerCategoryDialog", BloggerCategoryDialog
|
||||
this.OS.register "BloggerCategoryDialog", BloggerCategoryDialog
|
||||
|
||||
# This dialog is use for cv section editing
|
||||
|
||||
class BloggerCVSectionDiaglog extends this.OS.GUI.BaseDialog
|
||||
constructor: () ->
|
||||
super "BloggerCVSectionDiaglog"
|
||||
|
||||
init: () ->
|
||||
@render "#{@path()}/cvsection.html"
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", @title
|
||||
inputs = me.select "[input-class='user-input']"
|
||||
(($ v).val me.data[v.name] for v in inputs ) if me.data
|
||||
(@find "bt-cv-sec-save").set "onbtclick", (e) ->
|
||||
data = {}
|
||||
console.log 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 "Content must not be blank" if data.content is ""
|
||||
data.id = me.data.id if me.data and me.data.id
|
||||
me.handler data if me.handler
|
||||
me.quit()
|
||||
|
||||
this.OS.register "BloggerCVSectionDiaglog", BloggerCVSectionDiaglog
|
@ -13,10 +13,11 @@ class Blogger extends this.OS.GUI.BaseApplication
|
||||
@user = {}
|
||||
@cvlist = @find "cv-list"
|
||||
@cvlist.set "ontreeselect", (d) ->
|
||||
#console.log d
|
||||
me.CVSectionByCID Number(d.id)
|
||||
@bloglist = @find "blog-list"
|
||||
@userdb = new @_api.DB("user")
|
||||
@cvcatdb = new @_api.DB("cv_cat")
|
||||
@cvsecdb = new @_api.DB("cv_sections")
|
||||
@tabbar.set "onlistselect", (e) ->
|
||||
($ el).hide() for el in me.containers
|
||||
me.fetchData e.idx
|
||||
@ -56,7 +57,7 @@ class Blogger extends this.OS.GUI.BaseApplication
|
||||
name: d.value
|
||||
|
||||
me.cvcatdb.save c, (r) ->
|
||||
me.error "Cannot Edit category" if r.error
|
||||
return me.error "Cannot Edit category" if r.error
|
||||
me.refreshCVCat()
|
||||
, "Edit category", { tree: (me.cvlist.get "data"), cat: cat }
|
||||
|
||||
@ -69,6 +70,35 @@ class Blogger extends this.OS.GUI.BaseApplication
|
||||
console.log "delete all child + theirs content"
|
||||
, "Delete cagegory" ,
|
||||
{ iconclass: "fa fa-question-circle", text: "Do you really want to delete: #{cat.name} ?" }
|
||||
|
||||
(@find "cv-sec-add").set "onbtclick", (e) ->
|
||||
cat = me.cvlist.get "selectedItem"
|
||||
return me.notify "Please select a category" unless cat and cat.id isnt 0
|
||||
me.openDialog "BloggerCVSectionDiaglog", (d) ->
|
||||
d.cid = Number cat.id
|
||||
d.start = Number d.start
|
||||
d.end = Number d.end
|
||||
me.cvsecdb.save d, (r) ->
|
||||
return me.error "Cannot save section: #{r.error}" if r.error
|
||||
me.CVSectionByCID Number(cat.id)
|
||||
|
||||
, "New section entry for #{cat.name}", null
|
||||
|
||||
(@find "cv-sec-edit").set "onbtclick", (e) ->
|
||||
sec = (me.find "cv-sec-list").get "selected"
|
||||
return me.notify "Please select a section to edit" unless sec
|
||||
|
||||
me.openDialog "BloggerCVSectionDiaglog", (d) ->
|
||||
d.cid = Number sec.cid
|
||||
d.start = Number d.start
|
||||
d.end = Number d.end
|
||||
me.cvsecdb.save d, (r) ->
|
||||
return me.error "Cannot save section: #{r.error}" if r.error
|
||||
console.log d.cid
|
||||
me.CVSectionByCID Number(sec.cid)
|
||||
|
||||
, "Modify section entry", sec
|
||||
# USER TAB
|
||||
fetchData: (idx) ->
|
||||
me = @
|
||||
switch idx
|
||||
@ -77,13 +107,25 @@ class Blogger extends this.OS.GUI.BaseApplication
|
||||
@userdb.get null, (d) ->
|
||||
return me.error "Cannot fetch user data" if d.error
|
||||
me.user = d.result[0]
|
||||
inputs = me.select "[imput-class='user-input']"
|
||||
inputs = me.select "[input-class='user-input']"
|
||||
($ v).val me.user[v.name] for v in inputs
|
||||
when 1 # category
|
||||
@refreshCVCat()
|
||||
else
|
||||
console.log "Not implemented yet"
|
||||
|
||||
saveUser:() ->
|
||||
me = @
|
||||
inputs = @select "[input-class='user-input']"
|
||||
@user[v.name] = ($ v).val() for v in inputs
|
||||
return @notify "Full name must be entered" if not @user.fullname or @user.fullname is ""
|
||||
#console.log @user
|
||||
@userdb.save @user, (r) ->
|
||||
return me.error "Cannot save user data" if r.error
|
||||
return me.notify "User data updated"
|
||||
|
||||
|
||||
# PORFOLIO TAB
|
||||
refreshCVCat: () ->
|
||||
me = @
|
||||
data =
|
||||
@ -91,11 +133,13 @@ class Blogger extends this.OS.GUI.BaseApplication
|
||||
id:0,
|
||||
nodes: []
|
||||
@cvcatdb.get null, (d) ->
|
||||
return me.notify "Cannot fetch CV categories" if d.error
|
||||
if d.error
|
||||
me.cvlist.set "data", data
|
||||
return me.notify "Cannot fetch CV categories"
|
||||
me.fetchCVCat d.result, data, "0"
|
||||
me.cvlist.set "data", data
|
||||
it = (me.cvlist.find "pid", "2")[0]
|
||||
me.cvlist.set "selectedItem", it
|
||||
#it = (me.cvlist.find "pid", "2")[0]
|
||||
#me.cvlist.set "selectedItem", it
|
||||
|
||||
fetchCVCat: (table, data, id) ->
|
||||
result = (v for v in table when v.pid is id)
|
||||
@ -105,17 +149,39 @@ class Blogger extends this.OS.GUI.BaseApplication
|
||||
@fetchCVCat table, v, v.id
|
||||
#v.nodes = null if v.nodes.length is 0
|
||||
data.nodes.push v
|
||||
|
||||
|
||||
saveUser:() ->
|
||||
CVSectionByCID: (cid) ->
|
||||
me = @
|
||||
inputs = @select "[imput-class='user-input']"
|
||||
@user[v.name] = ($ v).val() for v in inputs
|
||||
return @notify "Full name must be entered" if not @user.fullname or @user.fullname is ""
|
||||
#console.log @user
|
||||
@userdb.save @user, (r) ->
|
||||
return me.error "Cannot save user data" if r.error
|
||||
return me.notify "User data updated"
|
||||
@cvsecdb.find "cid=#{cid} ORDER BY start DESC", (d) ->
|
||||
return me.notify "Section list is empty, please add one" if d.error
|
||||
v.text = v.title for v in d.result
|
||||
items = []
|
||||
$(me.find "cv-sec-status").html "Found #{d.result.length} sections"
|
||||
for v in d.result
|
||||
v.text = v.title
|
||||
v.complex = true
|
||||
v.start = Number(v.start)
|
||||
v.end = Number(v.end)
|
||||
v.detail = []
|
||||
v.detail.push { text: v.subtitle, class: "cv-subtitle" } if v.subtitle isnt ""
|
||||
v.detail.push { text: "#{v.start} - #{v.end}", class: "cv-period" } if v.start isnt 0 and v.end isnt 0
|
||||
v.detail.push { text: v.location, class: "cv-loc" } if v.location isnt ""
|
||||
#v.detail.push { text: v.end } if v.end isnt 0
|
||||
v.closable = true
|
||||
v.detail.push { text: v.content, class: "cv-content" }
|
||||
items.push v
|
||||
el = me.find "cv-sec-list"
|
||||
el.set "onitemclose", (e) ->
|
||||
d = me.openDialog "YesNoDialog", (b) ->
|
||||
return unless b
|
||||
me.cvsecdb.delete e.item.item.id, (r) ->
|
||||
return me.error "Cannot delete the section: #{r.error}" if r.error
|
||||
el.remove e.item.item, true
|
||||
, "Delete section" ,
|
||||
{ iconclass: "fa fa-question-circle", text: "Do you really want to delete: #{e.item.item.text} ?" }
|
||||
return false
|
||||
el.set "items", items
|
||||
|
||||
Blogger.singleton = true
|
||||
Blogger.dependencies = [ "mde/simplemde.min" ]
|
||||
this.OS.register "Blogger", Blogger
|
@ -40,3 +40,35 @@ afx-app-window[data-id="blogger-win"] afx-hbox[data-id="cv-container"] afx-labe
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-cv-sec-win"] afx-hbox{
|
||||
padding:5px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul > li{
|
||||
padding-bottom: 10px;
|
||||
padding-top:10px;
|
||||
/*border-bottom: 1px solid #cbcbcb;*/
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul afx-label{
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul > li.selected {
|
||||
border: 2px solid #cbcbcb;
|
||||
color: #414339;
|
||||
background-color: transparent;
|
||||
border-radius: 5px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] .cv-content{
|
||||
text-align: justify;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] .cv-period, .cv-loc{
|
||||
text-align: right;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] .cv-subtitle{
|
||||
font-style: italic;
|
||||
float:left;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] i.closable::before{
|
||||
content: "\f014";
|
||||
font-size: 15px;
|
||||
}
|
@ -6,26 +6,26 @@
|
||||
<afx-vbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label data-width= "70" text = "Full name:"></afx-label>
|
||||
<input type = "text" name="fullname" imput-class = "user-input"/>
|
||||
<input type = "text" name="fullname" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "Address:" data-width= "70"></afx-label>
|
||||
<input type = "text" name="address" imput-class = "user-input"/>
|
||||
<input type = "text" name="address" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "Phone:" data-width= "70"></afx-label>
|
||||
<input type = "text" name="Phone" imput-class = "user-input"/>
|
||||
<input type = "text" name="Phone" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "Email:" data-width= "70"></afx-label>
|
||||
<input type = "text" name="email" imput-class = "user-input"/>
|
||||
<input type = "text" name="email" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "Url:" data-width= "70"></afx-label>
|
||||
<input type = "text" name="url" imput-class = "user-input"/>
|
||||
<input type = "text" name="url" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-label data-height = "30" text = "Short biblio:"/>
|
||||
<textarea name="shortbiblio" imput-class = "user-input"/>
|
||||
<textarea name="shortbiblio" input-class = "user-input"/>
|
||||
<afx-hbox data-height = "35">
|
||||
<div></div>
|
||||
<afx-button iconclass = "fa fa-save" data-id = "bt-user-save" data-width="55" text = "Save"/>
|
||||
@ -44,7 +44,12 @@
|
||||
</afx-vbox>
|
||||
<afx-resizer data-width = "3"/>
|
||||
<afx-vbox>
|
||||
info here
|
||||
<afx-list-view data-id = "cv-sec-list" ></afx-list-view>
|
||||
<afx-hbox data-height="30" class = "cv-side-bar-btn">
|
||||
<div data-id = "cv-sec-status"></div>
|
||||
<afx-button data-id = "cv-sec-add" data-width = "25" text = "" iconclass = "fa fa-plus-circle"></afx-button>
|
||||
<afx-button data-id = "cv-sec-edit" data-width = "25" text = "" iconclass = "fa fa-pencil-square-o"></afx-button>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-id = "blog-container" data-height="100%">
|
||||
|
Reference in New Issue
Block a user