Browse Source

Disable search input while showing doc picker

Closes #196.
Thibaut Courouble 10 years ago
parent
commit
b14fc9438a

+ 8 - 0
assets/javascripts/views/search/search.coffee

@@ -49,6 +49,14 @@ class app.views.Search extends app.View
     @autoFocus()
     return
 
+  disable: ->
+    @input.setAttribute('disabled', 'disabled')
+    return
+
+  enable: ->
+    @input.removeAttribute('disabled')
+    return
+
   onReady: =>
     @value = ''
     @delay @onInput

+ 1 - 0
assets/javascripts/views/sidebar/sidebar.coffee

@@ -34,6 +34,7 @@ class app.views.Sidebar extends app.View
       @append @tmpl('sidebarSettings') if @view is @docList and @docPicker
       @view.activate()
       @restoreScrollPosition()
+      if view is @docPicker then @search.disable() else @search.enable()
     return
 
   showDocList: (reset) =>

+ 5 - 0
assets/stylesheets/components/_header.scss

@@ -126,6 +126,11 @@
       box-shadow: 0 0 1px $inputFocusBorder;
     }
   }
+
+  &[disabled] {
+    background: $sidebarBackground;
+    cursor: not-allowed;
+  }
 }
 
 ._search-clear {