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
81a111fa
Commit
81a111fa
authored
Jan 14, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed search field preserving initial key-value search criteria
parent
f9a545a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
js/erp5_loader.js
js/erp5_loader.js
+27
-13
No files found.
js/erp5_loader.js
View file @
81a111fa
...
...
@@ -4522,7 +4522,8 @@
config
.
state
.
type
,
null
,
config
.
element
.
value
,
config
.
state
.
query
.
select_list
config
.
state
.
query
.
select_list
,
config
.
state
.
restore
);
// update gadget
...
...
@@ -4781,7 +4782,7 @@
// TODO: parentNode is not a proper selector, this should be done
// by storing info fields associated with a gadget in state and
// updating from there!
app
.
updateInfoElement
(
app
.
setInfo
(
config
.
gadget
.
parentNode
,
state
.
query
,
state
.
total
,
...
...
@@ -5090,9 +5091,9 @@
* @param {integer} selected Total Records currently selected
*/
// WARNING: complex_queries dependency, IE8 & QSA
// TODO: refactor
, this is quite the crap...
// TODO: refactor
// TODO: don't reset all 4 fields on every action!
app
.
updateInfoElement
=
function
(
element
,
options
,
total
,
selected
)
{
app
.
setInfo
=
function
(
element
,
options
,
total
,
selected
)
{
var
i
,
j
,
l
,
selection
,
info_field
,
min
,
pointer
,
no_items
,
text_snippet
,
i18n_snippet
,
zero_no_show
,
select_counter
,
no_limit
,
slot
,
first
,
last
,
info
,
info_field_list
,
generateInfo
,
no_total
,
...
...
@@ -5110,7 +5111,7 @@
);
};
//
we are working without total query
//
skip_total
if
(
no_total
)
{
use_total
=
0
;
}
else
{
...
...
@@ -5261,11 +5262,11 @@
* @param {string} key Parameter to search single column
* @param {string} value Value to search for across one or all columns
* @param {object} field_list Items to search across
* @param {
string} initial_query Intial query indicating blocked columns
* @param {
array} restore Initial query identifier (key) and value
* @return {object} query object
*/
// WARNING: complex_queries dependency!
app
.
generateQueryObject
=
function
(
query
,
type
,
key
,
value
,
field_list
)
{
app
.
generateQueryObject
=
function
(
query
,
type
,
key
,
value
,
field_list
,
restore
)
{
var
property
,
wrap
,
query_object
,
query_clean
,
default_query
,
obj
,
is_value
,
i
;
...
...
@@ -5307,6 +5308,7 @@
obj
.
query
+=
'
AND (
'
+
key
+
'
:"
'
+
value
+
'
")
'
;
obj
.
start
=
0
;
obj
.
items
=
1
;
obj
.
restore
=
[
key
,
value
];
// search "bar"
}
else
if
(
is_value
)
{
...
...
@@ -5325,6 +5327,11 @@
}
}
// restore initial query in case we are searching for empty string
if
(
restore
)
{
obj
.
query
+=
'
AND (
'
+
restore
[
0
]
+
'
:"
'
+
restore
[
1
]
+
'
")
'
;
}
if
(
default_query
.
sort_on
)
{
obj
.
sort_on
=
[
default_query
.
sort
];
}
else
{
...
...
@@ -5640,7 +5647,7 @@
if
(
pass
.
create
===
false
&&
pass
.
purge
===
null
)
{
selector
=
pass
.
state
.
gadget
;
}
else
{
// TODO: in case of update?
find
data-update?
// TODO: in case of update?
should use
data-update?
// NOTE: in case of forms, we find the form!
// NOTE: in case of fragments, we punt to the firstElementChild...
selector
=
element
.
querySelector
(
"
form
"
)
||
...
...
@@ -5649,10 +5656,15 @@
pass
.
state
.
gadget
=
selector
;
}
//
round up and store state on gadget
//
preserve constructor for updates
pass
.
state
.
constructor
=
pass
.
constructor
;
pass
.
state
.
selected
=
pass
.
create
===
false
?
(
pass
.
state
.
selected
)
:
undefined
;
// preserve initial search other than _id
if
(
pass
.
state
.
query
.
restore
)
{
pass
.
state
.
restore
=
pass
.
state
.
query
.
restore
;
}
// pass.state.selected = pass.create === false ?
// (pass.state.selected) : undefined;
// if a callback is provided, set it on state
if
(
pass
.
config
.
property_dict
.
submit_to
)
{
...
...
@@ -5667,7 +5679,7 @@
if
(
pass
.
no_auth
||
((
pass
.
auth
&&
pass
.
active_login
)
||
pass
.
mode
===
"
new
"
))
{
app
.
updateInfoElement
(
app
.
setInfo
(
pass
.
create
?
element
:
selector
,
pass
.
state
.
query
,
pass
.
state
.
total
...
...
@@ -5711,6 +5723,7 @@
pass
.
field_list
=
storage
.
makeSelectList
(
pass
.
config
.
scheme
);
}
}
pass
.
state
.
query
=
app
.
generateQueryObject
(
pass
.
config
.
initial_query
,
pass
.
type
,
...
...
@@ -5746,6 +5759,7 @@
if
(
pass
.
skip
===
undefined
)
{
// create or update state object
if
(
pass
.
create
===
false
)
{
// TODO: get element from state if possible!
pass
.
state
=
document
.
getElementById
(
pass
.
reference
).
state
;
pass
.
constructor
=
pass
.
state
.
method
;
pass
.
store_limit
=
pass
.
state
.
query
.
limit
;
...
...
@@ -7075,9 +7089,9 @@
/* ====================================================================== */
app
.
contentLoaded
(
window
,
function
()
{
// TODO: don't wipe. Sync...!
// Don't wipe if opened in a popup (like in oAuth redirect_uri)
if
(
window
.
opener
===
null
)
{
// TODO: don't wipe, sync...
window
.
localStorage
.
clear
();
}
...
...
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