#2895 Move add milestone button to top of issues list
Merged 6 years ago by pingou. Opened 6 years ago by cqi.

file modified
+30 -24
@@ -19,13 +19,19 @@ 

        {{ issues|count }} Issues (of {{ issues_cnt }})

      {% endif %}

      <span class="btn-group btn-group-sm pull-xs-right" role="group">

+     {% if g.repo_admin %}

+       <a href="javascript:avoid(0)" class="btn btn-secondary btn-sm"

+         data-toggle="modal" data-target="#milestone_modal">

+         Add milestone

+       </a>

+     {% endif %}

      {% if repo.milestones %}

        <a href="{{ url_for(

            'view_roadmap',

            repo=repo.name,

            username=username,

-           namespace=repo.namespace) }}">

-         <button class="btn btn-secondary btn-sm">Roadmap</button>

+           namespace=repo.namespace) }}" class="btn btn-secondary btn-sm">

+         Roadmap

The button no longer works when I try it locally :(

cqi commented 6 years ago

How it doesn't work?

For one, clicking on it has no effect

cqi commented 6 years ago

I have no idea why this happens. I tested this change in my dev env, it works well. Did you test this patch on latest master branch?

I have tested it by checking out the head corresponding to your PR

        </a>

      {% endif %}

        {% if g.repo.reports %}
@@ -48,6 +54,28 @@ 

        {% endif %}

      </span>

    </h2>

+ 

+   {% if g.repo_admin %}

+     <div class="modal fade" id="milestone_modal" tabindex="-1"

+           role="dialog" aria-labelledby="New milestone" aria-hidden="true">

+       <div class="modal-dialog" role="document">

+         <div class="modal-content">

+           <div class="modal-header">

+             <button type="button" class="close" data-dismiss="modal" aria-label="Close">

+               <span aria-hidden="true">&times;</span>

+               <span class="sr-only">Close</span>

+             </button>

+           </div>

+           <div class="modal-body">

+         {% set tag_form = add_report_form %}

+         {% set from = 'issues' %}

+         {% include 'settings_milestones.html' %}

+           </div>

+         </div>

+       </div>

+     </div>

+   {% endif %}

+ 

      {% if oth_issues_cnt %}

      <div class="addrem_bar issues_pbar m-b-1 {%

        if status|lower not in ['open', 'true'] %}closed{%
@@ -342,10 +370,6 @@ 

    data-toggle="modal" data-target="#report_modal">

    Save report

  </button>

- <button type="button" class="btn btn-secondary btn-sm pull-xs-right"

-   data-toggle="modal" data-target="#milestone_modal">

-   Add milestone

- </button>

  <div class="modal fade" id="report_modal" tabindex="-1"

        role="dialog" aria-labelledby="New report" aria-hidden="true">

    <div class="modal-dialog" role="document">
@@ -375,24 +399,6 @@ 

      </div>

    </div>

  </div>

- <div class="modal fade" id="milestone_modal" tabindex="-1"

-       role="dialog" aria-labelledby="New milestone" aria-hidden="true">

-   <div class="modal-dialog" role="document">

-     <div class="modal-content">

-       <div class="modal-header">

-         <button type="button" class="close" data-dismiss="modal" aria-label="Close">

-           <span aria-hidden="true">&times;</span>

-           <span class="sr-only">Close</span>

-         </button>

-       </div>

-       <div class="modal-body">

-     {% set tag_form = add_report_form %}

-     {% set from = 'issues' %}

-     {% include 'settings_milestones.html' %}

-       </div>

-     </div>

-   </div>

- </div>

  {% endif %}

  

  {{ pagination_link('page', g.page, total_page) }}

Fixes #2860

Signed-off-by: Chenxiong Qi qcxhome@gmail.com

The button no longer works when I try it locally :(

For one, clicking on it has no effect

I have no idea why this happens. I tested this change in my dev env, it works well. Did you test this patch on latest master branch?

I have tested it by checking out the head corresponding to your PR

I rebased this PR and tested it again, both button are entirely inactive for me :(

Using something like

diff --git a/ pagure/templates/issues.html b/ pagure/templates/issues.html
index 20f5e2bf..dd9ebd9d 100644
--- a/pagure/templates/issues.html     
+++ b/pagure/templates/issues.html     
@@ -18,23 +18,23 @@
     {% else %}
       {{ issues|count }} Issues (of {{ issues_cnt }})
     {% endif %}
-    <span class="btn-group btn-group-sm pull-xs-right" role="group">
+    <span class="form-inline pull-xs-right" role="group">
     {% if g.repo_admin %}
-      <a href="javascript:avoid(0)" class="btn btn-secondary btn-sm"
-        data-toggle="modal" data-target="#milestone_modal">
-        Add milestone
-      </a>
+      <a href="javascript:avoid(0)"
+        data-toggle="modal" data-target="#milestone_modal"
+        class="btn btn-secondary" role="button">Add milestone</a>
     {% endif %}
     {% if repo.milestones %}
       <a href="{{ url_for(
           'ui_ns.view_roadmap',
           repo=repo.name,
           username=username,
-          namespace=repo.namespace) }}" class="btn btn-secondary btn-sm">
-        Roadmap
+          namespace=repo.namespace) }}"
+          class="btn btn-secondary" role="button">
+          Roadmap
       </a>
     {% endif %}
-      {% if g.repo.reports %}
+    {% if g.repo.reports %}

makes it work

So debugging this with @cverna last week we found out that the issue occurs if you have the roadmap button, the add new milestone button and the reports button visible.

I think I got it working in https://pagure.io/pagure/pull-request/3077 if people want to test it :)

Commit 1e2a5f2 fixes this pull-request

Pull-Request has been merged by pingou

6 years ago

@pingou I just came back to my pr and found you had already merged it. Thank you very much. Sorry for not response in time.

@cqi sure thing and no problem :)

Metadata