aboutsummaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
authorLukas <LukBukkit@users.noreply.github.com>2019-10-16 21:28:41 +0200
committerLauris BH <lauris@nix.lv>2019-10-16 22:28:41 +0300
commitde4f10be86b207b087ba9781c628fe3d7b059f7b (patch)
tree6c522c45ad076b1dc167d65d2c2dc1d91cbda8d9 /public/js
parentd4cd4ed4422be222088dd8535a228b906f43fdc2 (diff)
downloadgitea-de4f10be86b207b087ba9781c628fe3d7b059f7b.tar.gz
gitea-de4f10be86b207b087ba9781c628fe3d7b059f7b.zip
Allow committing / adding empty files using the web ui (#8420) (#8532)
* Allow committing / adding empty files from the web ui (#8420) Signed-off-by: LukBukkit <luk.bukkit@gmail.com> * Add a modal to confirm the commit of an empty file Signed-off-by: LukBukkit <luk.bukkit@gmail.com>
Diffstat (limited to 'public/js')
-rw-r--r--public/js/index.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 11b2e75f2d..a903b219e7 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -262,7 +262,7 @@ function initRepoStatusChecker() {
location.reload();
return
}
-
+
setTimeout(function () {
initRepoStatusChecker()
}, 2000);
@@ -1571,6 +1571,18 @@ function initEditor() {
codeMirrorEditor.setOption("tabSize", editorconfig.tab_width || 4);
});
}).trigger('keyup');
+
+ $('#commit-button').click(function (event) {
+ // A modal which asks if an empty file should be committed
+ if ($editArea.val().length === 0) {
+ $('#edit-empty-content-modal').modal({
+ onApprove: function () {
+ $('.edit.form').submit();
+ }
+ }).modal('show');
+ event.preventDefault();
+ }
+ });
}
function initOrganization() {