Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
74f366a7
Commit
74f366a7
authored
Jul 24, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor searchbar gadget (not done)
parent
a2a5ea79
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
12 deletions
+36
-12
modules/search/search.html
modules/search/search.html
+12
-1
modules/searchbar/searchbar.html
modules/searchbar/searchbar.html
+0
-1
modules/searchbar/searchbar.js
modules/searchbar/searchbar.js
+24
-10
No files found.
modules/search/search.html
View file @
74f366a7
...
...
@@ -50,7 +50,18 @@
<div
id=
"searchbar"
data-gadget=
"modules/searchbar/searchbar.html"
data-gadget-module=
"searchbar"
class=
"searchbar_wrap search_element"
>
class=
"searchbar_wrap search_element"
data-gadget-property=
'{
"state": [
{
"searchbar": {
"_elements": [
["searchbar_filter", "attr", "data-selector", "items_listview"]
]
}
}
]
}'
>
</div>
<!-- sorting -->
...
...
modules/searchbar/searchbar.html
View file @
74f366a7
...
...
@@ -7,7 +7,6 @@
<body>
<div
data-filter=
"true"
class=
"searchbar_filter"
data-selector=
"items_listview"
data-filter-placeholder=
"Search"
>
</div>
</body>
...
...
modules/searchbar/searchbar.js
View file @
74f366a7
...
...
@@ -9,7 +9,17 @@ define([
response
.
data
=
source
;
response
.
callback
=
function
(
self
)
{
var
filter
=
self
.
dom
.
find
(
"
.searchbar_filter
"
),
value
;
value
,
runSearch
;
runSearch
=
function
(
value
)
{
// only go to search.html, if we are currently not on it, else only trigger hashchange
$
.
mobile
.
changePage
(
"
search.html
"
,
{
"
transition
"
:
"
slide
"
,
"
data
"
:
{
"
search
"
:
value
}
});
};
filter
.
on
(
"
filterbarbeforefilter
"
,
function
(
e
,
data
)
{
value
=
data
.
input
.
value
;
...
...
@@ -35,17 +45,21 @@ define([
})
.
on
(
"
filterbarcreate
"
,
function
(
e
,
ui
)
{
var
uuid
=
$
(
e
.
target
).
data
(
"
mobileFilterbar
"
).
uuid
,
target
=
$
(
"
#ui-filter-
"
+
uuid
).
find
(
"
.ui-input-action
"
);
target
=
$
(
"
#ui-filter-
"
+
uuid
),
action
=
target
.
find
(
"
.ui-input-action
"
),
input
=
target
.
find
(
"
input
"
);
target
.
on
(
"
click
"
,
function
(
e
)
{
value
=
$
(
"
#ui-filter-
"
+
uuid
).
find
(
"
input
"
).
val
();
// TODO: search should be run here and results should be passed to
// items or ?. Otherwise items has to listen for ... something, grab
// data from somewhere and query. This makes more sense here.
action
.
on
(
"
click
"
,
function
(
e
)
{
runSearch
(
input
.
val
());
});
$
.
mobile
.
changePage
(
"
search.html
"
,
{
"
transition
"
:
"
slide
"
,
"
data
"
:
{
"
search
"
:
value
}
});
input
.
on
(
"
keypress
"
,
function
(
e
)
{
if
(
e
.
which
==
13
)
{
runSearch
(
input
.
val
());
}
});
});
...
...
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