summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorJustin Nuß <justin.nuss@hmmh.de>2014-07-25 11:13:42 +0200
committerJustin Nuß <justin.nuss@hmmh.de>2014-07-25 11:13:42 +0200
commit12fb42de5a5b07ed8dffe91d9536615bbadeedea (patch)
tree447b1b7a2b7fec37d0409c4a6aa46fd8cd7b3fdc /public
parent4e2477a1a5ae59ff4cb34d58eab74297b4ea2d24 (diff)
downloadgitea-12fb42de5a5b07ed8dffe91d9536615bbadeedea.tar.gz
gitea-12fb42de5a5b07ed8dffe91d9536615bbadeedea.zip
Fix IE bug and show errors.
Diffstat (limited to 'public')
-rwxr-xr-xpublic/css/gogs.css7
-rw-r--r--public/js/app.js36
2 files changed, 37 insertions, 6 deletions
diff --git a/public/css/gogs.css b/public/css/gogs.css
index cc48f211f4..361475bd40 100755
--- a/public/css/gogs.css
+++ b/public/css/gogs.css
@@ -1836,4 +1836,11 @@ body {
#issue-create-form #attached {
margin-bottom: 0;
+}
+
+#submit-error {
+ display: none;
+ padding: 10px 15px 15px 15px;
+ font-weight: bold;
+ text-align: center;
} \ No newline at end of file
diff --git a/public/js/app.js b/public/js/app.js
index a88c8f6bc7..b0dff0efc8 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -568,7 +568,7 @@ function initIssue() {
};
var out = function() {
- $hoverElement.hide();
+ //$hoverElement.hide();
};
$(".issue-main .attachments .attachment").hover(over, out);
@@ -598,6 +598,13 @@ function initIssue() {
$("button,input[type=\"submit\"]", fileInput.form).on("click", function() {
clickedButton = this;
+
+ var $button = $(this);
+
+ $button.removeClass("btn-success");
+ $button.addClass("btn-warning");
+
+ $button.text("Submiting...");
});
fileInput.form.addEventListener("submit", function(event) {
@@ -630,16 +637,33 @@ function initIssue() {
});
xhr.addEventListener("load", function() {
- if (xhr.response.ok === false) {
- $("#submit-error").text(xhr.response.error);
+ var response = xhr.response;
+
+ if (typeof response == "string") {
+ try {
+ response = JSON.parse(response);
+ } catch (err) {
+ response = { ok: false, error: "Could not parse JSON" };
+ }
+ }
+
+ if (response.ok === false) {
+ $("#submit-error").text(response.error);
+ $("#submit-error").show();
+
+ var $button = $(clickedButton);
+
+ $button.removeClass("btn-warning");
+ $button.addClass("btn-danger");
+
+ $button.text("An error encoured!")
+
return;
}
- window.location.href = xhr.response.data;
+ window.location.href = response.data;
});
- xhr.responseType = "json";
-
xhr.open("POST", this.action, true);
xhr.send(data);