]> git.mxchange.org Git - friendica.git/commitdiff
Improve page contacblock for frio theme
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 2 Dec 2017 03:33:04 +0000 (22:33 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 2 Dec 2017 03:33:04 +0000 (22:33 -0500)
mod/admin.php
view/templates/admin/contactblock.tpl
view/theme/frio/js/mod_admin.js [new file with mode: 0644]
view/theme/frio/templates/admin/contactblock.tpl

index 1bcbb45e75ddee71e4719fab566a5759d0d78c28..fcd67aa9e1dab6258f8e4cca7e4cceaf0e2f2750 100644 (file)
@@ -441,6 +441,7 @@ function admin_page_contactblock(App $a)
                '$baseurl'    => System::baseUrl(true),
 
                '$contacts'   => $contacts,
+               '$total_contacts' => tt('%s total blocked contact', '%s total blocked contacts', $total),
                '$paginate'   => paginate($a),
                '$contacturl' => ['contact_url', t("Profile URL"), '', t("URL of the remote contact to block.")],
        ));
index dcd33e8793f3263263ae9ad8a1e592283fdbe4b1..152550f017d9ea9af834a80495cbec8de41a4e91 100644 (file)
@@ -1,4 +1,3 @@
-
 <script>
        function selectall(cls) {
                $('.' + cls).prop('checked', true);
diff --git a/view/theme/frio/js/mod_admin.js b/view/theme/frio/js/mod_admin.js
new file mode 100644 (file)
index 0000000..b9fc467
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @brief Javascript for the admin module
+ */
+$(function() {
+       $('body').on('click', '.selectall', function() {
+               selectall($(this).data('selectAll'));
+       });
+       $('body').on('click', '.selectnone', function() {
+               selectnone($(this).data('selectNone'));
+       });
+
+       $('body').on('change', 'input[type=checkbox].select', function() {
+               $this = $(this);
+               if ($this.prop('checked')) {
+                       selectall($this.data('selectClass'));
+                       $this.attr('title', $this.data('selectNone'));
+               } else {
+                       selectnone($this.data('selectClass'));
+                       $this.attr('title', $this.data('selectAll'));
+               }
+       });
+
+       function selectall(cls) {
+               $('.' + cls).prop('checked', true);
+               return false;
+       }
+       function selectnone(cls) {
+               $('.' + cls).prop('checked', false);
+               return false;
+       }
+});
index db0d2ed9db81e34902ddfc369d1a1c59f0ee1830..f330854bc9694220930b16fc8173df56044bbb4f 100644 (file)
@@ -1,14 +1,4 @@
-
-<script>
-       function selectall(cls) {
-               $('.' + cls).prop('checked', true);
-               return false;
-       }
-       function selectnone(cls) {
-               $('.' + cls).prop('checked', false);
-               return false;
-       }
-</script>
+<script type="text/javascript" src="view/theme/frio/js/mod_admin.js"></script>
 <div id="adminpage">
        <h1>{{$title}} - {{$page}}</h1>
        <p>{{$description}}</p>
@@ -20,7 +10,7 @@
                <table id="contactblock" class="table table-condensed table-striped">
                        <thead>
                                <tr>
-                                       <th></th>
+                                       <th><input type="checkbox" class="select contacts_ckbx" data-select-class="contacts_ckbx" data-select-all="{{$select_all}}"  data-select-none="{{$select_none}}" title="{{$select_all}}"/></th>
                                                {{foreach $th_contacts as $th}}
                                        <th>
                                                {{$th}}
                                </tr>
                                {{/foreach}}
                        </tbody>
+                       <tfoot>
+                               <tr>
+                                       <td><input type="checkbox" class="select contacts_ckbx" data-select-class="contacts_ckbx" data-select-all="{{$select_all}}"  data-select-none="{{$select_none}}" title="{{$select_all}}"/></td>
+                                       <td colspan="3">
+                                               {{$total_contacts}}
+                                       </td>
+                               </tr>
+                       </tfoot>
                </table>
-               <p><a href="#" onclick="return selectall('contacts_ckbx');">{{$select_all}}</a> | <a href="#" onclick="return selectnone('contacts_ckbx');">{{$select_none}}</a></p>
+               <div class="submit"><button type="submit" class="btn btn-small btn-default" name="page_contactblock_unblock" value="1">{{$unblock|escape:'html'}}</button></div>
                {{$paginate}}
-               <div class="submit"><input type="submit" name="page_contactblock_unblock" value="{{$unblock|escape:'html'}}" /></div>
        {{else}}
                <p>{{$no_data|escape:'html'}}</p>
        {{/if}}
@@ -58,6 +55,6 @@
                                </tr>
                        </tbody>
                </table>
-               <div class="submit"><input type="submit" name="page_contactblock_block" value="{{$submit|escape:'html'}}" /></div>
+               <div class="submit"><button type="submit" class="btn btn-primary" name="page_contactblock_block" value="1">{{$submit|escape:'html'}}</button></div>
        </form>
 </div>