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.

Location:
trunk/admin/themes/default/template
Files:
3 edited

Legend:

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

    r11008 r11039  
    1010{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
    1111
    12 {footer_script require='jquery.tokeninput'}{literal}
    13 jQuery(document).ready(function() {
    14   jQuery.getJSON('admin.php?fckb_tags=1', function(data) {
    15     jQuery("#tags").tokenInput(
    16       data,
    17       {
    18     {/literal}
    19         hintText: '{'Type in a search term'|@translate}',
    20         noResultsText: '{'No results'|@translate}',
    21         searchingText: '{'Searching...'|@translate}',
    22         newText: ' ({'new'|@translate})',
    23         animateDropdown: false,
    24         preventDuplicates: true,
    25         allowCreation: true
    26     {literal}
    27       }
    28     );
    29   });
     12{footer_script require='jquery.tokeninput'}
     13jQuery(document).ready(function() {ldelim}
     14  jQuery("#tags").tokenInput(
     15    [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
     16    {ldelim}
     17      hintText: '{'Type in a search term'|@translate}',
     18      noResultsText: '{'No results'|@translate}',
     19      searchingText: '{'Searching...'|@translate}',
     20      newText: ' ({'new'|@translate})',
     21      animateDropdown: false,
     22      preventDuplicates: true,
     23      allowCreation: true
     24    }
     25  );
    3026});
    31 {/literal}{/footer_script}
     27{/footer_script}
    3228
    3329{footer_script}
  • trunk/admin/themes/default/template/batch_manager_unit.tpl

    r11008 r11039  
    1414        tag_boxes_selector = tag_boxes_selector + prefix + "#tags-" + {$element.ID};
    1515{/foreach}
    16 {literal}
    17 jQuery(document).ready(function() {
    18   jQuery.getJSON('admin.php?fckb_tags=1', function(data) {
    19     jQuery(tag_boxes_selector).tokenInput(
    20       data,
    21       {
    22     {/literal}
    23         hintText: '{'Type in a search term'|@translate}',
    24         noResultsText: '{'No results'|@translate}',
    25         searchingText: '{'Searching...'|@translate}',
    26         newText: ' ({'new'|@translate})',
    27         animateDropdown: false,
    28         preventDuplicates: true,
    29         allowCreation: true
    30     {literal}
    31       }
    32     );
    33   });
    34  
    35   $("a.preview-box").colorbox();
     16
     17jQuery(document).ready(function() {ldelim}
     18  jQuery(tag_boxes_selector).tokenInput(
     19    [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
     20    {ldelim}
     21      hintText: '{'Type in a search term'|@translate}',
     22      noResultsText: '{'No results'|@translate}',
     23      searchingText: '{'Searching...'|@translate}',
     24      newText: ' ({'new'|@translate})',
     25      animateDropdown: false,
     26      preventDuplicates: true,
     27      allowCreation: true
     28    }
     29  );
     30
     31  jQuery("a.preview-box").colorbox();
    3632});
    37 {/literal}{/footer_script}
     33{/footer_script}
    3834
    3935<h2>{'Batch Manager'|@translate}</h2>
  • 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.