From b64501991a2360d6e6862bbc82ae8dd689635845 Mon Sep 17 00:00:00 2001
From: farhaanbukhsh <farhaan.bukhsh@gmail.com>
Date: Apr 28 2016 15:07:51 +0000
Subject: [PATCH 1/6] Fix spinner for ajax calls


---

diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css
index e6b4cd3..5c38480 100644
--- a/pagure/static/pagure.css
+++ b/pagure/static/pagure.css
@@ -391,6 +391,12 @@ a.notblue {
     background-repeat: no-repeat;
     min-height: 150px;
 }
+.content-loading {
+    background-image: url("images/spinner.gif");
+    background-position: center center;
+    background-repeat: no-repeat;
+    min-height: 150px;
+}
 
 .repoinfo-branchlistitem
 {
diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 4e268cc..90a96c5 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -435,7 +435,9 @@
         </form>
        </div>
       {% endif %}
-        <small id="merge-alert-message"></small>
+      <small id="merge-alert-message">
+        <div id="merge-load" class="content-loading" style="display:none"></div>
+      </small>
       </div>
       {% if pull_request.status != 'Open'%}
       <div class="alert {{'alert-success' if pull_request.status == 'Merged' else 'alert-danger'}}
@@ -777,6 +779,7 @@ function setup_reply_btns() {
 
   {% if pull_request.status == 'Open' %}
   $(function(){
+    $('#merge-load').show();
     $.ajax({
       url: '{{ url_for("internal_ns.mergeable_request_pull") }}' ,
       type: 'POST',
@@ -786,6 +789,7 @@ function setup_reply_btns() {
       },
       dataType: 'json',
       success: function(res) {
+        $('#merge-load').hide();
         if (res.code == 'FFORWARD'){
           $('#merge_btn').addClass("btn-success");
           $('#merge-alert').addClass("alert-success");

From 8ac3ad1a65afc4885397a20f2e992ecb1827a306 Mon Sep 17 00:00:00 2001
From: farhaanbukhsh <farhaan.bukhsh@gmail.com>
Date: Apr 28 2016 15:07:51 +0000
Subject: [PATCH 2/6] Fix ajax call on fail


---

diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 90a96c5..73a0ee2 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -816,6 +816,7 @@ function setup_reply_btns() {
         }
       },
       error: function(res) {
+        $('#merge-load').hide();
         var _obj = $('#pr_flags').find('tbody');
         if (res.responseJSON.message) {
           _obj.append(

From f63ac803015686e8ce4414d35ba144912e7e6aec Mon Sep 17 00:00:00 2001
From: farhaanbukhsh <farhaan.bukhsh@gmail.com>
Date: Apr 28 2016 15:07:52 +0000
Subject: [PATCH 3/6] Fix hidden div issue


---

diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 73a0ee2..8b36e8a 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -779,6 +779,7 @@ function setup_reply_btns() {
 
   {% if pull_request.status == 'Open' %}
   $(function(){
+    $('#merge-alert').show();
     $('#merge-load').show();
     $.ajax({
       url: '{{ url_for("internal_ns.mergeable_request_pull") }}' ,
@@ -790,6 +791,7 @@ function setup_reply_btns() {
       dataType: 'json',
       success: function(res) {
         $('#merge-load').hide();
+        $('#merge-alert').hide();
         if (res.code == 'FFORWARD'){
           $('#merge_btn').addClass("btn-success");
           $('#merge-alert').addClass("alert-success");

From 70eb7a6a72603cecea2d8763cf3c5228e2816ba7 Mon Sep 17 00:00:00 2001
From: farhaanbukhsh <farhaan.bukhsh@gmail.com>
Date: Apr 28 2016 15:07:52 +0000
Subject: [PATCH 4/6] Fix the overlay merge button


---

diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 8b36e8a..9b5c8b6 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -425,6 +425,7 @@
   <div class="col-md-4">
   {% if pull_request %}
     <section class="pr_info">
+      <div id="merge-load" class="content-loading" style="display:none"></div>
       <div id="merge-alert" class="alert text-xs-center" style="display:none;" role="alert">
       {% if pull_request.status == 'Open' and repo_admin %}
        <div>
@@ -436,7 +437,6 @@
        </div>
       {% endif %}
       <small id="merge-alert-message">
-        <div id="merge-load" class="content-loading" style="display:none"></div>
       </small>
       </div>
       {% if pull_request.status != 'Open'%}
@@ -779,7 +779,6 @@ function setup_reply_btns() {
 
   {% if pull_request.status == 'Open' %}
   $(function(){
-    $('#merge-alert').show();
     $('#merge-load').show();
     $.ajax({
       url: '{{ url_for("internal_ns.mergeable_request_pull") }}' ,
@@ -791,7 +790,6 @@ function setup_reply_btns() {
       dataType: 'json',
       success: function(res) {
         $('#merge-load').hide();
-        $('#merge-alert').hide();
         if (res.code == 'FFORWARD'){
           $('#merge_btn').addClass("btn-success");
           $('#merge-alert').addClass("alert-success");

From 8dc5a02ca947572fc6b9042bc169022f301686fa Mon Sep 17 00:00:00 2001
From: farhaanbukhsh <farhaan.bukhsh@gmail.com>
Date: Apr 28 2016 15:07:52 +0000
Subject: [PATCH 5/6] Fix id name and min-height


---

diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css
index 5c38480..b0cc905 100644
--- a/pagure/static/pagure.css
+++ b/pagure/static/pagure.css
@@ -395,7 +395,7 @@ a.notblue {
     background-image: url("images/spinner.gif");
     background-position: center center;
     background-repeat: no-repeat;
-    min-height: 150px;
+    min-height: 30px;
 }
 
 .repoinfo-branchlistitem
diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 9b5c8b6..fbb55cd 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -425,7 +425,7 @@
   <div class="col-md-4">
   {% if pull_request %}
     <section class="pr_info">
-      <div id="merge-load" class="content-loading" style="display:none"></div>
+      <div id="spinner" class="content-loading" style="display:none"></div>
       <div id="merge-alert" class="alert text-xs-center" style="display:none;" role="alert">
       {% if pull_request.status == 'Open' and repo_admin %}
        <div>
@@ -436,8 +436,7 @@
         </form>
        </div>
       {% endif %}
-      <small id="merge-alert-message">
-      </small>
+      <small id="merge-alert-message"></small>
       </div>
       {% if pull_request.status != 'Open'%}
       <div class="alert {{'alert-success' if pull_request.status == 'Merged' else 'alert-danger'}}
@@ -779,7 +778,7 @@ function setup_reply_btns() {
 
   {% if pull_request.status == 'Open' %}
   $(function(){
-    $('#merge-load').show();
+    $('#spinner').show();
     $.ajax({
       url: '{{ url_for("internal_ns.mergeable_request_pull") }}' ,
       type: 'POST',
@@ -789,7 +788,7 @@ function setup_reply_btns() {
       },
       dataType: 'json',
       success: function(res) {
-        $('#merge-load').hide();
+        $('#spinner').hide();
         if (res.code == 'FFORWARD'){
           $('#merge_btn').addClass("btn-success");
           $('#merge-alert').addClass("alert-success");
@@ -816,7 +815,7 @@ function setup_reply_btns() {
         }
       },
       error: function(res) {
-        $('#merge-load').hide();
+        $('#spinner').hide();
         var _obj = $('#pr_flags').find('tbody');
         if (res.responseJSON.message) {
           _obj.append(

From 279503efde574800f085707a28115b818ce7cfce Mon Sep 17 00:00:00 2001
From: farhaanbukhsh <farhaan.bukhsh@gmail.com>
Date: Apr 28 2016 15:07:52 +0000
Subject: [PATCH 6/6] Fix indentation


---

diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index fbb55cd..b9e42fd 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -436,7 +436,7 @@
         </form>
        </div>
       {% endif %}
-      <small id="merge-alert-message"></small>
+        <small id="merge-alert-message"></small>
       </div>
       {% if pull_request.status != 'Open'%}
       <div class="alert {{'alert-success' if pull_request.status == 'Merged' else 'alert-danger'}}

