Commit f49e15de authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

Tool Pages: Start displaying current Scope

parent 47877c45
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
<body> <body>
<div class="nav_content save_load container"> <div class="nav_content save_load container">
<div class="nav_content container"> <div class="nav_content container">
<h1>CribJS Loader</h1> <h2>Update or Load: <a class="url-list-scope" href=""></a></h2>
<p>Update or Load CribJS from here</p>
</div> </div>
<div data-gadget-url="./gadget_zip_loader.html" <div data-gadget-url="./gadget_zip_loader.html"
data-gadget-scope="zip_loader" data-gadget-scope="zip_loader"
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
.allowPublicAcquisition("crib_sw_put", function (argument_list) { .allowPublicAcquisition("crib_sw_put", function (argument_list) {
return this.crib_sw_put(argument_list[0], argument_list[1]); return this.crib_sw_put(argument_list[0], argument_list[1]);
}) })
.declareAcquiredMethod("crib_sw_getScope", "crib_sw_getScope")
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var gadget = this; var gadget = this;
if (options === undefined) if (options === undefined)
...@@ -37,10 +38,20 @@ ...@@ -37,10 +38,20 @@
return gadget.props.start_deferred.resolve(); return gadget.props.start_deferred.resolve();
}) })
.push(function () { .push(function () {
return gadget.getDeclaredGadget("zip_loader"); return RSVP.all([
gadget.getDeclaredGadget("zip_loader"),
gadget.crib_sw_getScope()
]);
}) })
.push(function (zip_loader) { .push(function (result_list) {
return zip_loader.render(); var url_list_scope_link = gadget.props.element
.querySelector("a.url-list-scope");
gadget.props.scope = result_list[1];
url_list_scope_link.href = gadget.props.scope;
url_list_scope_link.innerHTML = gadget.props.scope
.split("//")[1].split(".")[0];
return result_list[0].render();
}); });
}); });
}(window, rJS)); }(window, rJS));
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
</head> </head>
<body> <body>
<div class="nav_content cribjs container"> <div class="nav_content cribjs container">
<h3>Editing: <a class="url-list-scope" href=""></a></h3>
<ul> <ul>
<li><a class="grep" href="#page=grep">Grep</a> among js and html files</li> <li><a class="grep" href="#page=grep">Grep</a> among js and html files</li>
<li><a class="jslint" href="#page=jslint">JSLint</a></li> <li><a class="jslint" href="#page=jslint">JSLint</a></li>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
// acquired methods // acquired methods
////////////////////////////////////////////// //////////////////////////////////////////////
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("crib_sw_getScope", "crib_sw_getScope")
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var gadget = this, var gadget = this,
page_list = ["select_site", "jslint", "mass_remove", "grep", page_list = ["select_site", "jslint", "mass_remove", "grep",
...@@ -29,15 +30,22 @@ ...@@ -29,15 +30,22 @@
page_list.forEach(function (page) { page_list.forEach(function (page) {
promise_list.push(gadget.getUrlFor({page: page})); promise_list.push(gadget.getUrlFor({page: page}));
}); });
promise_list.push(gadget.crib_sw_getScope());
// Handle main title // Handle main title
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all(promise_list); return RSVP.all(promise_list);
}) })
.push(function (link_list) { .push(function (link_list) {
for (var i = 0; i < link_list.length; i++) { var url_list_scope_link = gadget.props.element
.querySelector("a.url-list-scope");
for (var i = 0; i < page_list.length; i++) {
gadget.props.element.querySelector("." + page_list[i]).href = link_list[i]; gadget.props.element.querySelector("." + page_list[i]).href = link_list[i];
} }
gadget.props.scope = link_list[link_list.length - 1];
url_list_scope_link.href = gadget.props.scope;
url_list_scope_link.innerHTML = gadget.props.scope
.split("//")[1].split(".")[0];
}); });
}); });
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
data-gadget-sandbox="public"></div> data-gadget-sandbox="public"></div>
<div class="nav_content container"> <div class="nav_content container">
<form class="crib-load-from-zip-url form-inline"> <form class="crib-load-from-zip-url form-inline">
<h3>Fill This site from a zip URL</h3> <h3>Fill from a zip URL</h3>
<p>Leaving the Default parameter and validating will update CribJS Editor to the latest version. <p>Leaving the Default parameter and validating will update to the CribJS Editor latest version.
<br/><span>&#x26A0;&#xFE0F;</span> This will erase your changes to CribJS Editor</p> <br/><span>&#x26A0;&#xFE0F;</span> This will erase your changes to your app.</p>
<div class="form-group"> <div class="form-group">
<label>Zip Url: <label>Zip Url:
<input name="load-zip-url" class="load-zip-url form-control" <input name="load-zip-url" class="load-zip-url form-control"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment