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
b9301b7b
Commit
b9301b7b
authored
Jan 22, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hack link to fetch invoice PDF file, hack field displays
parent
1a67168a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
18 deletions
+48
-18
data/invoice_overview.json
data/invoice_overview.json
+1
-1
js/erp5_loader.js
js/erp5_loader.js
+45
-17
lang/en-EN/dict.json
lang/en-EN/dict.json
+2
-0
No files found.
data/invoice_overview.json
View file @
b9301b7b
...
...
@@ -41,7 +41,7 @@
{
"field"
:
"total_price"
,
"show"
:
true
,
"persist"
:
true
,
"sort"
:
false
},
{
"field"
:
"price_currency"
,
"show"
:
"true"
,
"priority"
:
4
,
"merge"
:
"total_price"
},
{
"field"
:
"translated_simulation_state_title"
,
"show"
:
"true"
,
"priority"
:
5
},
{
"custom"
:
true
,
"show"
:
true
,
"persist"
:
true
,
"sort"
:
false
,
"action_list"
:
[{
"
setters"
:
[
"data-method"
,
"href"
],
"setValues"
:[[
"_actions"
,
"destroy"
,
"method"
],
[
"_actions"
,
"destroy"
,
"href"
]],
"
class_list"
:
"action translate"
,
"action"
:
"download"
,
"icon"
:
"file-alt"
,
"text"
:
"Download"
,
"text_i18n"
:
"portable_type_dict.invoice_dict.download"
}]}
{
"custom"
:
true
,
"show"
:
true
,
"persist"
:
true
,
"sort"
:
false
,
"action_list"
:
[{
"class_list"
:
"action translate"
,
"action"
:
"download"
,
"icon"
:
"file-alt"
,
"text"
:
"Download"
,
"text_i18n"
:
"portable_type_dict.invoice_dict.download"
}]}
]
}
],
...
...
js/erp5_loader.js
View file @
b9301b7b
...
...
@@ -1084,6 +1084,29 @@
.
fail
(
util
.
error
);
},
/**
* Download a document as pdf
* @method download
* @param {string} type
* @param {string} portal type
* @param {string} identifier
**/
"
download
"
:
function
(
obj
)
{
console
.
log
(
obj
)
util
.
loader
(
""
,
"
status_dict.downloading
"
);
storage
[
"
items
"
].
get
({
"
_id
"
:
obj
.
element
.
href
.
split
(
"
/
"
).
pop
()},{
"
_view
"
:
"
web_view
"
})
.
then
(
function
(
response
)
{
util
.
loader
(
""
,
"
status_dict.rendering
"
);
window
.
location
.
href
=
util
.
parse
(
response
).
data
.
_links
.
slapos_jump
.
href
;
})
.
fail
(
function
(
error
){
util
.
error
(
error
);
util
.
loader
(
""
,
"
status_dict.failed
"
,
"
ban-circle
"
);
});
},
/**
* Look up single value from dict
* @method translateLookup
...
...
@@ -1456,18 +1479,6 @@
factory
.
util
.
setPopupPointer
(
obj
,
"
export
"
);
},
/**
* Download a document as pdf
* @method download
* @param {string} type
* @param {string} portal type
* @param {string} identifier
**/
"
download
"
:
function
(
obj
)
{
console
.
log
(
obj
)
util
.
error
(
"
Download: Not implemented.
"
);
},
/**
* Generic pagination method changing number of records displayed
* @method limit
...
...
@@ -1636,8 +1647,8 @@
// TODO: action menu handling...?
// TODO: should we set properties.config here or ?
"
mapTableRows
"
:
function
(
items
,
spec
,
field_dict
,
url_pointer
,
update
)
{
var
arr
,
obj
,
cell
,
row
,
i
,
j
,
k
,
m
,
n
,
section
,
label
,
props
,
core
,
item
,
level
,
scheme
,
segment
;
var
arr
,
obj
,
cell
,
row
,
i
,
j
,
k
,
m
,
n
,
o
,
section
,
label
,
props
,
core
,
item
,
level
,
scheme
,
segment
,
p
;
if
(
spec
.
scheme
===
undefined
)
{
util
.
error
(
"
mapTableRows: Missing scheme
"
);
...
...
@@ -1716,6 +1727,13 @@
// action menu
if
(
props
.
action_menu
&&
cell
.
action_list
)
{
// HACK to add correct HREF and reference
if
(
item
.
_relative_url
)
{
for
(
o
=
0
;
o
<
cell
.
action_list
.
length
;
o
+=
1
)
{
cell
.
action_list
[
o
].
reference
=
spec
.
set_id
;
cell
.
action_list
[
o
].
href
=
window
.
encodeURIComponent
(
item
.
_relative_url
);
}
}
cell
.
action_list
=
cell
.
action_list
||
[];
}
...
...
@@ -1724,9 +1742,19 @@
cell
.
image
=
item
[
cell
.
field
];
}
else
{
// custom cells have text/text_i18n defined
// more HACK:
if
(
cell
.
custom
===
undefined
)
{
cell
.
text
=
item
[
cell
.
field
];
cell
.
text_i18n
=
item
[
cell
.
field
+
"
_i18n
"
]
||
null
if
(
cell
.
field
===
"
price_currency
"
)
{
cell
.
text
=
item
[
cell
.
field
].
split
(
"
/
"
).
pop
();
cell
.
text_i18n
=
null
;
}
else
{
if
(
!
isNaN
(
parseFloat
(
item
[
cell
.
field
]))
&&
isFinite
(
item
[
cell
.
field
]))
{
cell
.
text
=
Math
.
round
(
item
[
cell
.
field
]).
toFixed
(
2
);
}
else
{
cell
.
text
=
item
[
cell
.
field
];
}
cell
.
text_i18n
=
item
[
cell
.
field
+
"
_i18n
"
]
||
null
}
}
}
// add cell to row
...
...
@@ -2786,6 +2814,7 @@
}
}
dict
[
"
data-action
"
]
=
button
.
action
;
dict
[
"
data-reference
"
]
=
button
.
reference
;
config
.
children
.
push
({
"
type
"
:
"
a
"
,
...
...
@@ -7538,7 +7567,6 @@
convert
=
"
values
"
;
}
console
.
log
(
parcel
.
query
)
return
storage
[
parcel
.
storage
][
method
||
"
allDocs
"
](
parcel
.
query
,
hacked_view
)
.
then
(
function
(
response
)
{
// TODO: best way?
...
...
lang/en-EN/dict.json
View file @
b9301b7b
...
...
@@ -56,6 +56,8 @@
"uploading"
:
"Uploading"
,
"fetching"
:
"Fetching Data"
,
"storing"
:
"Storing Data"
,
"downloading"
:
"Downloading"
,
"rendering"
:
"Rendering"
,
"saving"
:
"Saving"
,
"saved"
:
"Saved"
,
"failed"
:
"Failed"
,
...
...
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