Bug 20568: (follow-up) Interface and markup changes
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / apikeys.tt
1 [% USE Koha %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Patrons &rsaquo; API Keys</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 </head>
7 <body id="pat_apikeys" class="pat">
8 [% INCLUDE 'header.inc' %]
9 [% INCLUDE 'patron-search.inc' %]
10
11 <div id="breadcrumbs">
12     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
13     &rsaquo;
14     <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
15     &rsaquo;
16     API Keys for [% INCLUDE 'patron-title.inc' %]
17 </div>
18
19 <div id="doc3" class="yui-t2">
20     <div id="bd">
21         <div id="yui-main">
22             <div class="yui-b">
23                 [% INCLUDE 'members-toolbar.inc' %]
24
25                 <h1>API keys for [% INCLUDE 'patron-title.inc' %]</h1>
26                 <form id="add-api-key" action="/cgi-bin/koha/members/apikeys.pl" method="post" style="display:none">
27                     <input type="hidden" name="patron_id" value="[% patron.id %]" />
28                     <input type="hidden" name="op" value="generate" />
29                     <fieldset class="brief">
30                         <legend>Generate new key</legend>
31                         <ol>
32                             <li>
33                                 <label for="description">Description: </label>
34                                 <input type="text" name="description" />
35                                 <input type="submit" value="Save" />
36                                 <a href="#" class="cancel toggle_element" data-element="#add-api-key">Cancel</a>
37                             </li>
38                         </ol>
39                     </fieldset>
40                 </form>
41
42                 <div id="keys">
43                     [% IF api_keys && api_keys.size > 0 %]
44                         <p>
45                             <button class="btn btn-default btn-xs toggle_element" type="submit" id="show-api-form" data-element="#add-api-key"><i class="fa fa-plus"></i> Generate a new key</button>
46                         </p>
47                         <table>
48                             <thead>
49                                 <tr>
50                                     <th>Description</th>
51                                     <th>Key</th>
52                                     <th>Active</th>
53                                     <th>Actions</th>
54                                 </tr>
55                             </thead>
56                             <tbody>
57                                 [% FOREACH key IN api_keys %]
58                                     <tr>
59                                         <td>[% key.description %]</td>
60                                         <td>[% key.value %]</td>
61                                         <td>[% IF key.active %]Yes[% ELSE %]No[% END %]</td>
62                                         <td>
63                                             <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
64                                                 <input type="hidden" name="patron_id" value="[% patron.id %]" />
65                                                 <input type="hidden" name="key" value="[% key.value %]" />
66                                                 <input type="hidden" name="op" value="delete" />
67                                                 <button class="btn btn-default btn-xs delete" type="submit"><i class="fa fa-trash"></i> Delete</button>
68                                             </form>
69                                             <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
70                                                 <input type="hidden" name="patron_id" value="[% patron.id %]" />
71                                                 <input type="hidden" name="key" value="[% key.value %]" />
72                                                 [% IF key.active %]
73                                                     <input type="hidden" name="op" value="revoke" />
74                                                     <button class="btn btn-default btn-xs" type="submit"><i class="fa fa-remove"></i> Revoke</button>
75                                                 [% ELSE %]
76                                                     <input type="hidden" name="op" value="activate" />
77                                                     <button class="btn btn-default btn-xs" type="submit"><i class="fa fa-play"></i> Activate</button>
78                                                 [% END %]
79                                             </form>
80                                         </td>
81                                     </tr>
82                                 [% END %]
83                             </tbody>
84                         </table>
85                     [% ELSE %]
86                         <div class="dialog message">No keys defined for the current patron. <a href="#" class="toggle_element" data-element="#add-api-key" id="show-api-form"><i class="fa fa-plus"></i> Generate a new key</div>
87                     [% END %]
88                 </div>
89             </div>
90         </div>
91         <div class="yui-b">
92             [% INCLUDE 'circ-menu.inc' %]
93         </div>
94     </div>
95
96 [% MACRO jsinclude BLOCK %]
97         <script>
98             $(document).ready(function(){
99                 $(".delete").on("click", function(e){
100                     return confirmDelete(_("Are you sure you want to delete this key?"));
101                 });
102             });
103         </script>
104 [% END %]
105
106 [% INCLUDE 'intranet-bottom.inc' %]