Commit 6886f2a5 authored by Ivanq's avatar Ivanq

Hide 'New file' and 'Edit' if user is not an owner

parent ac7cd5b2
......@@ -41,4 +41,8 @@
width: 16px;
margin-right: 8px;
vertical-align: top;
}
.new-file {
display: none;
}
\ No newline at end of file
......@@ -34,4 +34,8 @@
font-family: Consolas, "Courier New", monospace;
white-space: pre;
overflow: auto;
}
.edit {
display: none;
}
\ No newline at end of file
......@@ -94,7 +94,7 @@
</table>
<div class="info">
<a class="button" id="edit">Edit</a>
<a class="button edit" id="edit">Edit</a>
</div>
<script type="text/javascript" src="../../js/ZeroFrame.js"></script>
......
......@@ -20,7 +20,13 @@ repo.addMerger()
showLinks();
showTabs(1);
document.getElementById("edit").href = "../edit/?" + address + "/" + path.replace(/@/g, "@@") + "@" + branch.replace(/@/g, "@@");
repo.isSignable()
.then(signable => {
if(signable) {
document.getElementById("edit").style.display = "inline-block";
document.getElementById("edit").href = "../edit/?" + address + "/" + path.replace(/@/g, "@@") + "@" + branch.replace(/@/g, "@@");
}
});
return branch || repo.git.getHead();
})
......
......@@ -95,7 +95,7 @@
</table>
<div class="info">
<a class="button" id="new_file">New file</a>
<a class="button new-file" id="new_file">New file</a>
</div>
<script type="text/javascript" src="../js/ZeroFrame.js"></script>
......
......@@ -20,7 +20,13 @@ repo.addMerger()
showLinks();
showTabs(0);
document.getElementById("new_file").href = "newfile/?" + address + "/" + path.replace(/@/g, "@@") + "@" + branch.replace(/@/g, "@@");
repo.isSignable()
.then(signable => {
if(signable) {
document.getElementById("new_file").style.display = "inline-block";
document.getElementById("new_file").href = "newfile/?" + address + "/" + path.replace(/@/g, "@@") + "@" + branch.replace(/@/g, "@@");
}
});
return branch || repo.git.getHead();
})
......
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