Commit ff23b4fa authored by Ivanq's avatar Ivanq

Save hook settings

parent 8604544f
......@@ -119,6 +119,14 @@ class Repository {
})
.then(() => this.sign());
}
changeHooks(hooks) {
return this.getContent()
.then(content => {
content.hooks = hooks;
return this.setContent(content);
})
.then(() => this.sign());
}
install(title, description, address) {
let auth, content;
return this.getContent()
......@@ -135,6 +143,7 @@ class Repository {
content.signers = [auth.address];
content.installed = true;
content.git = address;
content.hooks = false;
return this.setContent(content);
})
.then(() => {
......
......@@ -111,6 +111,21 @@
</div>
</div>
<div class="entry">
<div class="entry-title">
Hooks
<img src="../../img/info.svg" height="16" title="Automatically fetch ZeroNet before pushing and sign changes after pushing via hooks">
</div>
<div class="entry-value">
<select class="select" id="hooks_select">
<option value="enabled">Enabled</option>
<option value="disabled">Disabled</option>
</select>
<a class="button entry-value-margin" id="hooks_save">Save</a>
</div>
</div>
<template id="edit_icon_tmpl">
<img src="../../img/edit.svg" class="edit-icon" id="edit_icon" width="16" height="16">
</template>
......
......@@ -24,6 +24,26 @@ repo.addMerger()
showHeader(1, content.git);
showTabs(1);
// Hooks
let hooksSelect = document.getElementById("hooks_select");
hooksSelect.value = content.hooks ? "enabled" : "disabled";
let hooksSave = document.getElementById("hooks_save");
hooksSave.onclick = () => {
if(hooksSave.classList.contains("button-disabled")) {
return;
}
hooksSave.classList.add("button-disabled");
repo.changeHooks(hooksSelect.value == "enabled")
.then(() => {
hooksSave.classList.remove("button-disabled");
}, e => {
zeroPage.error(e);
hooksSave.classList.remove("button-disabled");
});
};
// Description
let input = document.getElementById("description");
let button = document.getElementById("description_save");
......
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