mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-02-22 01:42:47 +01:00
add search mechanism to API
This commit is contained in:
parent
e0581b71ec
commit
f5d4e87828
@ -35,7 +35,7 @@ class BaseModel
|
|||||||
|
|
||||||
trigger: (e, d) -> @observable.trigger e, d
|
trigger: (e, d) -> @observable.trigger e, d
|
||||||
|
|
||||||
subscribe: (e, f) ->
|
subscribe: (e, f) ->
|
||||||
_courrier.on e, f, @
|
_courrier.on e, f, @
|
||||||
|
|
||||||
openDialog: (d, f, title, data) ->
|
openDialog: (d, f, title, data) ->
|
||||||
@ -46,6 +46,7 @@ class BaseModel
|
|||||||
@error "Dialog #{d} not found"
|
@error "Dialog #{d} not found"
|
||||||
return
|
return
|
||||||
@dialog = new _GUI.subwindows[d]()
|
@dialog = new _GUI.subwindows[d]()
|
||||||
|
#@dialog.observable = riot.observable() unless @dialog
|
||||||
@dialog.parent = @
|
@dialog.parent = @
|
||||||
@dialog.handler = f
|
@dialog.handler = f
|
||||||
@dialog.pid = @pid
|
@dialog.pid = @pid
|
||||||
|
@ -9,19 +9,15 @@ class SpotlightDialog extends this.OS.GUI.BaseDialog
|
|||||||
me = @
|
me = @
|
||||||
@height = ($ @scheme).css("height")
|
@height = ($ @scheme).css("height")
|
||||||
@container = @find "container"
|
@container = @find "container"
|
||||||
|
@container.set "selected", -1
|
||||||
|
console.log "new dia"
|
||||||
($ @scheme).css("height", "45px")
|
($ @scheme).css("height", "45px")
|
||||||
#fn = (e) ->
|
#fn = (e) ->
|
||||||
# if e.keyCode is 27
|
# if e.keyCode is 27
|
||||||
# ($ document).unbind "keyup", fn
|
# ($ document).unbind "keyup", fn
|
||||||
# me.handler(e) if me.handler
|
# me.handler(e) if me.handler
|
||||||
#($ document).keyup fn
|
#($ document).keyup fn
|
||||||
|
($ document).click @clickHandler
|
||||||
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 = @find "searchbox"
|
||||||
($ @searchbox).focus()
|
($ @searchbox).focus()
|
||||||
($ @searchbox).keyup (e) ->
|
($ @searchbox).keyup (e) ->
|
||||||
@ -30,8 +26,15 @@ class SpotlightDialog extends this.OS.GUI.BaseDialog
|
|||||||
return if e.data.dataid and e.data.dataid is "header"
|
return if e.data.dataid and e.data.dataid is "header"
|
||||||
me.handler(e) if me.handler
|
me.handler(e) if me.handler
|
||||||
me._gui.openWith e.data
|
me._gui.openWith e.data
|
||||||
|
($ document).unbind "click", me.clickHandler
|
||||||
|
me.quit()
|
||||||
|
|
||||||
|
clickHandler: (e) ->
|
||||||
|
me = @
|
||||||
|
if not $(e.target).closest(me.scheme).length
|
||||||
|
($ document).unbind "click", me.clickHandler
|
||||||
|
me.handler(e) if me.handler
|
||||||
|
me.quit()
|
||||||
|
|
||||||
search: (e) ->
|
search: (e) ->
|
||||||
switch e.which
|
switch e.which
|
||||||
@ -52,6 +55,8 @@ class SpotlightDialog extends this.OS.GUI.BaseDialog
|
|||||||
return if sel.dataid and sel.dataid is "header"
|
return if sel.dataid and sel.dataid is "header"
|
||||||
@.handler(e) if @.handler
|
@.handler(e) if @.handler
|
||||||
@._gui.openWith sel
|
@._gui.openWith sel
|
||||||
|
($ document).unbind "click", @clickHandler
|
||||||
|
@.quit()
|
||||||
else
|
else
|
||||||
text = @searchbox.value
|
text = @searchbox.value
|
||||||
($ @scheme).css("height", "45px")
|
($ @scheme).css("height", "45px")
|
||||||
@ -81,13 +86,13 @@ class Spotlight extends this.OS.GUI.BaseService
|
|||||||
|
|
||||||
awake: (e) ->
|
awake: (e) ->
|
||||||
me = @
|
me = @
|
||||||
@show = not @show
|
if not @show
|
||||||
if @show
|
me.show = true
|
||||||
@openDialog "SpotlightDialog", (d) ->
|
@openDialog "SpotlightDialog", (d) ->
|
||||||
me.show = false
|
me.show = false
|
||||||
me.dialog.quit() if me.dialog
|
|
||||||
me.dialog = undefined
|
me.dialog = undefined
|
||||||
else
|
else
|
||||||
|
me.show = false
|
||||||
@dialog.quit() if @dialog
|
@dialog.quit() if @dialog
|
||||||
|
|
||||||
cleanup: (evt) ->
|
cleanup: (evt) ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user