]> git.mxchange.org Git - friendica.git/blob - templates/contacts-template.tpl
hovercard: some polishing
[friendica.git] / templates / contacts-template.tpl
1
2 <div id="contacts" class="standard-page">
3
4         {{$tabs}}
5
6         {{* The page headding with it's contacts counter *}}
7         <h2 class="headding">{{$header}} {{if $total}} ({{$total}}) {{/if}}</h2>
8
9         {{if $finding}}<h4>{{$finding}}</h4>{{/if}}
10
11         {{* The search input field to search for contacts *}}
12         <div id="contacts-search-wrapper">
13                 <form id="contacts-search-form" class="navbar-form" role="search" action="{{$cmd}}" method="get" >
14                         <div class="row">
15                                 <div class="col-md-2"></div>
16                                 <div class="col-md-8 ">
17                                         <div class="form-group form-group-search">
18                                                 <input type="text" name="search" id="contacts-search" class="search-input form-control form-search" onfocus="this.select();" value="{{$search|escape:'html'}}" placeholder="{{$desc}}"/>
19                                                 <button class="btn btn-default btn-sm form-button-search" type="submit" name="submit" id="contacts-search-submit" value="{{$submit|escape:'html'}}">{{$submit}}</button>
20                                         </div>
21                                 </div>
22                                 <div class="col-md-2"></div>
23                         </div>
24                 </form>
25         </div>
26
27         <hr>
28         <div id="contacts-search-end"></div>
29
30         {{* we need the form container to make batch actions work *}}
31         <form name="batch_actions_submit" action="{{$baseurl}}/contacts/batch/" method="POST">
32
33                 {{* we put here a hidden input element. This is needed to transmit the batch actions with javascript*}}
34                 <input type="hidden" class="batch-action no-input fakelist" name="batch_submit" value="{{$l|escape:'html'}}">
35
36                 {{* We put the contact batch actions in a dropdown menu *}}
37                 <ul class="nav nav-pills preferences">
38                         <li class="dropdown pull-right">
39                                 <a class="btn btn-link btn-sm dropdown-toggle" type="button" id="BatchActionDropdownMenuTools" data-toggle="dropdown" aria-expanded="true">
40                                         <i class="fa fa-angle-down"></i> Batch Actions{{* Does need a Translation and a Variable in core*}}
41                                 </a>
42                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="BatchActionDropdownMenuTools">
43                                 {{foreach $batch_actions as $n=>$l}}
44                                         <li role="menuitem">
45                                                 {{* call the js batch_submit_handler. Have a look at the buttom of this file *}}
46                                                 <a onclick="batch_submit_handler('{{$n}}', '{{$l}}')">{{$l}}</a>
47                                         </li>
48                                 {{/foreach}}
49                                 </ul>
50                         </li>
51                 </ul>
52                 <div class="clear"></div>
53                 <div id="contact-list">
54                         {{* format each contact with the contact_template.tpl *}}
55                         <ul id="viewcontact_wrapper" class="viewcontact_wrapper media-list">
56                         {{foreach $contacts as $contact}}
57                                 <li>{{include file="contact_template.tpl"}}</li>
58                         {{/foreach}}
59                         </ul>
60                 </div>
61                 <div id="contact-edit-end"></div>
62         </form>
63
64         {{$paginate}}
65 </div>
66
67 <script>
68  $(document).ready(function() {
69   // javascript dialog to batch actions
70   $(".batch-action").click(function(e){
71     if (confirm($(this).attr('value')+" ?")) {
72      return true;
73     } else {
74      e.preventDefault();
75      return false;
76     }
77   });
78  
79   // add javascript confirm dialog to "drop" links. Plain html url have "?confirm=1" to show confirmation form, we need to remove it
80   $(".drop").each(function() {
81    $(this).attr('href', $(this).attr('href').replace("confirm=1","") );
82    $(this).click(function(e){
83     if (confirm("{{$contact_drop_confirm}}")) {
84      return true;
85     } else {
86      e.preventDefault();
87      return false;
88     }
89    });
90    
91   });
92  });
93
94 /**
95  * @brief This function submits the form with the batch action values
96  *
97  * @param string name The name of the batch action
98  * @param string value If it isn't empty the action will be posted
99  */
100 function batch_submit_handler(name, value) {
101     // set the value of the hidden input element with the name batch_submit
102     document.batch_actions_submit.batch_submit.value=value;
103     // change the name of the input element from batch_submit according to the
104     // name which is transmitted to this function
105     document.batch_actions_submit.batch_submit.name=name;
106     // transmit the form
107     document.batch_actions_submit.submit() ;
108 }
109  </script>
110