Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiocontents-nbextension
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
jiocontents-nbextension
Commits
324e20ff
Commit
324e20ff
authored
Nov 10, 2017
by
Sebastian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish replicating normal web-app setup (without UI)
parent
e16082c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
187 additions
and
54 deletions
+187
-54
gadget_jiocontents.js
gadget_jiocontents.js
+18
-2
gadget_jupyter_page.html
gadget_jupyter_page.html
+12
-14
gadget_jupyter_page.js
gadget_jupyter_page.js
+156
-0
jiocontents.js
jiocontents.js
+1
-38
No files found.
gadget_jiocontents.js
View file @
324e20ff
...
...
@@ -7,9 +7,25 @@
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
console
.
log
(
"
Jio Contents Gadget yes yes.
"
)
console
.
log
(
"
Jio Contents Gadget yes yes.
"
)
;
return
gadget
;
});
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
console
.
log
(
"
Rendering jio CONTENTS
"
);
this
.
jio_allDocs
({
query
:
'
portal_type: "Web JSON"
'
,
select_list
:
[
'
text_content
'
,
'
title
'
,
'
reference
'
],
//, 'modification_date'], NOT WORKING
// sort_on: [["modification_date", "descending"]], // NOT WORKING
limit
:
[
0
,
5
]
})
.
push
(
function
(
result
)
{
console
.
log
(
"
Querying Web JSON List
"
);
console
.
log
(
result
.
data
.
rows
);
},
function
(
err
)
{
console
.
log
(
err
);
});
})
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
);
}(
window
,
rJS
));
gadget_jupyter_page.html
View file @
324e20ff
...
...
@@ -2,20 +2,6 @@
<html>
<head>
<!--
<script data-renderjs-configuration="application_title" type="text/x-renderjs-configuration">ERP5</script>
<script data-renderjs-configuration="panel_gadget" type="text/x-renderjs-configuration">gadget_erp5_panel.html</script>
<script data-renderjs-configuration="action_view" type="text/x-renderjs-configuration">object_view</script>
<script data-renderjs-configuration="default_view_reference" type="text/x-renderjs-configuration">notebook_jio_view</script>
<script data-renderjs-configuration="hateoas_url" type="text/x-renderjs-configuration">hateoas/</script>
<script data-renderjs-configuration="frontpage_gadget" type="text/x-renderjs-configuration">jupytertest</script>
<script data-renderjs-configuration="jio_document_page_gadget" type="text/x-renderjs-configuration">form</script>
<script data-renderjs-configuration="language_map" type="text/x-renderjs-configuration">{"en": "English"}</script>
<script data-renderjs-configuration="default_selected_language" type="text/x-renderjs-configuration">en</script>
<script data-renderjs-configuration="website_url_set" type="text/x-renderjs-configuration">{"en": "http://softinst86155.host.vifib.net/erp5/web_site_module/renderjs_runner/"}</script>
<script data-renderjs-configuration="service_worker_url" type="text/x-renderjs-configuration"></script>
-->
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_jupyter_page.js"
></script>
...
...
@@ -23,10 +9,22 @@
</head>
<body>
<script
data-renderjs-configuration=
"application_title"
type=
"text/x-renderjs-configuration"
>
ERP5
</script>
<script
data-renderjs-configuration=
"action_view"
type=
"text/x-renderjs-configuration"
>
object_view
</script>
<script
data-renderjs-configuration=
"default_view_reference"
type=
"text/x-renderjs-configuration"
>
notebook_jio_view
</script>
<script
data-renderjs-configuration=
"hateoas_url"
type=
"text/x-renderjs-configuration"
>
hateoas
/
</script>
<div
data-gadget-url=
"gadget_jio.html"
data-gadget-scope=
"setting_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_erp5_jio.html"
data-gadget-scope=
"jio_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_jiocontents.html"
data-gadget-scope=
"jiocontents_gadget"
data-gadget-sandbox=
"public"
></div>
<div>
Hello renderJS + Jupyter
</div>
...
...
gadget_jupyter_page.js
View file @
324e20ff
...
...
@@ -5,10 +5,166 @@
var
gadget_klass
=
rJS
(
window
);
// SNIP
function
callJioGadget
(
gadget
,
method
,
param_list
)
{
var
called
=
false
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
[
method
].
apply
(
jio_gadget
,
param_list
);
});
}
gadget_klass
.
ready
(
function
()
{
console
.
log
(
"
Hello ready!
"
);
var
gadget
=
this
,
setting_gadget
,
setting
;
this
.
props
=
{
};
// Configure setting storage
return
gadget
.
getDeclaredGadget
(
"
setting_gadget
"
)
.
push
(
function
(
result
)
{
setting_gadget
=
result
;
return
setting_gadget
.
createJio
({
type
:
"
indexeddb
"
,
database
:
"
setting
"
});
})
.
push
(
function
()
{
return
setting_gadget
.
get
(
"
setting
"
)
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
return
{};
}
throw
error
;
});
})
.
push
(
function
(
result
)
{
setting
=
result
;
// Extract configuration parameters stored in HTML
// XXX Will work only if top gadget...
var
gadget_cont
=
document
.
querySelector
(
"
.gadget-jupyter-page-container
"
);
var
element_list
=
gadget_cont
.
querySelectorAll
(
"
script[data-renderjs-configuration]
"
),
len
=
element_list
.
length
,
key
,
value
,
i
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
key
=
element_list
[
i
].
getAttribute
(
'
data-renderjs-configuration
'
);
value
=
element_list
[
i
].
textContent
;
gadget
.
props
[
key
]
=
value
;
setting
[
key
]
=
value
;
}
// Calculate erp5 hateoas url
setting
.
hateoas_url
=
(
new
URI
(
gadget
.
props
.
hateoas_url
))
.
absoluteTo
(
location
.
href
)
.
toString
();
if
(
setting
.
hasOwnProperty
(
'
service_worker_url
'
)
&&
(
setting
.
service_worker_url
!==
''
))
{
if
(
navigator
.
serviceWorker
!==
undefined
)
{
// Check if a ServiceWorker already controls the site on load
if
(
!
navigator
.
serviceWorker
.
controller
)
{
// Register the ServiceWorker
navigator
.
serviceWorker
.
register
(
setting
.
service_worker_url
);
}
}
}
return
setting_gadget
.
put
(
"
setting
"
,
setting
);
})
.
push
(
function
()
{
// Configure jIO storage
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
createJio
(
setting
.
jio_storage_description
);
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
jiocontents_gadget
"
);
})
.
push
(
function
(
jiocontents_gadget
)
{
jiocontents_gadget
.
render
({});
});
})
.
allowPublicAcquisition
(
"
getSetting
"
,
function
(
argument_list
)
{
var
gadget
=
this
,
key
=
argument_list
[
0
],
default_value
=
argument_list
[
1
];
return
gadget
.
getDeclaredGadget
(
"
setting_gadget
"
)
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
get
(
"
setting
"
);
})
.
push
(
function
(
doc
)
{
return
doc
[
key
]
||
default_value
;
},
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
return
default_value
;
}
throw
error
;
});
})
.
allowPublicAcquisition
(
"
setSetting
"
,
function
(
argument_list
)
{
var
jio_gadget
,
gadget
=
this
,
key
=
argument_list
[
0
],
value
=
argument_list
[
1
];
return
gadget
.
getDeclaredGadget
(
"
setting_gadget
"
)
.
push
(
function
(
result
)
{
jio_gadget
=
result
;
return
jio_gadget
.
get
(
"
setting
"
);
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
return
{};
}
throw
error
;
})
.
push
(
function
(
doc
)
{
doc
[
key
]
=
value
;
return
jio_gadget
.
put
(
'
setting
'
,
doc
);
});
})
.
allowPublicAcquisition
(
"
jio_allDocs
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
allDocs
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_remove
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
remove
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_post
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
post
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_put
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
put
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_get
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
get
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_allAttachments
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
allAttachments
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_getAttachment
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
getAttachment
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_putAttachment
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
putAttachment
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_removeAttachment
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
removeAttachment
"
,
param_list
);
})
.
allowPublicAcquisition
(
"
jio_repair
"
,
function
(
param_list
)
{
return
callJioGadget
(
this
,
"
repair
"
,
param_list
);
});
}(
window
,
rJS
,
RSVP
));
\ No newline at end of file
jiocontents.js
View file @
324e20ff
...
...
@@ -12,6 +12,7 @@ define(function(require) {
var
gadget_div
=
document
.
createElement
(
"
div
"
);
gadget_div
.
setAttribute
(
"
data-gadget-url
"
,
baseUrl
+
"
/gadget_jupyter_page.html
"
);
gadget_div
.
setAttribute
(
"
class
"
,
"
gadget-jupyter-page-container
"
);
document
.
body
.
append
(
gadget_div
);
var
s1
=
document
.
createElement
(
"
script
"
);
s1
.
type
=
"
text/javascript
"
;
...
...
@@ -27,45 +28,7 @@ define(function(require) {
};
s1
.
src
=
baseUrl
+
"
/rsvp.js
"
;
document
.
head
.
append
(
s1
);
/*
var gadget_div = document.createElement("div");
gadget_div.setAttribute("data-gadget-url", "/nbextensions/jiocontents/gadget_jiocontents.html");
document.body.append(gadget_div);
var baseUrl = "https://softinst86155.host.vifib.net/erp5/web_site_module/renderjs_runner";
var s1 = document.createElement("script"); s1.type = "text/javascript";
s1.onload = function() {
console.log("loaded rsvp");
var s2 = document.createElement("script"); s2.type = "text/javascript";
s2.onload = function() {
console.log("loaded renderjs");
rJS.manualBootstrap();
}
s2.src = baseUrl + "/renderjs.js";
document.head.append(s2);
};
s1.src = baseUrl + "/rsvp.js";
document.head.append(s1);
*/
/*
$.getScript(baseUrl + "/rsvp.js", function() {
console.log("~~~ rsvp loaded");
$.getScript(baseUrl + "/renderjs.js", function() {
console.log("~~~ renderjs loaded");
rJS.manualBootstrap();
});
});
$.getScript("/nbextensions/jiocontents/rsvp-2.0.4.min.js", function() {
console.log("~~ loading_gadget: rsvp.js loaded");
$.getScript("/nbextensions/jiocontents/renderjs-latest.js", function() {
console.log("~~ loading_gadget: renderjs.js loaded");
rJS.manualBootstrap();
});
});
*/
var
Contents
=
function
(
options
)
{
/**
...
...
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