add spotlight ui

This commit is contained in:
Xuan Sang LE 2018-03-03 01:22:34 +01:00
parent 1dbf88f888
commit d329c2c423
4 changed files with 105 additions and 8 deletions

View File

@ -4,7 +4,7 @@ jsfiles =
cssfiles = main.css
copyfiles = package.json notifications.html
copyfiles = package.json notifications.html spotlight.html
PKG_NAME=CoreServices

View File

@ -1,19 +1,61 @@
class SpotlightDialog extends this.OS.GUI.BaseDialog
constructor: () ->
super "SpotlightDialog"
init: () ->
@render "#{@path()}/spotlight.html"
main: () ->
me = @
@height = ($ @scheme).css("height")
($ @scheme).css("height", "45px")
#fn = (e) ->
# if e.keyCode is 27
# ($ document).unbind "keyup", fn
# me.handler(e) if me.handler
#($ document).keyup fn
fn1 = (e) ->
if not $(e.target).closest(me.scheme).length
($ document).unbind "click", fn1
me.handler(e) if me.handler
($ document).click fn1
@searchbox = @find "searchbox"
($ @searchbox).focus()
($ @searchbox).keyup (e) ->
me.search e
search: (e) ->
($ @scheme).css("height", @height)
this.OS.register "SpotlightDialog", SpotlightDialog
class Spotlight extends this.OS.GUI.BaseService
constructor: (args) ->
super "Spotlight", args
@iconclass = "fa fa-search"
@show = false
init: ->
@child = [
{
text: "#{@.name} (#{@.pid}): dummy notif",
child: [ { text: "submenu" } ]
}
]
#@child = [
# {
# text: "#{@.name} (#{@.pid}): dummy notif",
# child: [ { text: "submenu" } ]
# }
#]
# do nothing
main: ->
awake: (e) ->
console.log @name ,@pid
me = @
@show = not @show
if @show
@openDialog "SpotlightDialog", (d) ->
me.show = false
me.dialog.quit() if me.dialog
else
@dialog.quit() if @dialog
cleanup: (evt) ->
# do nothing

View File

@ -48,4 +48,45 @@ afx-list-view[data-id = "notifeed"] li{
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;
}
afx-app-window[data-id = "spotlight-win"] .afx-window-wrapper{
background-color: white;
border-radius: 0px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
afx-app-window[data-id = "spotlight-win"] .afx-window-top{
height: 0;
border:0;
}
afx-app-window[data-id = "spotlight-win"] input{
border:0;
font-size: 25px;
color:#afafaf;
height: 45px;
}
afx-app-window[data-id = "spotlight-win"] div[data-id="searchicon"]:before{
content: "\f002";
padding-top:5px;
padding-left: 10px;
display: block;
background-color: #F6F6F6;
color:#afafaf;
width:40px;
height: 40px;
font-family: "FontAwesome";
font-size: 30px;
}
afx-app-window[data-id = "spotlight-win"] .afx-window-content{
border-radius: 10px;
}
afx-app-window[data-id = "spotlight-win"] afx-list-view[data-id="container"]{
border-top:1px solid #cacaca;
}
afx-app-window[data-id = "spotlight-win"] afx-resizer{
background-color: transparent;
border-left: 1px solid #cacaca;
}

View File

@ -0,0 +1,14 @@
<afx-app-window data-id = "spotlight-win" apptitle="" minimizable="false" resizable = "false" width="500" height="300">
<afx-vbox>
<afx-hbox data-height="45">
<div data-id = "searchicon" data-width="45"></div>
<input type = "text" data-id="searchbox"/>
</afx-hbox>
<afx-list-view data-id="container"></afx-list-view>
<!--afx-hbox data-id="container">
<afx-resizer data-width ="5"></afx-resizer>
<div data-id="preview"></div>
</afx-hbox-->
</afx-vbox>
</afx-app-window>