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
d4a21bcd
Commit
d4a21bcd
authored
Apr 18, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app: setup sinlge page pagination (not working yet)
parent
25947561
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
73 deletions
+78
-73
js/erp5_loader.js
js/erp5_loader.js
+78
-73
No files found.
js/erp5_loader.js
View file @
d4a21bcd
...
...
@@ -2762,19 +2762,21 @@
};
/** Generate a pagination toolbar (controlbar)
* @method paginat
e
* @method paginat
ionBar
* @param {object} spec Pagination configuration
* @return {object} finished config object
**/
// TODO: make this a real widget with methods!
factory
.
util
.
paginationBar
=
function
(
spec
)
{
var
n
,
option
,
props
,
option_list
,
class_list
,
config
;
var
n
,
option
,
props
,
option_list
,
class_list
,
config
,
len
,
opts
,
pointer
;
option_list
=
[{
"
value
"
:
""
,
"
text
"
:
""
,
"
text_i18n
"
:
""
}];
opts
=
spec
.
option_list
||
[];
props
=
spec
.
slot
?
{
"
slot
"
:
spec
.
slot
}
:
{};
class_list
=
spec
.
class_list
||
""
;
for
(
n
=
0
;
n
<
spec
.
option_list
.
length
;
n
+=
1
)
{
option
=
spec
.
option_list
[
n
];
for
(
n
=
0
,
len
=
opts
.
length
;
n
<
len
;
n
+=
1
)
{
option
=
opts
[
n
];
option_list
.
push
({
"
value
"
:
option
.
value
,
"
text
"
:
option
.
text
,
...
...
@@ -2791,52 +2793,70 @@
"
generate
"
:
"
widget
"
,
"
type
"
:
"
controlgroup
"
,
"
property_dict
"
:
{
"
direction
"
:
"
horizontal
"
},
"
children
"
:
[{
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
className
"
:
"
action
"
,
"
href
"
:
"
#
"
},
"
attributes
"
:
{
"
data-i18n
"
:
"
global_dict.first
"
,
"
data-action
"
:
"
first
"
,
"
data-icon
"
:
"
step-backward
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
text
"
:
"
First
"
}
},
{
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
className
"
:
"
action
"
,
"
href
"
:
"
#
"
},
"
attributes
"
:
{
"
data-i18n
"
:
"
global_dict.previous
"
,
"
data-action
"
:
"
prev
"
,
"
data-icon
"
:
"
backward
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
text
"
:
"
Previous
"
}
},
{
"
type
"
:
"
select
"
,
"
direct
"
:
{
"
id
"
:
"
select_
"
+
util
.
uuid
(),
"
className
"
:
"
action
"
},
"
attributes
"
:
{
"
data-icon
"
:
"
bars
"
,
"
data-action
"
:
"
limit
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
options
"
:
option_list
}
},
{
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
className
"
:
"
action
"
,
"
href
"
:
"
#
"
},
"
attributes
"
:
{
"
data-i18n
"
:
"
global_dict.next
"
,
"
data-action
"
:
"
next
"
,
"
data-icon
"
:
"
forward
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
text
"
:
"
Next
"
}
}]
"
children
"
:
[]
}]
};
pointer
=
config
.
children
[
0
].
children
;
// first
if
(
!
spec
.
single
)
{
config
.
children
[
0
].
property_dict
.
class_list
=
"
ui-pagination-single
"
;
pointer
.
push
({
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
className
"
:
"
action
"
,
"
href
"
:
"
#
"
},
"
attributes
"
:
{
"
data-i18n
"
:
"
global_dict.first
"
,
"
data-action
"
:
"
first
"
,
"
data-icon
"
:
"
step-backward
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
text
"
:
"
First
"
}
});
}
// always add previous
pointer
.
push
({
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
className
"
:
"
action
"
,
"
href
"
:
"
#
"
},
"
attributes
"
:
{
"
data-i18n
"
:
"
global_dict.previous
"
,
"
data-action
"
:
"
prev
"
,
"
data-icon
"
:
"
backward
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
text
"
:
"
Previous
"
}
});
// select
if
(
len
>
0
)
{
pointer
.
push
({
"
type
"
:
"
select
"
,
"
direct
"
:
{
"
id
"
:
"
select_
"
+
util
.
uuid
(),
"
className
"
:
"
action
"
},
"
attributes
"
:
{
"
data-icon
"
:
"
bars
"
,
"
data-action
"
:
"
limit
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
options
"
:
option_list
}
});
}
// always add next
pointer
.
push
({
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
className
"
:
"
action
"
,
"
href
"
:
"
#
"
},
"
attributes
"
:
{
"
data-i18n
"
:
"
global_dict.next
"
,
"
data-action
"
:
"
next
"
,
"
data-icon
"
:
"
forward
"
,
"
data-iconpos
"
:
"
notext
"
},
"
logic
"
:
{
"
text
"
:
"
Next
"
}
});
// only add last button, if total is available
if
(
!
app
.
storage_dict
.
property_dict
.
skip_total_records
)
{
config
.
children
[
0
].
children
.
push
({
if
(
!
app
.
storage_dict
.
property_dict
.
skip_total_records
&&
!
spec
.
single
)
{
pointer
.
push
({
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
className
"
:
"
action
"
,
"
href
"
:
"
#
"
},
"
attributes
"
:
{
...
...
@@ -2953,22 +2973,6 @@
// content.set..., no need for dynamic content and pointer
map
.
actions
=
{
"
set_search
"
:
function
(
obj
)
{
factory
.
util
.
setDynamicPointer
(
obj
,
"
ui_panel_detail_search
"
);
},
"
set_filter
"
:
function
(
obj
)
{
factory
.
util
.
setDynamicPointer
(
obj
,
"
ui_panel_groups
"
);
},
"
set_sorting
"
:
function
(
obj
)
{
factory
.
util
.
setDynamicPointer
(
obj
,
"
ui_panel_sort
"
);
},
"
set_sales
"
:
function
(
obj
)
{
factory
.
util
.
setDynamicPointer
(
obj
,
"
ui_panel_sales
"
);
},
/**
* Look up single value from dict
* @method translateLookup
...
...
@@ -4856,32 +4860,33 @@
* @param {string} value New limit when changing number of records
*/
app
.
paginate
=
function
(
config
,
type
,
value
)
{
var
start
,
records
,
total
,
state
;
var
start
,
records
,
total
,
state
,
current_limit
;
state
=
config
.
state
;
total
=
state
.
total
;
current_limit
=
state
.
query
.
limit
||
state
.
initial_query
.
limit
;
if
(
config
.
gadget
)
{
if
(
state
)
{
if
(
state
&&
current_limit
)
{
switch
(
type
)
{
case
"
first
"
:
start
=
0
;
records
=
state
.
query
.
limit
[
1
];
records
=
current_
limit
[
1
];
break
;
case
"
next
"
:
start
=
state
.
query
.
limit
[
0
]
+
state
.
query
.
limit
[
1
];
records
=
state
.
query
.
limit
[
1
];
start
=
current_limit
[
0
]
+
current_
limit
[
1
];
records
=
current_
limit
[
1
];
break
;
case
"
prev
"
:
start
=
state
.
query
.
limit
[
0
]
-
state
.
query
.
limit
[
1
];
records
=
state
.
query
.
limit
[
1
];
start
=
current_limit
[
0
]
-
current_
limit
[
1
];
records
=
current_
limit
[
1
];
break
;
case
"
last
"
:
start
=
total
-
state
.
query
.
limit
[
1
];
records
=
state
.
query
.
limit
[
1
];
start
=
total
-
current_
limit
[
1
];
records
=
current_
limit
[
1
];
break
;
case
"
limit
"
:
start
=
state
.
query
.
limit
[
0
];
start
=
current_
limit
[
0
];
records
=
parseInt
(
value
,
null
);
break
;
}
...
...
@@ -4919,7 +4924,7 @@
.
fail
(
app
.
util
.
error
);
}
else
{
app
.
util
.
error
(
"
No state information stored for gadget
"
);
app
.
util
.
error
(
"
No state
/limit
information stored for gadget
"
);
}
}
else
{
app
.
util
.
error
(
"
Action is missing reference gadget
"
);
...
...
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