Ignore:
Timestamp:
May 25, 2011, 11:00:46 AM (13 years ago)
Author:
patdenice
Message:

Load tags for tokeninput directly in html page. Ajax is too slow.

File:
1 edited

Legend:

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

    r11008 r11039  
    44
    55{combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
    6 {footer_script require='jquery.tokeninput'}{literal}
    7 jQuery(document).ready(function() {
    8   jQuery.getJSON('admin.php?fckb_tags=1', function(data) {
    9     jQuery("#tags").tokenInput(
    10       data,
    11       {
    12     {/literal}
    13         hintText: '{'Type in a search term'|@translate}',
    14         noResultsText: '{'No results'|@translate}',
    15         searchingText: '{'Searching...'|@translate}',
    16         newText: ' ({'new'|@translate})',
    17         animateDropdown: false,
    18         preventDuplicates: true,
    19         allowCreation: true
    20     {literal}
    21       }
    22     );
    23   });
     6{footer_script require='jquery.tokeninput'}
     7jQuery(document).ready(function() {ldelim}
     8  jQuery("#tags").tokenInput(
     9    [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
     10    {ldelim}
     11      hintText: '{'Type in a search term'|@translate}',
     12      noResultsText: '{'No results'|@translate}',
     13      searchingText: '{'Searching...'|@translate}',
     14      newText: ' ({'new'|@translate})',
     15      animateDropdown: false,
     16      preventDuplicates: true,
     17      allowCreation: true
     18    }
     19  );
    2420});
    25 {/literal}{/footer_script}
     21{/footer_script}
    2622
    2723{footer_script}
     
    143139        <td>
    144140<select id="tags" name="tags">
    145 {foreach from=$tags item=tag}
     141{foreach from=$tag_selection item=tag}
    146142  <option value="{$tag.id}" class="selected">{$tag.name}</option>
    147143{/foreach}
Note: See TracChangeset for help on using the changeset viewer.