Loop through form inputs
This commit is contained in:
parent
f7a97291c0
commit
3a8c4ebb43
1 changed files with 8 additions and 11 deletions
|
@ -28,7 +28,6 @@ class @SearchAutocomplete
|
||||||
@groupInputEl = @getElement('#group_id')
|
@groupInputEl = @getElement('#group_id')
|
||||||
@searchCodeInputEl = @getElement('#search_code')
|
@searchCodeInputEl = @getElement('#search_code')
|
||||||
@repositoryInputEl = @getElement('#repository_ref')
|
@repositoryInputEl = @getElement('#repository_ref')
|
||||||
@scopeInputEl = @getElement('#scope')
|
|
||||||
|
|
||||||
@saveOriginalState()
|
@saveOriginalState()
|
||||||
|
|
||||||
|
@ -51,6 +50,7 @@ class @SearchAutocomplete
|
||||||
group_id: @groupInputEl.val()
|
group_id: @groupInputEl.val()
|
||||||
search_code: @searchCodeInputEl.val()
|
search_code: @searchCodeInputEl.val()
|
||||||
repository_ref: @repositoryInputEl.val()
|
repository_ref: @repositoryInputEl.val()
|
||||||
|
scope: @scopeInputEl.val()
|
||||||
|
|
||||||
# Location badge
|
# Location badge
|
||||||
_location: $.trim(@locationText.text())
|
_location: $.trim(@locationText.text())
|
||||||
|
@ -191,20 +191,17 @@ class @SearchAutocomplete
|
||||||
@locationBadgeEl.children().length
|
@locationBadgeEl.children().length
|
||||||
|
|
||||||
resetSearchState: ->
|
resetSearchState: ->
|
||||||
# Remove scope
|
inputs = Object.keys @originalState
|
||||||
@scopeInputEl.val('')
|
|
||||||
|
|
||||||
# Remove group
|
for input in inputs
|
||||||
@groupInputEl.val('')
|
|
||||||
|
|
||||||
# Remove project id
|
# _location isnt a input
|
||||||
@projectInputEl.val('')
|
break if input is '_location'
|
||||||
|
|
||||||
# Remove code search
|
# renamed to avoid tests to fail
|
||||||
@searchCodeInputEl.val('')
|
if input is 'project_id' then input = 'search_project_id'
|
||||||
|
|
||||||
# Remove repository ref
|
@getElement("##{input}").val('')
|
||||||
@repositoryInputEl.val('')
|
|
||||||
|
|
||||||
removeLocationBadge: ->
|
removeLocationBadge: ->
|
||||||
@locationBadgeEl.empty()
|
@locationBadgeEl.empty()
|
||||||
|
|
Loading…
Reference in a new issue