mirror of
https://github.com/GNS3/gns3-registry.git
synced 2024-12-23 14:42:27 +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 %}
|
||||
{% for version in device["versions"] | reverse %}
|
||||
<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>
|
||||
{% for image in version.images.values() %}
|
||||
<h4>{{image["filename"]}}</h4>
|
||||
@ -27,7 +27,7 @@
|
||||
Download url: <a href="{{image["download_url"]}}">{{image["download_url"]}}</a><br />
|
||||
{% if "direct_download_url" in image %}
|
||||
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 %}
|
||||
<hr />
|
||||
{% endfor %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{% block script %}
|
||||
|
||||
function importDevice() {
|
||||
gns3.importDevice();
|
||||
gns3.button(function() { return gns3.importDevice(); });
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,21 @@
|
||||
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>")
|
||||
});
|
||||
|
||||
/*
|
||||
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>
|
||||
|
Loading…
Reference in New Issue
Block a user