From c084a5ba735144576cffbdfe3b193fc9fc8e67f8 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 15:35:47 -0400 Subject: [PATCH 1/8] =?UTF-8?q?Style=20finesse=20for=20=E2=80=9CAttachment?= =?UTF-8?q?s:=E2=80=9D=20list=20in=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make `#attached-list` attachment labels wrap, make spacing more consistent, add hover stats to `.attachment-remove` icon, adjust padding of labels to compensate for `.attachment-remove` icon --- public/css/gogs.css | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index 361475bd40..aa6d43894a 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1826,21 +1826,24 @@ body { } #attached { - height: 18px; - margin: 10px 10px 15px 10px; + margin: 10px 0 15px; } #attached-list .label { + display: inline-block; + vertical-align: top; margin-right: 10px; + padding-right: 0; +} + +#attached-list .label .attachment-remove { + cursor: pointer; +} + +#attached-list .label .attachment-remove:hover { + background: #d8d8d8; } #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 From a447aecd953a7a4ab469777b237624cca02ebbb3 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 17:47:01 -0400 Subject: [PATCH 2/8] Fix for erroneous Submitting mode on button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Click handler was also attaching to “Select Attachments” button, so modified selector to grab #issue-reply-btn by ID and submit button --- public/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/app.js b/public/js/app.js index ef54aaf811..b69d333958 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -640,7 +640,7 @@ function initIssue() { var clickedButton = undefined; - $("button,input[type=\"submit\"]", fileInput.form).on("click", function() { + $('#issue-reply-btn,input[type="submit"]', fileInput.form).on('click', function() { clickedButton = this; var $button = $(this); From ef430ae7ab96312b5a3b5191ae999384350cb1be Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 17:48:26 -0400 Subject: [PATCH 3/8] Small whitespace cleanup --- public/js/app.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index b69d333958..034d7e8d06 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -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,9 +635,9 @@ function initIssue() { files.splice($parent.data("index"), 1); $parent.remove(); }); - - var clickedButton = undefined; - + + var clickedButton; + $('#issue-reply-btn,input[type="submit"]', fileInput.form).on('click', function() { clickedButton = this; @@ -651,7 +649,7 @@ function initIssue() { $button.text("Submiting..."); }); - fileInput.form.addEventListener("submit", function(event) { + fileInput.form.addEventListener("submit", function(event) { event.stopImmediatePropagation(); event.preventDefault(); From cd369b667fe65b71c13affe5697157cd09f05bcc Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 17:49:51 -0400 Subject: [PATCH 4/8] =?UTF-8?q?Fix=20=E2=80=9CSubmitting=E2=80=9D=20state?= =?UTF-8?q?=20of=20Close=20issue=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If .btn-default isn’t removed, .btn-default and .btn-warning styles conflict --- public/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/app.js b/public/js/app.js index 034d7e8d06..9a5efaf41c 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -643,7 +643,7 @@ function initIssue() { var $button = $(this); - $button.removeClass("btn-success"); + $button.removeClass("btn-success btn-default"); $button.addClass("btn-warning"); $button.text("Submiting..."); From 957361d755259c89c00d6066d5a309ec876caedb Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 17:50:03 -0400 Subject: [PATCH 5/8] Fix typos --- public/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 9a5efaf41c..d34e7c8059 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -646,7 +646,7 @@ function initIssue() { $button.removeClass("btn-success btn-default"); $button.addClass("btn-warning"); - $button.text("Submiting..."); + $button.text("Submitting…"); }); fileInput.form.addEventListener("submit", function(event) { @@ -698,7 +698,7 @@ function initIssue() { $button.removeClass("btn-warning"); $button.addClass("btn-danger"); - $button.text("An error encoured!") + $button.text("An error occurred!"); return; } From 71cefc95ab60c8628af575df1e54d83bde46f73c Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 17:50:25 -0400 Subject: [PATCH 6/8] Use console.log instead of breakpoint --- public/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/app.js b/public/js/app.js index d34e7c8059..031c58245a 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -675,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() { From ef8eef75195205ed0db4f7582bbdbc045587f042 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 17:51:18 -0400 Subject: [PATCH 7/8] Trivial cleanup using `event.preventDefault` instead of `return false` for being more explicit --- public/js/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 031c58245a..dba83f384c 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -726,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]; @@ -752,9 +752,9 @@ function initIssue() { this.value = ""; }); - $addButton.on("click", function() { + $addButton.on("click", function(evt) { fileInput.click(); - return false; + evt.preventDefault(); }); }()); From 6407caa7610badd817c6691c1b8db60120986fa8 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Fri, 25 Jul 2014 17:51:41 -0400 Subject: [PATCH 8/8] Semicolons for consistency ;); --- public/js/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index dba83f384c..e153ef813c 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(); @@ -767,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