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
f7a641e7
Commit
f7a641e7
authored
Mar 31, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app: add configurable action button (default search)
parent
2ad4cc98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
31 deletions
+57
-31
js/erp5_loader.js
js/erp5_loader.js
+57
-31
No files found.
js/erp5_loader.js
View file @
f7a641e7
...
@@ -483,21 +483,25 @@
...
@@ -483,21 +483,25 @@
}
}
// add action button
// add action button
// TODO: should this be a submit via option?
if
(
spec
.
logic
.
action
)
{
if
(
spec
.
logic
.
action
)
{
container
.
appendChild
(
factory
.
element
({
container
.
appendChild
(
factory
.
element
({
"
type
"
:
"
a
"
,
"
type
"
:
"
a
"
,
"
direct
"
:
{
"
direct
"
:
{
"
title
"
:
"
Search
"
,
"
title
"
:
spec
.
logic
.
action
.
text
||
"
Search
"
,
"
className
"
:
"
action ui-input-action ui-btn ui-icon-search
"
+
"
className
"
:
"
ui-input-action ui-btn ui-icon-
"
+
"
ui-btn-icon-notext ui-corner-all translate
"
,
(
spec
.
logic
.
action
.
icon
||
"
search
"
)
+
"
ui-btn-icon-notext ui-corner-all translate
"
,
"
href
"
:
"
#
"
"
href
"
:
"
#
"
},
},
"
attributes
"
:
{
"
attributes
"
:
{
"
data-i18n
"
:
"
global_dict.search
"
,
"
data-i18n
"
:
(
"
[title]
"
+
spec
.
logic
.
action
.
text_i18n
+
"
;
"
+
spec
.
logic
.
action
.
text_i18n
)
||
"
[title]global_dict.search;global_dict.search
"
,
"
tabindex
"
:
"
-1
"
,
"
tabindex
"
:
"
-1
"
,
"
data-action
"
:
"
search
"
"
data-action
"
:
spec
.
logic
.
action
.
action
||
"
search
"
},
},
"
logic
"
:
{
"
text
"
:
"
Search
"
}
"
logic
"
:
{
"
text
"
:
spec
.
logic
.
action
.
text
||
"
Search
"
}
}));
}));
}
}
...
@@ -802,7 +806,7 @@
...
@@ -802,7 +806,7 @@
},
},
"
logic
"
:
{}
"
logic
"
:
{}
});
});
// TODO?
// TODO?
if
(
spec
.
form
)
{
if
(
spec
.
form
)
{
target
.
appendChild
(
factory
.
element
({
target
.
appendChild
(
factory
.
element
({
...
@@ -837,7 +841,12 @@
...
@@ -837,7 +841,12 @@
* "id": null,
* "id": null,
* "title": "",
* "title": "",
* "title_i18n":"",
* "title_i18n":"",
* "fixed": true
* "fixed": true,
* "image": {
* "src": null,
* "alt": null,
* "alt_i18n": null
* }
* },
* },
* "children": [],
* "children": [],
* }
* }
...
@@ -846,25 +855,13 @@
...
@@ -846,25 +855,13 @@
* @return {object} object including fragment, child-selector, placeholder
* @return {object} object including fragment, child-selector, placeholder
*/
*/
factory
.
widget
.
header
=
function
(
spec
)
{
factory
.
widget
.
header
=
function
(
spec
)
{
var
container
,
id
,
t
itle
,
t
arget
,
fragment
;
var
container
,
id
,
target
,
fragment
;
container
=
document
.
createDocumentFragment
();
container
=
document
.
createDocumentFragment
();
id
=
spec
.
id
||
((
spec
.
data_url
||
"
global
"
)
+
"
-header
"
);
id
=
spec
.
id
||
((
spec
.
data_url
||
"
global
"
)
+
"
-header
"
);
// generate title (needed for JQM), default to empty string
title
=
factory
.
element
({
"
type
"
:
"
h1
"
,
"
direct
"
:
{
"
className
"
:
"
translate ui-title
"
},
"
attributes
"
:
{
"
data-i18n
"
:
spec
.
title_i18n
||
""
,
"
role
"
:
"
heading
"
,
"
aria-level
"
:
"
1
"
},
"
logic
"
:
{
"
text
"
:
spec
.
title
||
"
\
u00A0
"
}
});
// button group wrappers and title (inserted before last wrapper!)
// button group wrappers and title (inserted before last wrapper!)
target
=
function
(
j
,
len
)
{
target
=
function
(
j
,
len
,
conf
)
{
switch
(
true
)
{
switch
(
true
)
{
case
(
j
===
0
):
case
(
j
===
0
):
return
factory
.
element
({
return
factory
.
element
({
...
@@ -873,7 +870,28 @@
...
@@ -873,7 +870,28 @@
});
});
case
(
j
===
len
-
1
):
case
(
j
===
len
-
1
):
fragment
=
document
.
createDocumentFragment
();
fragment
=
document
.
createDocumentFragment
();
fragment
.
appendChild
(
title
);
if
(
conf
.
img
)
{
fragment
.
appendChild
(
factory
.
element
({
"
type
"
:
"
img
"
,
"
direct
"
:
{
"
src
"
:
conf
.
src
},
"
attributes
"
:
{
"
alt
"
:
conf
.
title
},
"
logic
"
:
{
"
data-i18n
"
:
config
.
title_i18n
?
(
"
[alt]
"
+
config
.
title_i18n
)
:
null
}
}));
}
else
{
fragment
.
appendChild
(
factory
.
element
({
"
type
"
:
"
h1
"
,
"
direct
"
:
{
"
className
"
:
"
translate ui-title
"
},
"
attributes
"
:
{
"
data-i18n
"
:
conf
.
title_i18n
||
""
,
"
role
"
:
"
heading
"
,
"
aria-level
"
:
"
1
"
},
"
logic
"
:
{
"
text
"
:
conf
.
title
||
"
\
u00A0
"
}
}));
}
fragment
.
appendChild
(
fragment
.
appendChild
(
factory
.
element
({
factory
.
element
({
"
type
"
:
"
div
"
,
"
type
"
:
"
div
"
,
...
@@ -909,7 +927,13 @@
...
@@ -909,7 +927,13 @@
"
fragment
"
:
container
,
"
fragment
"
:
container
,
"
child_selector
"
:
container
.
querySelector
(
"
#
"
+
id
),
"
child_selector
"
:
container
.
querySelector
(
"
#
"
+
id
),
"
target
"
:
target
,
"
target
"
:
target
,
"
target_selector
"
:
"
last
"
"
target_selector
"
:
"
last
"
,
"
spec
"
:
{
"
img
"
:
spec
.
image
,
"
src
"
:
spec
.
src
,
"
title
"
:
spec
.
title
||
spec
.
alt
,
"
title_i18n
"
:
spec
.
title_i18n
||
spec
.
alt_i18n
}
};
};
};
};
...
@@ -1344,7 +1368,7 @@
...
@@ -1344,7 +1368,7 @@
"
attributes
"
:
{
"
attributes
"
:
{
"
data-role
"
:
"
panel
"
,
"
data-role
"
:
"
panel
"
,
"
data-theme
"
:
spec
.
theme
,
"
data-theme
"
:
spec
.
theme
,
"
data-position
"
:
"
left
"
,
"
data-position
"
:
spec
.
position
||
"
left
"
,
"
data-display
"
:
"
push
"
,
"
data-display
"
:
"
push
"
,
"
data-position-fixed
"
:
true
"
data-position-fixed
"
:
true
},
},
...
@@ -2666,7 +2690,7 @@
...
@@ -2666,7 +2690,7 @@
}
}
obj
.
gadget
.
setAttribute
(
"
data-reference
"
,
pointer
);
obj
.
gadget
.
setAttribute
(
"
data-reference
"
,
pointer
);
};
};
/* ====================================================================== */
/* ====================================================================== */
/* MAPPING */
/* MAPPING */
...
@@ -3232,7 +3256,7 @@
...
@@ -3232,7 +3256,7 @@
app
.
search
(
obj
);
app
.
search
(
obj
);
}
}
};
};
/* ********************************************************************** */
/* ********************************************************************** */
/* Mapper Generic Element */
/* Mapper Generic Element */
/* ********************************************************************** */
/* ********************************************************************** */
...
@@ -4183,7 +4207,7 @@
...
@@ -4183,7 +4207,7 @@
if
(
field
.
field
&&
select_list
.
indexOf
(
field
.
field
)
===
-
1
)
{
if
(
field
.
field
&&
select_list
.
indexOf
(
field
.
field
)
===
-
1
)
{
select_list
.
push
(
field
.
field
);
select_list
.
push
(
field
.
field
);
}
}
}
}
}
}
// if nothing is to be fetched, make sure we return at least the _id
// if nothing is to be fetched, make sure we return at least the _id
if
(
select_list
.
length
===
0
&&
select_list
.
indexOf
(
"
_id
"
)
===
-
1
)
{
if
(
select_list
.
length
===
0
&&
select_list
.
indexOf
(
"
_id
"
)
===
-
1
)
{
...
@@ -5916,7 +5940,7 @@
...
@@ -5916,7 +5940,7 @@
// ============= TODO: improve property_dict generation ==============
// ============= TODO: improve property_dict generation ==============
// TODO: no all elements need them?
// TODO: no all elements need them?
// TODO:
// TODO:
// wrapper object and properties
// wrapper object and properties
quirk_dict
=
util
.
mergeObject
(
quirk_dict
=
util
.
mergeObject
(
(
pass
[
method
?
"
content_dict
"
:
"
config_dict
"
].
property_dict
),
(
pass
[
method
?
"
content_dict
"
:
"
config_dict
"
].
property_dict
),
...
@@ -5938,7 +5962,7 @@
...
@@ -5938,7 +5962,7 @@
if
(
quirk_dict
.
skip
)
{
if
(
quirk_dict
.
skip
)
{
if
(
!
pass
.
content_dict
.
generate
)
{
if
(
!
pass
.
content_dict
.
generate
)
{
route
=
type
;
route
=
type
;
// force custom elements into form layout...
// force custom elements into form layout...
if
(
pass
.
content_dict
.
logic
&&
pass
.
content_dict
.
logic
.
route
)
{
if
(
pass
.
content_dict
.
logic
&&
pass
.
content_dict
.
logic
.
route
)
{
route
=
pass
.
content_dict
.
logic
.
route
;
route
=
pass
.
content_dict
.
logic
.
route
;
}
}
...
@@ -6187,10 +6211,12 @@
...
@@ -6187,10 +6211,12 @@
target
=
undefined
;
target
=
undefined
;
if
(
response
)
{
if
(
response
)
{
// generate target for and append response
// generate target for and append response
// NOTE: wrapper.spec is used for header only
if
(
wrapper
.
target
)
{
if
(
wrapper
.
target
)
{
wrapper_selector
=
wrapper
.
target
(
wrapper_selector
=
wrapper
.
target
(
wrapper
.
child_selector
.
children
.
length
,
wrapper
.
child_selector
.
children
.
length
,
kids
.
length
kids
.
length
,
wrapper
.
spec
);
);
// NOTE: wrapper_selector will return a fragment (set to
// NOTE: wrapper_selector will return a fragment (set to
// first/last-ElementChild or a DOM node
// first/last-ElementChild or a DOM node
...
...
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