Changeset 3219 for trunk/admin


Ignore:
Timestamp:
Mar 22, 2009, 3:50:36 PM (15 years ago)
Author:
nikrou
Message:

feature 959 : improve reordering of menubar block by using drag and drop
a new jquery pluging to reodering table rows because jquery.sortable don't work well with table rows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/template/goto/menubar.tpl

    r3215 r3219  
    11{* $Id$ *}
     2{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
     3{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/packed/ui.core.packed.js" }
     4{known_script id="jquery-tablednd" src=$ROOT_URL|@cat:"template-common/lib/jquery.tablednd.js"}
     5
     6{literal}
     7<script type="text/javascript">
     8$(function() {
     9$('table.table2').tableDnD({
     10onDrop:function(table,row) {
     11var rows = table.tBodies[0].rows;
     12for (var i=0; i<rows.length; i++) {
     13  $(rows[i])
     14     .attr('class', 'row'+i%2)
     15     .find("input[@type='text']").attr('value', (i+1)*10);
     16}
     17}
     18});
     19});
     20</script>
     21{/literal}
    222
    323<div class="titrePage">
    4         <h2>Menubar</h2>
     24  <h2>Menubar</h2>
    525</div>
    6 
     26<div id="debugArea"></div>
    727<form method="post" action="{$F_ACTION}" class="properties">
    8 <table class="table2">
    9         <tr class="throw">
    10                 <td>Id</td>
    11                 <td>{'Author'|@translate}</td>
    12                 <td>{'Name'|@translate}</td>
    13                 <td>{'Position'|@translate}</td>
    14                 <td>Hide</td>
     28  <table class="table2" style="width:99%">
     29    <thead>
     30      <tr class="throw">
     31        <td>Id</td>
     32        <td>{'Author'|@translate}</td>
     33        <td>{'Name'|@translate}</td>
     34        <td>{'Position'|@translate}</td>
     35        <td>Hide</td>
     36      </tr>
     37    </thead>
     38    <tbody>
     39    {foreach from=$blocks item=block name="block_loop"}
     40        <tr class="{if $smarty.foreach.block_loop.index is odd}row1{else}row2{/if}">
     41          <td>{$block.reg->get_id()}</td>
     42          <td>{$block.reg->get_owner()}</td>
     43          <td>{$block.reg->get_name()|@translate}</td>
     44          <td><input type="text" name="pos_{$block.reg->get_id()}" value={math equation="abs(pos)" pos=$block.pos} size="2"></td>
     45          <td><input type="checkbox" name="hide_{$block.reg->get_id()}" {if $block.pos<0}checked="checked"{/if}></td>
    1546        </tr>
    16         {foreach from=$blocks item=block name="block_loop"}
    17         <tr class="{if $smarty.foreach.block_loop.index is odd}row1{else}row2{/if}">
    18                 <td>{$block.reg->get_id()}</td>
    19                 <td>{$block.reg->get_owner()}</td>
    20                 <td>{$block.reg->get_name()|@translate}</td>
    21                 <td><input type="text" name="pos_{$block.reg->get_id()}" value={math equation="abs(pos)" pos=$block.pos} size="2"></td>
    22                 <td><input type="checkbox" name="hide_{$block.reg->get_id()}" {if $block.pos<0}checked="checked"{/if} ></td>
    23         </tr>
    24         {/foreach}
    25 </table>
    26 <p>
    27         <input type="submit" name="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED}>
    28         <input type="submit" name="reset" value="{'Reset'|@translate}" {$TAG_INPUT_ENABLED}>
    29 </p>
     47     {/foreach}
     48     </tbody>
     49  </table>
     50  <p>
     51    <input type="submit" name="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED}>
     52    <input type="submit" name="reset" value="{'Reset'|@translate}" {$TAG_INPUT_ENABLED}>
     53  </p>
    3054</form>
Note: See TracChangeset for help on using the changeset viewer.