mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 19:29:45 +02:00
add database support
This commit is contained in:
11
src/packages/Blogger/Makefile
Normal file
11
src/packages/Blogger/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
cssfiles = main.css
|
||||
|
||||
copyfiles = scheme.html package.json
|
||||
|
||||
|
||||
PKG_NAME=Blogger
|
||||
include ../pkg.mk
|
39
src/packages/Blogger/main.coffee
Normal file
39
src/packages/Blogger/main.coffee
Normal file
@ -0,0 +1,39 @@
|
||||
class Blogger extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "Blogger", args
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@tabbar = @find "tabbar"
|
||||
@containers = [
|
||||
@find("user-container"),
|
||||
@find("cv-container"),
|
||||
@find("blog-container")
|
||||
]
|
||||
@cvlist = @find "cv-list"
|
||||
@bloglist = @find "blog-list"
|
||||
@tabbar.set "onlistselect", (e) ->
|
||||
($ el).hide() for el in me.containers
|
||||
($ me.containers[e.idx]).show()
|
||||
|
||||
@tabbar.set "items", [
|
||||
{ iconclass: "fa fa-user-circle", selected: true },
|
||||
{ iconclass: "fa fa-info-circle" },
|
||||
{ iconclass: "fa fa-book" }
|
||||
]
|
||||
(@find "bt-user-save").set "onbtclick", (e) ->
|
||||
me.saveUser()
|
||||
|
||||
saveUser:() ->
|
||||
me = @
|
||||
inputs = @select "[imput-class='user-input']"
|
||||
data = {}
|
||||
data[v.name] = ($ v).val() for v in inputs
|
||||
return @notify "Full name must be entered" if not data.fullname or data.fullname is ""
|
||||
db = new @_api.DB("user")
|
||||
db.save data, (r) ->
|
||||
return me.error "Cannot save user data" if r.error
|
||||
return me.notify "User data updated"
|
||||
|
||||
Blogger.singleton = true
|
||||
this.OS.register "Blogger", Blogger
|
25
src/packages/Blogger/main.css
Normal file
25
src/packages/Blogger/main.css
Normal file
@ -0,0 +1,25 @@
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[data-id="tabbar"] {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[data-id="tabbar"] li {
|
||||
background-color: #333333;
|
||||
font-size: 20px;
|
||||
color: #929292;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[data-id="tabbar"] li.selected{
|
||||
color:white;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox[data-id="user-container"] {
|
||||
padding: 10px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox[data-id="user-container"] afx-hbox{
|
||||
margin-bottom: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox[data-id="user-container"] afx-label{
|
||||
font-weight: bold;
|
||||
}
|
13
src/packages/Blogger/package.json
Normal file
13
src/packages/Blogger/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"app":"Blogger",
|
||||
"name":"Blogging application",
|
||||
"description":"Backend manager for blogging",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.1a",
|
||||
"category":"Internet",
|
||||
"iconclass":"fa fa-book",
|
||||
"mimes":["none"]
|
||||
}
|
49
src/packages/Blogger/scheme.html
Normal file
49
src/packages/Blogger/scheme.html
Normal file
@ -0,0 +1,49 @@
|
||||
<afx-app-window data-id = "blogger-win" apptitle="MarketPlace" width="500" height="400">
|
||||
<afx-hbox >
|
||||
<afx-list-view data-id="tabbar" data-width="30"></afx-list-view>
|
||||
<afx-vbox>
|
||||
<afx-hbox data-id="user-container" data-height="grow">
|
||||
<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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</afx-hbox>
|
||||
<afx-label data-height = "30" text = "Short biblio:"/>
|
||||
<textarea rows="10" name="shortbiblio" imput-class = "user-input"/>
|
||||
<afx-hbox data-height = "30">
|
||||
<div></div>
|
||||
<afx-button iconclass = "fa fa-save" data-id = "bt-user-save" data-width="55" text = "Save"/>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-id="cv-container" data-height="grow">
|
||||
<afx-list-view data-id = "cv-list" data-width="100" ></afx-list-view>
|
||||
<afx-vbox>
|
||||
info here
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-id = "blog-container" data-height="grow">
|
||||
<afx-list-view data-id = "blog-list" data-width="100"></afx-list-view>
|
||||
<afx-vbox>
|
||||
blog here
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
Reference in New Issue
Block a user