fix system & context menu

This commit is contained in:
Xuan Sang LE
2018-01-31 15:41:32 +01:00
parent de387ece25
commit b44ef3ce0e
8 changed files with 32 additions and 28 deletions

View File

@ -247,7 +247,7 @@ self.OS.GUI =
{ text: "Open", dataid: "desktop-open" },
{ text: "Refresh", dataid: "desktop-refresh" }
]
menu = menu.concat _OS.setting.desktop.menu
menu = menu.concat ( v for k, v of _OS.setting.desktop.menu)
m.set "items", menu
m.set "onmenuselect", (evt) ->
switch evt.item.data.dataid
@ -260,7 +260,7 @@ self.OS.GUI =
when "desktop-refresh"
desktop[0].fetch()
else
_GUI.launch evt.item.data.app if evt.item.data.app
_GUI.launch evt.item.data.app, evt.item.data.args if evt.item.data.app
m.show(e)
desktop[0].fetch()
@ -290,7 +290,7 @@ self.OS.GUI =
_GUI.launch d.item.data.app
}
]
menu.child = menu.child.concat _OS.setting.system.menu
menu.child = menu.child.concat (v for k, v of _OS.setting.system.menu)
menu.child.push
text: "Log out",
dataid: "sys-logout",
@ -329,7 +329,7 @@ self.OS.GUI =
_OS.setting.user = conf.user
_OS.setting.VFS = conf.VFS if conf.VFS
_OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
_OS.setting.desktop.menu = [] unless _OS.setting.desktop.menu
_OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu
_OS.setting.VFS.mountpoints = [
#TODO: multi app try to write to this object, it neet to be cloned
{ text: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" },
@ -343,7 +343,7 @@ self.OS.GUI =
"home:///.packages",
"os:///packages"
] unless _OS.setting.system.pkgpaths
_OS.setting.system.menu = [] unless _OS.setting.system.menu
_OS.setting.system.menu = {} unless _OS.setting.system.menu
_OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme
# load theme
@ -367,7 +367,7 @@ self.OS.GUI =
_GUI.pushServices [
"CoreServices/PushNotification",
"CoreServices/Spotlight",
"CoreServices/Calendar"
#"CoreServices/Calendar"
]
# startup application here

View File

@ -6,4 +6,4 @@
<afx-float-list id = "desktop" ></afx-float-list>
<!--div id = "workingenv"></div-->
</div>
<afx-menu id="contextmenu" context="true" style="display:none;"></afx-menu>
<afx-menu id="contextmenu" data-id="contextmenu" context="true" style="display:none;"></afx-menu>

View File

@ -1,13 +1,13 @@
<afx-menu >
<ul class={context: opts.context == "true"}>
<li class="afx-corner-fix"></li>
<li ref = "container" each={ data,i in items } class = {afx_submenu:data.child != null, fix_padding:data.icon} no-reorder>
<li ref = "container" each={ data,i in items } class = {afx_submenu:data.child != null && data.child.length > 0, fix_padding:data.icon} no-reorder>
<a href="#" onclick = {parent.onselect}>
<afx-switch if = {data.switch || data.radio} class = {checked:parent.checkItem(data)} enable = false swon = {data.checked} ></afx-switch>
<afx-label color = {data.color} iconclass = {data.iconclass} icon = {data.icon} text = {data.text} ></afx-label>
</a>
<afx-menu if={data.child != null} child={data.child.constructor === Array?data.child:data.child()} onmenuselect = {data.onmenuselect} observable = {parent.root.observable} rootid = {parent.rid}></afx-menu>
<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>
</li>
<li class="afx-corner-fix"></li>
</ul>
@ -78,7 +78,7 @@
self.root.show = function(e)
{
//only for menucontext
if(opts.context != "true") return;
if(opts.context != "true") return
$(self.root)
.css("top", e.clientY - 15 + "px")
.css("left",e.clientX -5 + "px")

View File

@ -96,7 +96,7 @@
self.update()
})
}
select(event)
{
if(istoggle)