Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Implemented microscope addition.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggirelli committed Jun 13, 2019
1 parent 4996b30 commit 474a409
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions app/src/js/settings-microscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,28 @@ load_microscope_list = function() {
}
}

$(function() {
$("#settings-scope-tab").click(function(e) {
load_microscope_list();
add_microscope = function() {
// Add empty microscope
bootbox.prompt({
title: "How should we call the new microscope?",
callback: function(result) {
var selectedTemplate = eset.get("selected-template");
var microscope_list = eset.get("templates." + selectedTemplate + ".microscopes");
if ( result == null || 0 == result.length ) {
toastr.error("No microscope added.");
} else if ( -1 != microscope_list.indexOf(result) ) {
toastr.error("The provided name is already in use. Try again.");
} else {
microscope_list.push(result);
eset.set("templates." + selectedTemplate + ".microscopes", microscope_list);
load_microscope_list();
toastr.success("Added microscope '" + result + "'!");
}
}
});
}

$(function() {
$("#settings-scope-tab").click(function(e) { load_microscope_list(); });
$("#settings-add-microscope-btn").click(function(e) { add_microscope(); });
});

0 comments on commit 474a409

Please sign in to comment.