From d329c2c4234d8390324178533f6152655ed375b1 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Sat, 3 Mar 2018 01:22:34 +0100 Subject: [PATCH] add spotlight ui --- src/packages/CoreServices/Makefile | 2 +- src/packages/CoreServices/Spotlight.coffee | 56 +++++++++++++++++++--- src/packages/CoreServices/main.css | 41 ++++++++++++++++ src/packages/CoreServices/spotlight.html | 14 ++++++ 4 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 src/packages/CoreServices/spotlight.html diff --git a/src/packages/CoreServices/Makefile b/src/packages/CoreServices/Makefile index 3ef8910..2fc5eaf 100644 --- a/src/packages/CoreServices/Makefile +++ b/src/packages/CoreServices/Makefile @@ -4,7 +4,7 @@ jsfiles = cssfiles = main.css -copyfiles = package.json notifications.html +copyfiles = package.json notifications.html spotlight.html PKG_NAME=CoreServices diff --git a/src/packages/CoreServices/Spotlight.coffee b/src/packages/CoreServices/Spotlight.coffee index 4d2337c..a7e0f70 100644 --- a/src/packages/CoreServices/Spotlight.coffee +++ b/src/packages/CoreServices/Spotlight.coffee @@ -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 diff --git a/src/packages/CoreServices/main.css b/src/packages/CoreServices/main.css index 5cbc1f2..3336000 100644 --- a/src/packages/CoreServices/main.css +++ b/src/packages/CoreServices/main.css @@ -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; } \ No newline at end of file diff --git a/src/packages/CoreServices/spotlight.html b/src/packages/CoreServices/spotlight.html new file mode 100644 index 0000000..030f449 --- /dev/null +++ b/src/packages/CoreServices/spotlight.html @@ -0,0 +1,14 @@ + + + +
+ +
+ + +
+
\ No newline at end of file