mirror of
https://github.com/GNS3/gns3-registry.git
synced 2025-01-11 15:32:56 +00:00
Change button color to green or red when you click on them and succss et
error
This commit is contained in:
parent
52f7715d6b
commit
e657dc0960
@ -17,7 +17,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% for version in device["versions"] | reverse %}
|
{% for version in device["versions"] | reverse %}
|
||||||
<h2>{{ device["name"] }} {{version["name"]}}</h2>
|
<h2>{{ device["name"] }} {{version["name"]}}</h2>
|
||||||
<button class="btn btn-primary btn-lg" type="button" onclick='gns3.install("{{device|jsonify|b64encode}}", "{{version["name"]}}")'>Install</button>
|
<button class="btn btn-primary btn-lg" type="button" onclick='gns3.button(function() { return gns3.install("{{device|jsonify|b64encode}}", "{{version["name"]}}") })'>Install</button>
|
||||||
<h3>Require files</h3>
|
<h3>Require files</h3>
|
||||||
{% for image in version.images.values() %}
|
{% for image in version.images.values() %}
|
||||||
<h4>{{image["filename"]}}</h4>
|
<h4>{{image["filename"]}}</h4>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
Download url: <a href="{{image["download_url"]}}">{{image["download_url"]}}</a><br />
|
Download url: <a href="{{image["download_url"]}}">{{image["download_url"]}}</a><br />
|
||||||
{% if "direct_download_url" in image %}
|
{% if "direct_download_url" in image %}
|
||||||
Direct download url: <a href="{{image["direct_download_url"]}}">{{image["direct_download_url"]}}</a><br />
|
Direct download url: <a href="{{image["direct_download_url"]}}">{{image["direct_download_url"]}}</a><br />
|
||||||
<button class="btn btn-primary btn-lg" type="button" onclick='gns3.download("{{device|jsonify|b64encode}}", "{{image["md5sum"]}}")'>Download</button>
|
<button class="btn btn-primary btn-lg" type="button" onclick='gns3.button(function() { return gns3.download("{{device|jsonify|b64encode}}", "{{image["md5sum"]}}") })'>Download</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<hr />
|
<hr />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{% block script %}
|
{% block script %}
|
||||||
|
|
||||||
function importDevice() {
|
function importDevice() {
|
||||||
gns3.importDevice();
|
gns3.button(function() { return gns3.importDevice(); });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,21 @@
|
|||||||
var notif = $("#notif")
|
var notif = $("#notif")
|
||||||
notif.append("<div class=\"alert alert-success alert-dismissible fade in\" role=\"alert\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" + msg + "</div>")
|
notif.append("<div class=\"alert alert-success alert-dismissible fade in\" role=\"alert\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" + msg + "</div>")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
Deactivate the button after success click
|
||||||
|
*/
|
||||||
|
gns3.button = function(callback) {
|
||||||
|
var button = event.target;
|
||||||
|
$(button).removeClass("btn-primary");
|
||||||
|
if (callback()) {
|
||||||
|
$(button).addClass("btn-success");
|
||||||
|
button.onclick = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(button).addClass("btn-danger");
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
Reference in New Issue
Block a user