]> git.ipfire.org Git - pbs.git/commitdiff
builds: Move commenting into a modal
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 14 Feb 2025 12:25:51 +0000 (12:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 14 Feb 2025 12:25:51 +0000 (12:25 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/builds/macros.html
src/templates/builds/show.html

index 6c718f535193c532642666f5bac9c0e85c8be665..6d253bc3c236eb8ed5c267ee07bd55aa3d116d18 100644 (file)
 
 {% from "users/macros.html" import Avatar with context %}
 
+{% macro BuildComment(build) %}
+       <div class="modal" id="build-{{ build.uuid }}-comment">
+               <div class="modal-background"></div>
+
+               <div class="modal-content">
+                       <section class="modal-card-body">
+                               <h5 class="title is-5">
+                                       {{ _("Comment on %s") % build }}
+                               </h5>
+
+                               <form method="POST" action="/builds/{{ build.uuid }}/comment">
+                                       {{ xsrf_form_html() | safe }}
+
+                                       <div class="field">
+                                               <div class="control">
+                                                       <textarea class="textarea" name="text" rows="8"
+                                                               placeholder="{{ _("Comment...") }}"></textarea>
+                                               </div>
+                                       </div>
+
+                                       <div class="field">
+                                               <div class="control">
+                                                       <button class="button is-info is-fullwidth">
+                                                               {{ _("Post Comment") }}
+                                                       </button>
+                                               </div>
+                                       </div>
+                               </form>
+                       </section>
+               </div>
+
+               <button class="modal-close is-large" aria-label="close"></button>
+       </div>
+
+       <a href="#" class="button is-info modal-toggle" data-target="build-{{ build.uuid }}-comment">
+               <span class="icon-text">
+                       <span class="icon">
+                               <i class="fa-solid fa-comment"></i>
+                       </span>
+
+                       <span>{{ _("Comment") }}</span>
+               </span>
+       </a>
+{% endmacro %}
+
 {% macro BuildList(builds, shorter=False, limit=None, more_url=None) %}
        {% if builds %}
                {% set rest = False %}
index ba3d1f6a4f87abd950b97ea3cc6ca5a9e9809862..b046ee0453a5e50cbaac0632f7216cce20d646c5 100644 (file)
@@ -2,7 +2,7 @@
 
 {% from "macros.html" import Text with context %}
 {% from "bugs/macros.html" import BugList with context %}
-{% from "builds/macros.html" import BuildPackages, BuildWatchers with context %}
+{% from "builds/macros.html" import BuildComment, BuildPackages, BuildWatchers with context %}
 {% from "builds/groups/macros.html" import BuildGroupList with context %}
 {% from "events/macros.html" import EventList with context %}
 {% from "jobs/macros.html" import JobList with context %}
                                                {{ _("Delete Build") }}
                                        </a>
                                {% endif %}
+
+                               {# Comment #}
+                               {{ BuildComment(build) }}
                        </div>
                </div>
        </section>
                        {{ EventList(priority=4, build=build, show_build=False) }}
                </div>
        </section>
-
-       {# Comment - This probably should go into a modal #}
-       <section class="section">
-               <div class="container">
-                       <form method="POST" action="/builds/{{ build.uuid }}/comment">
-                               {{ xsrf_form_html() | safe }}
-
-                               <div class="field">
-                                       <label class="label">{{ _("Comment") }}</label>
-                                       <div class="control">
-                                               <textarea class="textarea" name="text" rows="8"
-                                                       placeholder="{{ _("Comment...") }}"></textarea>
-                                       </div>
-                               </div>
-
-                               <div class="field">
-                                       <div class="control">
-                                               <button class="button is-link">Submit</button>
-                                       </div>
-                               </div>
-                       </form>
-               </div>
-       </section>
 {% endblock %}