mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 03:09:45 +02:00
afx-list-view now can add action buttons
This commit is contained in:
@ -22,23 +22,33 @@ class RepositoryDialog extends this.OS.GUI.BaseDialog
|
||||
me.refreshList()
|
||||
, __("Edit repository"), { label: __("Format : [name] url"), value: "[#{e.data.text}] #{e.data.url}" }
|
||||
|
||||
(@find "btadd").set "onbtclick", (e) ->
|
||||
me.openDialog "PromptDialog", (e) ->
|
||||
m = e.match /\[([^\]]*)\]\s*(.*)/
|
||||
return me.error __("Wrong format: it should be [name] url") if not m or m.length isnt 3
|
||||
me.systemsetting.system.repositories.push {
|
||||
name: m[1],
|
||||
url: m[2],
|
||||
text: m[1],
|
||||
i: me.systemsetting.system.repositories.length
|
||||
}
|
||||
me.refreshList()
|
||||
, __("Add repository"), { label: __("Format : [name] url") }
|
||||
(@find "btdel").set "onbtclick", (e) ->
|
||||
selidx = me.list.get "selidx"
|
||||
return unless selidx >= 0
|
||||
me.systemsetting.system.repositories.splice selidx, selidx
|
||||
me.refreshList()
|
||||
@list.set "buttons", [
|
||||
{
|
||||
text: "+",
|
||||
onbtclick: () ->
|
||||
me.openDialog "PromptDialog", (e) ->
|
||||
m = e.match /\[([^\]]*)\]\s*(.*)/
|
||||
return me.error __("Wrong format: it should be [name] url") if not m or m.length isnt 3
|
||||
me.systemsetting.system.repositories.push {
|
||||
name: m[1],
|
||||
url: m[2],
|
||||
text: m[1],
|
||||
i: me.systemsetting.system.repositories.length
|
||||
}
|
||||
me.refreshList()
|
||||
, __("Add repository"), { label: __("Format : [name] url") }
|
||||
},
|
||||
{
|
||||
text: "-",
|
||||
onbtclick: () ->
|
||||
selidx = me.list.get "selidx"
|
||||
return unless selidx >= 0
|
||||
me.systemsetting.system.repositories.splice selidx, selidx
|
||||
me.refreshList()
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
(@find "btquit").set "onbtclick", (e) -> me.quit()
|
||||
@refreshList()
|
||||
refreshList: () ->
|
||||
@ -57,12 +67,9 @@ RepositoryDialog.scheme = """
|
||||
<afx-app-window data-id = "repository-dialog-win" apptitle="__(Repositories)" width="250" height="250">
|
||||
<afx-vbox >
|
||||
<afx-list-view data-id="repo-list"></afx-list-view>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-button data-id = "btadd" text = "[+]" data-width="30"></afx-button>
|
||||
<afx-button data-id = "btdel" text = "[-]" data-width="30"></afx-button>
|
||||
<div></div>
|
||||
<afx-button data-id = "btquit" text = "__(Cancel)" data-width="50"></afx-button>
|
||||
</afx-hbox>
|
||||
<div style = "text-align:right; padding:5px" data-height="30" >
|
||||
<afx-button data-id = "btquit" text = "__(Cancel)"></afx-button>
|
||||
</div>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
||||
"""
|
||||
|
@ -60,4 +60,8 @@ afx-app-window[data-id="marketplace-win"] ul[data-id='app-detail'] span{
|
||||
}
|
||||
afx-app-window[data-id="marketplace-win"] span.info-header{
|
||||
font-weight: bold;
|
||||
}
|
||||
afx-app-window[data-id = "repository-dialog-win"] afx-list-view[data-id="repo-list"] ul.complex-content > li{
|
||||
font-size: 11px;
|
||||
font-style: italic;
|
||||
}
|
@ -7,7 +7,18 @@ class AppearanceHandler extends SettingHandler
|
||||
@wpsize = @find "wpsize"
|
||||
@wprepeat = @find "wprepeat"
|
||||
@themelist = @find "theme-list"
|
||||
@wpsize.set "onlistselect", (e)->
|
||||
|
||||
@wplist.set "onlistselect", (e) ->
|
||||
$(me.wpreview).css("background-image", "url(#{me.parent._api.handler.get}/#{e.data.path})" )
|
||||
.css("background-size", "cover")
|
||||
me.parent.systemsetting.appearance.wp.url = e.data.path
|
||||
me.parent._gui.wallpaper()
|
||||
|
||||
@wplist.set "buttons", [
|
||||
{ text: "+", onbtclick: (e) -> console.log "click +" }
|
||||
]
|
||||
|
||||
@wpsize.set "onlistselect", (e) ->
|
||||
me.parent.systemsetting.appearance.wp.size = e.data.text
|
||||
me.parent._gui.wallpaper()
|
||||
|
||||
@ -17,11 +28,6 @@ class AppearanceHandler extends SettingHandler
|
||||
{ text: "contain", selected: me.parent.systemsetting.appearance.wp.size is "contain" }
|
||||
]
|
||||
@wpsize.set "items", sizes
|
||||
@wplist.set "onlistselect", (e) ->
|
||||
$(me.wpreview).css("background-image", "url(#{me.parent._api.handler.get}/#{e.data.path})" )
|
||||
.css("background-size", "cover")
|
||||
me.parent.systemsetting.appearance.wp.url = e.data.path
|
||||
me.parent._gui.wallpaper()
|
||||
|
||||
|
||||
repeats = [
|
||||
|
@ -24,6 +24,7 @@ afx-app-window[data-id = "setting-window"] afx-vbox[data-id="appearance"] div[da
|
||||
afx-app-window[data-id = "setting-window"] afx-vbox[data-id="appearance"] afx-list-view[data-id="wplist"]
|
||||
{
|
||||
border:1px solid #cbcbcb;
|
||||
padding:2px;
|
||||
}
|
||||
afx-app-window[data-id = "setting-window"] afx-vbox[data-id="appearance"] afx-resizer{
|
||||
border:0;
|
||||
|
@ -7,14 +7,15 @@
|
||||
<afx-hbox>
|
||||
<afx-list-view data-width="120" data-id="wplist"></afx-list-view>
|
||||
<afx-resizer data-width="5"></afx-resizer>
|
||||
<div data-id = "wp-preview"></div>
|
||||
</afx-hbox>
|
||||
<div data-height="5"></div>
|
||||
<afx-hbox data-height="30">
|
||||
<afx-button data-width="130" text= "__(Add)"></afx-button>
|
||||
<afx-list-view data-id = "wpsize" dropdown="true"></afx-list-view>
|
||||
<div data-width="5"></div>
|
||||
<afx-list-view data-id = "wprepeat" dropdown="true"></afx-list-view>
|
||||
<afx-vbox>
|
||||
<div data-id = "wp-preview"></div>
|
||||
<div data-height="5"></div>
|
||||
<afx-hbox data-height="25">
|
||||
<afx-list-view data-id = "wpsize" dropdown="true"></afx-list-view>
|
||||
<div data-width="5"></div>
|
||||
<afx-list-view data-id = "wprepeat" dropdown="true"></afx-list-view>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<div data-height="5"></div>
|
||||
<afx-label text = "__(Theme)" iconclass = "fa fa-window-restore" class = "header" data-height="23"></afx-label>
|
||||
|
Reference in New Issue
Block a user