Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
fc3ebfa2
Commit
fc3ebfa2
authored
Jul 25, 2014
by
Aron Carroll
Committed by
gergely-ujvari
Jul 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the inactive state to the search bar
parent
b66cd5ae
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
directives.coffee
h/static/scripts/directives.coffee
+1
-1
simple-search.scss
h/static/styles/simple-search.scss
+4
-2
directives-test.coffee
tests/js/directives-test.coffee
+12
-1
No files found.
h/static/scripts/directives.coffee
View file @
fc3ebfa2
...
...
@@ -418,7 +418,7 @@ simpleSearch = ['$parse', ($parse) ->
restrict
:
'C'
template
:
'''
<form class="simple-search-form" name="searchBox" ng-submit="dosearch()">
<form class="simple-search-form" n
g-class="!searchtext && 'simple-search-inactive'" n
ame="searchBox" ng-submit="dosearch()">
<i class="simple-search-icon icon-search"></i>
<input class="simple-search-input" type="text" ng-model="searchtext" name="searchText" />
<button class="simple-search-clear" type="reset" ng-hide="!searchtext" ng-click="reset($event)">
...
...
h/static/styles/simple-search.scss
View file @
fc3ebfa2
...
...
@@ -19,13 +19,14 @@
}
.simple-search-input
{
outline
:
none
;
height
:
26px
;
// Temporary fix for FF.
width
:
100%
;
border-radius
:
15px
;
border
-color
:
#C5C5C5
!
important
;
// Override base input styles.
border
:
1px
solid
$gray-lighter
!
important
;
// Override base input styles.
padding-left
:
2em
;
.simple-search-inactive
&
{
.simple-search-inactive
&
:not
(
:focus
)
{
background-color
:
$gray-lightest
;
border-color
:
$gray-lightest
!
important
;
}
...
...
@@ -41,6 +42,7 @@
}
position
:
absolute
;
outline
:
none
;
right
:
5px
;
top
:
50%
;
border
:
none
;
...
...
tests/js/directives-test.coffee
View file @
fc3ebfa2
...
...
@@ -168,8 +168,19 @@ describe 'h.directives', ->
$element
.
find
(
'.simple-search-clear'
).
click
()
assert
(
$scope
.
clear
.
called
)
it
'clear
clear
s the search-bar'
,
->
it
'clears the search-bar'
,
->
$scope
.
query
=
{
query
:
"Test query"
}
$scope
.
$digest
()
$element
.
find
(
'.simple-search-clear'
).
click
()
assert
.
equal
(
$scope
.
searchtext
,
''
)
it
'adds a class to the form when there is no input value'
,
->
$form
=
$element
.
find
(
'.simple-search-form'
)
assert
.
include
(
$form
.
prop
(
'className'
),
'simple-search-inactive'
)
it
'removes the class from the form when there is an input value'
,
->
$scope
.
query
=
{
query
:
"Test query"
}
$scope
.
$digest
()
$form
=
$element
.
find
(
'.simple-search-form'
)
assert
.
notInclude
(
$form
.
prop
(
'className'
),
'simple-search-inactive'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment