source: trunk/admin/themes/default/template/tags.tpl @ 30341

Last change on this file since 30341 was 26650, checked in by mistic100, 10 years ago

change behavior of reset/cancel button on tags manager + reorganize code

  • Property svn:eol-style set to LF
File size: 5.5 KB
Line 
1{include file='include/tag_selection.inc.tpl'}
2
3{html_style}
4.showInfo { text-indent:5px; }
5{/html_style}
6
7{footer_script require='jquery'}
8jQuery('.showInfo').tipTip({
9  'delay' : 0,
10  'fadeIn' : 200,
11  'fadeOut' : 200,
12  'maxWidth':'300px',
13  'keepAlive':true,
14  'activation':'click'
15});
16
17function displayDeletionWarnings() {
18  jQuery(".warningDeletion").show();
19  jQuery("input[name=destination_tag]:checked").parent("label").children(".warningDeletion").hide();
20}
21
22displayDeletionWarnings();
23
24jQuery("#mergeTags label").click(function() {
25  displayDeletionWarnings();
26});
27
28jQuery("input[name=merge]").click(function() {
29  if (jQuery("ul.tagSelection input[type=checkbox]:checked").length < 2) {
30    alert("{'Select at least two tags for merging'|@translate}");
31    return false;
32  }
33});
34
35$("#searchInput").on("keydown", function(e) {
36  var $this = $(this),
37      timer = $this.data("timer");
38
39  if (timer) {
40    clearTimeout(timer);
41  }
42
43  $this.data("timer", setTimeout(function() {
44    var val = $this.val();
45    if (!val) {
46      $(".tagSelection>li").show();
47      $("#filterIcon").css("visibility","hidden");
48    }
49    else {
50      $("#filterIcon").css("visibility","visible");
51      var regex = new RegExp( val.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i" );
52      $(".tagSelection>li").each(function() {
53        var $li = $(this),
54            text = $.trim( $("label", $li).text() );
55        $li.toggle(regex.test(text));
56      });
57    }
58
59  }, 300) );
60
61  if (e.keyCode == 13) { // Enter
62    e.preventDefault();
63  }
64});
65{/footer_script}
66
67
68<div class="titrePage">
69  <h2>{'Manage tags'|@translate}</h2>
70</div>
71
72<form action="{$F_ACTION}" method="post">
73  {if isset($EDIT_TAGS_LIST)}
74  <fieldset>
75    <legend>{'Edit tags'|@translate}</legend>
76    <input type="hidden" name="edit_list" value="{$EDIT_TAGS_LIST}">
77    <table class="table2">
78      <tr class="throw">
79        <th>{'Current name'|@translate}</th>
80        <th>{'New name'|@translate}</th>
81      </tr>
82      {foreach from=$tags item=tag}
83      <tr>
84        <td>{$tag.NAME}</td>
85        <td><input type="text" name="tag_name-{$tag.ID}" value="{$tag.NAME}" size="50"></td>
86      </tr>
87      {/foreach}
88    </table>
89
90    <p>
91      <input type="submit" name="edit_submit" value="{'Submit'|@translate}">
92      <input type="submit" name="edit_cancel" value="{'Cancel'|@translate}">
93    </p>
94  </fieldset>
95  {/if}
96
97  {if isset($DUPLIC_TAGS_LIST)}
98  <fieldset>
99    <legend>{'Edit tags'|@translate}</legend>
100    <input type="hidden" name="edit_list" value="{$DUPLIC_TAGS_LIST}">
101    <table class="table2">
102      <tr class="throw">
103        <th>{'Source tag'|@translate}</th>
104        <th>{'Name of the duplicate'|@translate}</th>
105      </tr>
106      {foreach from=$tags item=tag}
107      <tr>
108        <td>{$tag.NAME}</td>
109        <td><input type="text" name="tag_name-{$tag.ID}" value="{$tag.NAME}" size="50"></td>
110      </tr>
111      {/foreach}
112    </table>
113
114    <p>
115      <input type="submit" name="duplic_submit" value="{'Submit'|@translate}">
116      <input type="submit" name="duplic_cancel" value="{'Cancel'|@translate}">
117    </p>
118  </fieldset>
119  {/if}
120
121  {if isset($MERGE_TAGS_LIST)}
122  <fieldset id="mergeTags">
123    <legend>{'Merge tags'|@translate}</legend>
124    {'Select the destination tag'|@translate}
125
126    <p>
127    {foreach from=$tags item=tag name=tagloop}
128    <label><input type="radio" name="destination_tag" value="{$tag.ID}"{if $smarty.foreach.tagloop.index == 0} checked="checked"{/if}> {$tag.NAME}<span class="warningDeletion"> {'(this tag will be deleted)'|@translate}</span></label><br>
129    {/foreach}
130    </p>
131
132    <p>
133      <input type="hidden" name="merge_list" value="{$MERGE_TAGS_LIST}">
134      <input type="submit" name="merge_submit" value="{'Confirm merge'|@translate}">
135      <input type="submit" name="merge_cancel" value="{'Cancel'|@translate}">
136    </p>
137  </fieldset>
138  {/if}
139
140  <fieldset>
141    <legend>{'Add a tag'|@translate}</legend>
142
143    <label>
144      {'New tag'|@translate}
145      <input type="text" name="add_tag" size="50">
146    </label>
147
148    <p><input class="submit" type="submit" name="add" value="{'Submit'|@translate}"></p>
149  </fieldset>
150
151  <fieldset>
152    <legend>{'Tag selection'|@translate}</legend>
153
154    {if count($all_tags)}
155    <div><label><span class="icon-filter" style="visibility:hidden" id="filterIcon"></span>{'Search'|@translate}: <input id="searchInput" type="text" size="12"></label></div>
156    {/if}
157
158    <ul class="tagSelection">
159    {foreach from=$all_tags item=tag}
160      <li>
161        {capture name='showInfo'}{strip}
162          <b>{$tag.name}</b> ({$tag.counter|@translate_dec:'%d photo':'%d photos'})<br>
163          <a href="{$tag.U_VIEW}">{'View in gallery'|@translate}</a> |
164          <a href="{$tag.U_EDIT}">{'Manage photos'|@translate}</a>
165          {if !empty($tag.alt_names)}<br>{$tag.alt_names}{/if}
166        {/strip}{/capture}
167        <a class="icon-info-circled-1 showInfo" title="{$smarty.capture.showInfo|@htmlspecialchars}"></a>
168        <label>
169          <input type="checkbox" name="tags[]" value="{$tag.id}"> {$tag.name}
170        </label>
171      </li>
172    {/foreach}
173    </ul>
174
175    <p>
176      <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
177      <input type="submit" name="edit" value="{'Edit selected tags'|@translate}">
178      <input type="submit" name="duplicate" value="{'Duplicate selected tags'|@translate}">
179      <input type="submit" name="merge" value="{'Merge selected tags'|@translate}">
180      <input type="submit" name="delete" value="{'Delete selected tags'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
181    </p>
182  </fieldset>
183
184</form>
Note: See TracBrowser for help on using the repository browser.