Ignore:
Timestamp:
Jul 23, 2010, 11:33:56 PM (14 years ago)
Author:
plg
Message:

feature 408: ability to automatically sort sub-categories. The number of SQL
queries is constant, no matter the deepth of your tree.

+ refactor to avoid duplicate code (ascending/desceding should be only a
single parameter in a function, not 20 lines of duplicated code)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/cat_list.tpl

    r6363 r6698  
    1717        cat = ar[i].split('cat_');
    1818        document.getElementsByName('catOrd[' + cat[1] + ']')[0].value = i;
     19      }
     20    });
     21
     22    jQuery("input[name=order_type]").click(function () {ldelim}
     23      jQuery("#automatic_order_params").hide();
     24      if (jQuery("input[name=order_type]:checked").val() == "automatic") {ldelim}
     25        jQuery("#automatic_order_params").show();
    1926      }
    2027    });
     
    4047{if count($categories) }
    4148<form id="categoryOrdering" action="{$F_ACTION}" method="post">
    42   <p>
    43     <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
     49  <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
     50
     51  <div class="orderParams">
    4452    <input class="submit" name="submitOrder" type="submit" value="{'Save order'|@translate}" {$TAG_INPUT_ENABLED}>
    45     <input class="submit" name="submitOrderAlphaNum" type="submit" value="{'Order alphanumerically'|@translate}" {$TAG_INPUT_ENABLED}>
    46         <input class="submit" name="submitOrderAlphaNumReverse" type="submit" value="{'Order alphanumerically reverse'|@translate}" {$TAG_INPUT_ENABLED}>
    47   </p>
     53    <label><input type="radio" name="order_type" value="manual" checked="checked"> {'manual order'|@translate}</label>
     54    <label><input type="radio" name="order_type" value="automatic"> {'automatic order'|@translate}</label>
     55    <span id="automatic_order_params" style="display:none">
     56      <select name="ascdesc">
     57        <option value="asc">{'ascending'|@translate}</option>
     58        <option value="desc">{'descending'|@translate}</option>
     59      </select>
     60      <label><input type="checkbox" name="recursive"> {'apply to sub-categories'|@translate}</label>
     61    </span>
     62  </div>
     63
    4864  <ul class="categoryUl">
    4965
     
    86102    {/foreach}
    87103  </ul>
    88   <p>
    89     <input class="submit" name="submitOrder" type="submit" value="{'Save order'|@translate}" {$TAG_INPUT_ENABLED}>
    90     <input class="submit" name="submitOrderAlphaNum" type="submit" value="{'Order alphanumerically'|@translate}" {$TAG_INPUT_ENABLED}>
    91         <input class="submit" name="submitOrderAlphaNumReverse" type="submit" value="{'Order alphanumerically reverse'|@translate}" {$TAG_INPUT_ENABLED}>
    92   </p>
    93 
    94104</form>
    95105{/if}
Note: See TracChangeset for help on using the changeset viewer.