#4368 Add button to check all
Merged 5 years ago by pingou. Opened 5 years ago by lenkaseg.
Unknown source checkbox  into  master

@@ -35,7 +35,15 @@

            {% endif %}

            {{ render_bootstrap_field(

                form.description, field_description="Small description of this API token") }}

-           <strong><label for="acls">ACLs</label></strong>

+           <strong><label for="acls">ACLs</label></strong><br/>

+           <script type="text/javascript">

+           function toggle() {

+               var checkboxes = document.querySelectorAll('input[type="checkbox"]');

+               for (var i = 0; i < checkboxes.length; i++) {

+                   checkboxes[i].checked = !checkboxes[i]checked;

+               }

+           }

+           </script>

            {% for acl in acls %}

            <div>

              <label class="c-input c-checkbox">
@@ -55,7 +63,7 @@

              <a class="btn btn-secondary" href="{{ url_for('ui_ns.user_settings')

                  }}#nav-api-tab">Cancel</a>

              {% endif %}

- 

+             <span class="btn" onclick="toggle()">Toggle all</span>

              {{ form.csrf_token }}

            </div>

          </form>

Added a button to check all the options while creating a project API token.

@lenkaseg Could you please amend your commit message to include more details? The message doesn't exactly tell us what this is for.

rebased onto e5c6d7654dca92b42633d984d4900abeda1fec5a

5 years ago

pretty please pagure-ci rebuild

5 years ago

You should amend the commit message with a "Fixes #4359" :)

Ah, ok, I didn't get it :)

rebased onto c4184b5c5352bbbce8498bd4db2b8ae6db6f090b

5 years ago

I'd recommend the following changes:

diff --git a/ pagure/templates/add_token.html b/ pagure/templates/add_token.html
index d523d53b..e1911c89 100644
--- a/ pagure/templates/add_token.html  
+++ b/ pagure/templates/add_token.html  
@@ -36,16 +36,14 @@
           {{ render_bootstrap_field(
               form.description, field_description="Small description of this API token") }}
           <strong><label for="acls">ACLs</label></strong><br/>
-          <script>
-          function toggle(source) {
+          <script type="text/javascript">
+          function toggle() {
               var checkboxes = document.querySelectorAll('input[type="checkbox"]');
               for (var i = 0; i < checkboxes.length; i++) {
-                  if (checkboxes[i] != source)
-                      checkboxes[i].checked = source.checked;
+                checkboxes[i].checked = !checkboxes[i].checked;
               }
           }
           </script>
-          <input type="checkbox" onClick="toggle(this)"/> Check all?<p/>
           {% for acl in acls %}
           <div>
             <label class="c-input c-checkbox">
@@ -65,7 +63,7 @@
             <a class="btn btn-secondary" href="{{ url_for('ui_ns.user_settings')
                 }}#nav-api-tab">Cancel</a>
             {% endif %}
-
+            <span class="btn" onclick="toggle()">Toggle all</span>
             {{ form.csrf_token }}
           </div>
         </form>

rebased onto e97291fc0d047a8a519bd17cee7fe1c607efbc90

5 years ago

Looks good to me, let's wait on jenkins and get it in :)

rebased onto 5d0a68c0f770169fee602d719dc9bcdb6af7b13c

5 years ago

I guess we should adjust the commit message since there is no checkbox anymore :)

True. I did in the commit message, but not here. So it is a button now?

rebased onto 22141cb

5 years ago

Pull-Request has been merged by pingou

5 years ago