summaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
author无闻 <joe2010xtmf@163.com>2014-07-26 13:55:32 -0400
committer无闻 <joe2010xtmf@163.com>2014-07-26 13:55:32 -0400
commit02a81ddb6252d1a08900d548ddb63e41bcb0b8ef (patch)
tree1ba34cc4cf25001f86aee67962ed1aa9ed0069f0 /public/js
parent27a51f5bcc928b046b865e24a665b38cbf3e01b5 (diff)
parent6407caa7610badd817c6691c1b8db60120986fa8 (diff)
downloadgitea-02a81ddb6252d1a08900d548ddb63e41bcb0b8ef.tar.gz
gitea-02a81ddb6252d1a08900d548ddb63e41bcb0b8ef.zip
Merge pull request #332 from acusti/dev
Styling plus a couple small fixes for issue attachments (& misc cleanup)
Diffstat (limited to 'public/js')
-rw-r--r--public/js/app.js38
1 files changed, 18 insertions, 20 deletions
diff --git a/public/js/app.js b/public/js/app.js
index eb3eb6b5a7..9451407b1e 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -470,8 +470,8 @@ function initRepository() {
function initInstall() {
// database type change
(function () {
- var mysql_default = '127.0.0.1:3306'
- var postgres_default = '127.0.0.1:5432'
+ var mysql_default = '127.0.0.1:3306';
+ var postgres_default = '127.0.0.1:5432';
$('#install-database').on("change", function () {
var val = $(this).val();
@@ -621,11 +621,9 @@ function initIssue() {
// Upload.
(function() {
var $attachedList = $("#attached-list");
- var $addButton = $("#attachments-button");
-
- var files = [];
-
- var fileInput = document.getElementById("attachments-input");
+ var $addButton = $("#attachments-button");
+ var files = [];
+ var fileInput = document.getElementById("attachments-input");
if (fileInput === null) {
return;
@@ -637,21 +635,21 @@ function initIssue() {
files.splice($parent.data("index"), 1);
$parent.remove();
});
-
- var clickedButton = undefined;
-
- $("button,input[type=\"submit\"]", fileInput.form).on("click", function() {
+
+ var clickedButton;
+
+ $('#issue-reply-btn,input[type="submit"]', fileInput.form).on('click', function() {
clickedButton = this;
var $button = $(this);
- $button.removeClass("btn-success");
+ $button.removeClass("btn-success btn-default");
$button.addClass("btn-warning");
- $button.text("Submiting...");
+ $button.text("Submitting&hellip;");
});
- fileInput.form.addEventListener("submit", function(event) {
+ fileInput.form.addEventListener("submit", function(event) {
event.stopImmediatePropagation();
event.preventDefault();
@@ -677,7 +675,7 @@ function initIssue() {
var xhr = new XMLHttpRequest();
xhr.addEventListener("error", function() {
- debugger;
+ console.log("Issue submit request failed. xhr.status: " + xhr.status);
});
xhr.addEventListener("load", function() {
@@ -700,7 +698,7 @@ function initIssue() {
$button.removeClass("btn-warning");
$button.addClass("btn-danger");
- $button.text("An error encoured!")
+ $button.text("An error occurred!");
return;
}
@@ -728,7 +726,7 @@ function initIssue() {
return false;
});
- fileInput.addEventListener("change", function(event) {
+ fileInput.addEventListener("change", function() {
for (var index = 0; index < fileInput.files.length; index++) {
var file = fileInput.files[index];
@@ -754,9 +752,9 @@ function initIssue() {
this.value = "";
});
- $addButton.on("click", function() {
+ $addButton.on("click", function(evt) {
fileInput.click();
- return false;
+ evt.preventDefault();
});
}());
@@ -769,7 +767,7 @@ function initIssue() {
$('.issue-edit-cancel').on("click", function () {
$('#issue h1.title,#issue .issue-main > .issue-content .content,#issue-edit-btn').toggleShow();
$('#issue-edit-title,.issue-edit-content,.issue-edit-cancel,.issue-edit-save').toggleHide();
- })
+ });
}());
// issue ajax update