source: trunk/admin/themes/default/template/cat_list.tpl @ 18986

Revision 18986, 5.4 KB checked in by mistic100, 7 years ago (diff)

clean HTML+JS code on cat_list.tpl

  • Property svn:eol-style set to LF
Line 
1{footer_script require='jquery.ui.sortable'}{literal}
2jQuery(document).ready(function(){
3  jQuery(".catPos").hide();
4  jQuery(".drag_button").show();
5  jQuery("#manualOrder").hide();
6  jQuery(".categoryLi").css("cursor","move");
7  jQuery(".categoryUl").sortable({
8    axis: "y",
9    opacity: 0.8,
10    update : function() {
11      jQuery("#manualOrder").show();
12      jQuery("#notManualOrder").hide();
13      jQuery("#formAutoOrder").hide();
14      jQuery("#formCreateAlbum").hide();
15    },
16  });
17
18  jQuery("#categoryOrdering").submit(function(){
19    ar = jQuery('.categoryUl').sortable('toArray');
20    for(i=0;i<ar.length;i++) {
21      cat = ar[i].split('cat_');
22      document.getElementsByName('catOrd[' + cat[1] + ']')[0].value = i;
23    }
24  });
25
26  jQuery("input[name=order_type]").click(function () {
27    jQuery("#automatic_order_params").hide();
28    if (jQuery("input[name=order_type]:checked").val() == "automatic") {
29      jQuery("#automatic_order_params").show();
30    }
31  });
32
33  jQuery("#addAlbumOpen").click(function(){
34    jQuery("#formCreateAlbum").toggle();
35    jQuery("input[name=virtual_name]").focus();
36    jQuery("#formAutoOrder").hide();
37  });
38
39  jQuery("#addAlbumClose").click(function(){
40    jQuery("#formCreateAlbum").hide();
41  });
42
43
44  jQuery("#autoOrderOpen").click(function(){
45    jQuery("#formAutoOrder").toggle();
46    jQuery("#formCreateAlbum").hide();
47  });
48
49  jQuery("#autoOrderClose").click(function(){
50    jQuery("#formAutoOrder").hide();
51  });
52
53  jQuery("#cancelManualOrder").click(function(){
54    jQuery(".categoryUl").sortable("cancel");
55    jQuery("#manualOrder").hide();
56    jQuery("#notManualOrder").show();
57  });
58});
59{/literal}{/footer_script}
60
61<h2><span style="letter-spacing:0">{$CATEGORIES_NAV}</span> &#8250; {'Album list management'|@translate}</h2>
62<p class="showCreateAlbum" id="notManualOrder">
63  <a href="#" id="addAlbumOpen">{'create a new album'|@translate}</a>
64  {if count($categories)}| <a href="#" id="autoOrderOpen">{'apply automatic sort order'|@translate}</a>{/if}
65</p>
66<form id="formCreateAlbum" action="{$F_ACTION}" method="post" style="display:none;">
67  <fieldset>
68      <legend>{'create a new album'|@translate}</legend>
69      <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
70     
71      <p>
72        <strong>{'Album name'|@translate}</strong><br>
73        <input type="text" name="virtual_name" maxlength="255">
74      </p>
75     
76      <p class="actionButtons">
77        <input class="submit" name="submitAdd" type="submit" value="{'Create'|@translate}">
78        <a href="#" id="addAlbumClose">{'Cancel'|@translate}</a>
79      </p>
80  </fieldset>
81</form>
82{if count($categories)}
83<form id="formAutoOrder" action="{$F_ACTION}" method="post" style="display:none;">
84  <fieldset>
85    <legend>{'Automatic sort order'|@translate}</legend>
86    <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
87   
88    <p><strong>{'Sort order'|@translate}</strong>
89      <br><label><input type="radio" value="asc" name="ascdesc" checked="checked">{'ascending'|@translate}</label>
90      <br><label><input type="radio" value="desc" name="ascdesc">{'descending'|@translate}</label>
91    </p>
92 
93    <p>
94      <label><input type="checkbox" name="recursive"> <strong>{'Apply to sub-albums'|@translate}</strong></label>
95    </p>
96 
97    <p class="actionButtons">
98      <input class="submit" name="submitAutoOrder" type="submit" value="{'Save order'|@translate}">
99      <a href="#" id="autoOrderClose">{'Cancel'|@translate}</a>
100    </p>
101  </fieldset>
102</form>
103{/if}
104
105<form id="categoryOrdering" action="{$F_ACTION}" method="post">
106  <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
107  <p id="manualOrder">
108    <input class="submit" name="submitManualOrder" type="submit" value="{'Save manual order'|@translate}">
109    {'... or '|@translate} <a href="#" id="cancelManualOrder">{'cancel manual order'|@translate}</a>
110  </p>
111 
112{if count($categories)}
113  <ul class="categoryUl">
114    {foreach from=$categories item=category}
115    <li class="categoryLi{if $category.IS_VIRTUAL} virtual_cat{/if}" id="cat_{$category.ID}">
116      <!-- category {$category.ID} -->
117      <p class="albumTitle">
118        <img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" style="display:none;" alt="{'Drag to re-order'|@translate}" title="{'Drag to re-order'|@translate}">
119        <strong><a href="{$category.U_CHILDREN}" title="{'manage sub-albums'|@translate}">{$category.NAME}</a></strong>
120      </p>
121
122      <p class="catPos">
123        <label>
124          {'Position'|@translate} :
125          <input type="text" size="4" name="catOrd[{$category.ID}]" maxlength="4" value="{$category.RANK}">
126        </label>
127      </p>
128
129      <p class="albumActions">
130        <a href="{$category.U_EDIT}">{'Edit'|@translate}</a>
131        {if isset($category.U_MANAGE_ELEMENTS) }
132        | <a href="{$category.U_MANAGE_ELEMENTS}">{'manage album photos'|@translate}</a>
133        {/if}
134        | <a href="{$category.U_CHILDREN}">{'manage sub-albums'|@translate}</a>
135        {if isset($category.U_SYNC) }
136        | <a href="{$category.U_SYNC}">{'Synchronize'|@translate}</a>
137        {/if}
138        {if isset($category.U_DELETE) }
139        | <a href="{$category.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'delete album'|@translate}</a>
140      {/if}
141      {if cat_admin_access($category.ID)}
142        | <a href="{$category.U_JUMPTO}">{'jump to album'|@translate} →</a>
143      {/if}
144      </p>
145
146    </li>
147    {/foreach}
148  </ul>
149{/if}
150</form>
Note: See TracBrowser for help on using the repository browser.