forked from GithubBackups/healthchecks
JS cleanup.
This commit is contained in:
parent
3e25e5c242
commit
6147451851
@ -7,7 +7,10 @@ $(function () {
|
||||
|
||||
$("#update-name-form").attr("action", url);
|
||||
$("#update-name-input").val(this.dataset.name);
|
||||
|
||||
var tagsSelectize = document.getElementById("update-tags-input").selectize;
|
||||
tagsSelectize.setValue(this.dataset.tags.split(" "));
|
||||
|
||||
$("#update-desc-input").val(this.dataset.desc);
|
||||
$('#update-name-modal').modal("show");
|
||||
$("#update-name-input").focus();
|
||||
@ -234,6 +237,10 @@ $(function () {
|
||||
});
|
||||
|
||||
// Configure Selectize for entering tags
|
||||
function divToOption() {
|
||||
return {value: this.textContent};
|
||||
}
|
||||
|
||||
$("#update-tags-input").selectize({
|
||||
create: true,
|
||||
createOnBlur: true,
|
||||
@ -241,12 +248,8 @@ $(function () {
|
||||
labelField: "value",
|
||||
searchField: ["value"],
|
||||
hideSelected: true,
|
||||
highlight: false
|
||||
});
|
||||
|
||||
var tagsSelectize = document.getElementById("update-tags-input").selectize;
|
||||
$("#my-checks-tags div").each(function(idx, el) {
|
||||
tagsSelectize.addOption({value: el.textContent});
|
||||
highlight: false,
|
||||
options: $("#my-checks-tags div").map(divToOption).get()
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -7,12 +7,7 @@ $(function () {
|
||||
});
|
||||
|
||||
// Configure Selectize for entering tags
|
||||
var options = [];
|
||||
var allTags = $("#update-tags-input").data("all-tags").split(" ");
|
||||
for (var i=0, tag; tag = allTags[i]; i++) {
|
||||
options.push({value: tag});
|
||||
}
|
||||
|
||||
$("#update-tags-input").selectize({
|
||||
create: true,
|
||||
createOnBlur: true,
|
||||
@ -21,7 +16,7 @@ $(function () {
|
||||
searchField: ["value"],
|
||||
hideSelected: true,
|
||||
highlight: false,
|
||||
options: options
|
||||
options: allTags.map(function(tag) { return {value: tag} })
|
||||
});
|
||||
|
||||
$("#new-check-alert a").click(function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user