Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
d97f6f80
Commit
d97f6f80
authored
Feb 01, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_run_my_doc: display erp5 image url using embedded image
parent
6c013429
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
10 deletions
+49
-10
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/slideeditor.gadget.js.js
...tem/portal_skins/erp5_run_my_doc/slideeditor.gadget.js.js
+16
-2
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/slideviewer.gadget.js.js
...tem/portal_skins/erp5_run_my_doc/slideviewer.gadget.js.js
+33
-8
No files found.
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/slideeditor.gadget.js.js
View file @
d97f6f80
/*global window, document, rJS, console, RSVP, domsugar*/
/*global window, document, rJS, console, RSVP, domsugar
, URL
*/
/*jslint nomen: true, maxlen:80, indent:2*/
/*jslint nomen: true, maxlen:80, indent:2*/
(
function
()
{
(
function
()
{
"
use strict
"
;
"
use strict
"
;
...
@@ -31,6 +31,16 @@
...
@@ -31,6 +31,16 @@
'
Image Caption
'
'
Image Caption
'
];
];
function
fixupERP5UrlCompatibility
(
jio_key
,
url
)
{
if
(
!
jio_key
)
{
return
url
;
}
return
new
URL
(
url
,
new
URL
(
jio_key
+
'
/
'
,
window
.
location
.
href
).
href
).
href
;
}
///////////////////////////////////////////////////
///////////////////////////////////////////////////
// translation
// translation
///////////////////////////////////////////////////
///////////////////////////////////////////////////
...
@@ -465,7 +475,10 @@
...
@@ -465,7 +475,10 @@
edit_element
,
edit_element
,
delete_element
,
delete_element
,
domsugar
(
'
img
'
,
{
domsugar
(
'
img
'
,
{
src
:
getSlideDictFromSlideElement
(
section_list
[
i
]).
image_url
,
src
:
fixupERP5UrlCompatibility
(
gadget
.
state
.
jio_key
,
getSlideDictFromSlideElement
(
section_list
[
i
]).
image_url
),
draggable
:
false
draggable
:
false
})
})
];
];
...
@@ -597,6 +610,7 @@
...
@@ -597,6 +610,7 @@
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
({
return
this
.
changeState
({
jio_key
:
options
.
jio_key
,
key
:
options
.
key
,
key
:
options
.
key
,
value
:
options
.
value
||
""
,
value
:
options
.
value
||
""
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/slideviewer.gadget.js.js
View file @
d97f6f80
/*global window, rJS, RSVP, domsugar, Reveal*/
/*global window, rJS, RSVP, domsugar, Reveal
, URL
*/
/*jslint nomen: true, maxlen:80, indent:2*/
/*jslint nomen: true, maxlen:80, indent:2*/
(
function
(
window
,
rJS
,
RSVP
,
domsugar
,
Reveal
)
{
(
function
(
window
,
rJS
,
RSVP
,
domsugar
,
Reveal
,
URL
)
{
"
use strict
"
;
"
use strict
"
;
function
fixupERP5UrlCompatibility
(
jio_key
,
url
)
{
if
(
!
jio_key
)
{
return
url
;
}
return
new
URL
(
url
,
new
URL
(
jio_key
+
'
/
'
,
window
.
location
.
href
).
href
).
href
;
}
function
getSlideElementList
(
presentation_html
)
{
function
getSlideElementList
(
presentation_html
)
{
// Convert to an Array so that array methods can be used to reorder slides
// Convert to an Array so that array methods can be used to reorder slides
return
Array
.
prototype
.
slice
.
call
(
domsugar
(
'
div
'
,
{
return
Array
.
prototype
.
slice
.
call
(
domsugar
(
'
div
'
,
{
...
@@ -23,7 +33,7 @@
...
@@ -23,7 +33,7 @@
return
fragment
;
return
fragment
;
}
}
function
cleanupSlide
(
slide_element
)
{
function
cleanupSlide
(
slide_element
,
jio_key
)
{
var
detail_list
=
Array
.
prototype
.
slice
.
call
(
var
detail_list
=
Array
.
prototype
.
slice
.
call
(
slide_element
.
querySelectorAll
(
'
:scope > details
'
)
slide_element
.
querySelectorAll
(
'
:scope > details
'
)
),
),
...
@@ -50,15 +60,29 @@
...
@@ -50,15 +60,29 @@
}
}
}
}
}
}
// Rewrite img url to support sub document ID
detail_list
=
Array
.
prototype
.
slice
.
call
(
slide_element
.
querySelectorAll
(
'
img
'
)
);
len
=
detail_list
.
length
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
detail_list
[
i
].
src
=
fixupERP5UrlCompatibility
(
jio_key
,
detail_list
[
i
].
getAttribute
(
'
src
'
)
)
}
return
slide_element
;
return
slide_element
;
}
}
function
cleanupPresentationFormat
(
presentation_html
)
{
function
cleanupPresentationFormat
(
presentation_html
,
jio_key
)
{
var
slide_list
=
getSlideElementList
(
presentation_html
),
var
slide_list
=
getSlideElementList
(
presentation_html
),
i
,
i
,
len
=
slide_list
.
length
;
len
=
slide_list
.
length
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
cleanupSlide
(
slide_list
[
i
]);
cleanupSlide
(
slide_list
[
i
]
,
jio_key
);
}
}
return
domsugar
(
'
div
'
,
{
class
:
'
reveal
'
},
[
return
domsugar
(
'
div
'
,
{
class
:
'
reveal
'
},
[
domsugar
(
'
div
'
,
{
class
:
'
slides
'
},
slide_list
)
domsugar
(
'
div
'
,
{
class
:
'
slides
'
},
slide_list
)
...
@@ -73,7 +97,8 @@
...
@@ -73,7 +97,8 @@
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
({
return
this
.
changeState
({
value
:
options
.
value
||
""
value
:
options
.
value
||
""
,
jio_key
:
options
.
jio_key
});
});
})
})
...
@@ -82,7 +107,7 @@
...
@@ -82,7 +107,7 @@
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
domsugar
(
gadget
.
element
,
[
domsugar
(
gadget
.
element
,
[
cleanupPresentationFormat
(
gadget
.
state
.
value
)
cleanupPresentationFormat
(
gadget
.
state
.
value
,
gadget
.
state
.
jio_key
)
]);
]);
return
Reveal
.
initialize
(
gadget
.
element
,
{
return
Reveal
.
initialize
(
gadget
.
element
,
{
...
@@ -112,4 +137,4 @@
...
@@ -112,4 +137,4 @@
});
});
}(
window
,
rJS
,
RSVP
,
domsugar
,
Reveal
));
}(
window
,
rJS
,
RSVP
,
domsugar
,
Reveal
,
URL
));
\ No newline at end of file
\ No newline at end of file
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