#3747 move attachements to sidebar
Merged 5 years ago by pingou. Opened 5 years ago by ryanlerch.
ryanlerch/pagure cleanup-attachments-view  into  master

@@ -326,39 +326,28 @@ 

  {% endmacro %}

  

  {% macro show_attachments(attachments) %}

- <div class="card clearfix">

-   <div id="attachments" class="card-header">

-   <b>Attachments</b>

-   </div>

- 

-   <div class="card-block">

-     <section class="issue_comment">

-       <div>

-         <span class="comment_text comment_body attachment_list">

-         {% for attachment in attachments %}

-           {#

-              attachment[0] = link

-              attachment[1] = file name

-              attachment[2] = display name

-              attachment[3] = date

-              attachment[4] = comment id

-            #}

-           <span>

-             <a href="{{ attachment[0] }}">{{ attachment[2] }}</a> - <small><i>{{ attachment[3] }}

-             {% if attachment[4] is not none %}

-               <a href="#comment-{{ attachment[4] }}">Comment</a></i>

-             {% else %}

-               From Issue description</i>

-             {% endif %}

-             <a href="{{ attachment[0] }}?raw=1" download="{{ attachment[1] }}"

-                style="float: right;background-color:slategray" class="label label-default">Download</a>

-             <br>

-             </small>

-           </span>

-         {% endfor %}

-         </span>

+   <div class="list-group list-group-flush">

+     {% for attachment in attachments %}

+       {#

+           attachment[0] = link

+           attachment[1] = file name

+           attachment[2] = display name

+           attachment[3] = date

+           attachment[4] = comment id

+         #}

+       <div class="list-group-item list-group-item-action border-0 pl-2">

+         <div class="ellipsis font-size-09 font-weight-bold">

+           <a href="{{ attachment[0] }}?raw=1" title="{{attachment[2]}}" data-toggle="tooltip">{{ attachment[2] }}</a>

+         </div>

+         <div><small>

+           Attached {{ attachment[3] | humanize}}

+           {% if attachment[4] is not none %}

+           <a href="#comment-{{ attachment[4] }}" class="pull-right">View Comment</a>

+           {% else %}

+           <a href="#comment-0" class="pull-right">View Comment</a>

+           {% endif %}

+         </small></div>

        </div>

-     </section>

+     {% endfor %}

    </div>

- </div>

  {% endmacro %}

file modified
+21 -7
@@ -172,13 +172,6 @@ 

  

      <hr class="mb-1"/>

  

-     {% if attachments %}

-       <section id="attachments">

-         {{ show_attachments(attachments) }}

-         <br>

-       </section>

-     {% endif %}

- 

      <section id="comments" class="pt-1">

        {% if issue.comments %}

          {% for comment in issue.comments %}
@@ -558,6 +551,27 @@ 

        </div>

      </div>

  

+     {% if attachments %}

+       <div class="mt-3">

+         <h5 class="d-flex align-items-center font-weight-bold border-bottom">

+             <div class="py-2 text-uppercase font-size-09">

+               Attachments

+               <span class="badge badge-secondary badge-pill font-size-09 ml-1" id="attachments-count">{{attachments|count}}</span>

+             </div>

+             {#<div class="ml-auto">

+                 <a href="#" class="btn btn-sm btn-link" id="subcribe-btn"

+                 {% if g.fas_user.username in subscribers -%}

+                   title="Unsubscribe from this issue">Unsubscribe

+                 {%- else -%}

+                   title="Subscribe to this issue">Subscribe

+                 {%- endif -%}

+               </a>

+             </div>#}

+           </h5>

+           {{ show_attachments(attachments) }}

+       </div>

+     {% endif %}

+ 

      {% if g.authenticated %}

  

        <div class="mt-3">

this moves the attachements listing to the sidebar of the
issue page.

Fixes #3697

rebased onto 4a6a04ecd2f4e0171048a233974c98dce0ff9778

5 years ago

rebased onto aeef222

5 years ago

I did a small change:

-          <a href="#comment-0">View Comment</a>
+          <a href="#comment-0" class="pull-right">View Comment</a>

Otherwise looks fine to me! :)

Pull-Request has been merged by pingou

5 years ago