Merge branch 'master' of https://github.com/lxsang/antos
This commit is contained in:
Xuan Sang LE 2018-03-07 10:57:05 +01:00
commit 5020fb4ecc
5 changed files with 63 additions and 18 deletions

View File

@ -76,7 +76,7 @@ self.OS.GUI =
_courrier.osfail "Cannot read service script: #{srv} ", e, s
appsByMime: (mime) ->
metas = ( v for k, v of _OS.setting.system.packages when v.app )
metas = ( v for k, v of _OS.setting.system.packages when v and v.app )
mimes = ( m.mimes for m in metas when m)
apps = []
# search app by mimes
@ -95,7 +95,7 @@ self.OS.GUI =
appsWithServices: () ->
o = {}
o[k] = v for k, v of _OS.setting.system.packages when v.services and v.services.length > 0
o[k] = v for k, v of _OS.setting.system.packages when v and v.services and v.services.length > 0
o
openWith: (it) ->

View File

@ -8,12 +8,16 @@
<span if={data.shortcut} class = "shortcut">{data.shortcut}</span>
</a>
<afx-menu if={data.child != null && data.child.length > 0} child={data.child} onmenuselect = {data.onmenuselect} observable = {parent.root.observable} rootid = {parent.rid}></afx-menu>
<afx-menu ref = "submenus" index = {i} if={data.child != null && data.child.length > 0} child={data.child} onmenuselect = {data.onmenuselect} observable = {parent.root.observable} rootid = {parent.rid}></afx-menu>
</li>
<li class="afx-corner-fix"></li>
</ul>
<script>
this.items = opts.child || []
if(opts.index != undefined)
this.index = opts.index
else
this.index = -1
var isRoot
var lastChecked = undefined
if(opts.rootid)
@ -48,6 +52,7 @@
self[k] = v
self.update()
}
self.root.push = function(e,u)
{
self.items.push(e)

View File

@ -150,6 +150,13 @@ class Blogger extends this.OS.GUI.BaseApplication
doc.replaceSelection "![](#{me._api.handler.shared}/#{r.result})"
, "Select image file", { mimes: ["image/.*"] }
},
{
name:"Youtube",
className: "fa fa-youtube",
action: (e) ->
doc = me.editor.codemirror.getDoc()
doc.replaceSelection "[[youtube:]]"
}
"|",
{
name: "preview",
@ -179,7 +186,10 @@ class Blogger extends this.OS.GUI.BaseApplication
, "Delete a post" ,
{ iconclass: "fa fa-question-circle", text: "Do you really want to delete this post ?" }
return false
@bindKey "CTRL-S", () ->
sel = me.tabbar.get "selidx"
return unless sel is 2
me.saveBlog()
@on "vboxchange", () ->
me.resizeContent()
# USER TAB

View File

@ -9,18 +9,54 @@ class RepositoryDialog extends this.OS.GUI.BaseDialog
main: () ->
me = @
@list = @find "repo-list"
ls = ({ text: v.name, iconclass: "fa fa-link", url: v.url
} for v in @systemsetting.system.repositories)
@url = @find "repo-url"
@list.set "onlistselect", (e) ->
($ me.url).html e.data.url
@list.set "items", ls
@list.set "onlistdbclick", (e) ->
selidx = me.list.get "selidx"
return unless selidx >= 0
sel = me.systemsetting.system.repositories[selidx]
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
sel.name = m[1]
sel.text = sel.name
sel.url = m[2]
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()
(@find "btquit").set "onbtclick", (e) -> me.quit()
@refreshList()
refreshList: () ->
ls = ({
text: v.name,
iconclass: "fa fa-link",
url: v.url,
complex: true,
detail: [{ text: v.url }]
} for v in @systemsetting.system.repositories)
@list.set "items", ls
onexit: (e) ->
@parent.repo.set "items", @systemsetting.system.repositories
@parent.dialog = undefined if @parent
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>
<div data-id="repo-url" data-height="grow"></div>
<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>

View File

@ -7,12 +7,6 @@ class MarketPlace extends this.OS.GUI.BaseApplication
me = @
@installdir = @systemsetting.system.pkgpaths.user
# test repository
@systemsetting.system.repositories.push {
text: "Antos repository"
url: "https://os.localhost:9195/repo/packages.json"
name: "Antos repository"
selected:true
} if @systemsetting.system.repositories.length is 0
@repo = @find "repo"
@repo.set "onlistselect", (e) ->
return unless e.data
@ -128,7 +122,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
(d) ->
return unless d
app.path.asFileHandler().remove (r) ->
me.error "Cannot uninstall package: #{r.error}" if r.error
return me.error "Cannot uninstall package: #{r.error}" if r.error
me.notify "Package uninstalled"
me.systemsetting.system.packages[name] = undefined
me._gui.refreshSystemMenu()