Changeset 18974


Ignore:
Timestamp:
Nov 8, 2012, 7:48:50 AM (8 years ago)
Author:
rvelices
Message:

js code simplification

File:
1 edited

Legend:

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

    r18607 r18974  
    55{combine_script id='jquery.tokeninput' load='async' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
    66{footer_script require='jquery.tokeninput'}
    7 var tag_boxes_selector = "";
    8 {foreach from=$elements item=element name=element}
    9 {if $smarty.foreach.element.first}
    10 var prefix = "";
    11 {else}
    12 prefix = ", ";
    13 {/if}
    14         tag_boxes_selector = tag_boxes_selector + prefix + "#tags-" + {$element.id};
    15 {/foreach}
    16 
    177jQuery(document).ready(function() {ldelim}
    18   jQuery(tag_boxes_selector).tokenInput(
    19     [{foreach from=$tags item=tag name=tags}{ldelim}"name":"{$tag.name|@escape:'javascript'}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
     8        jQuery('select[name|="tags"]').tokenInput(
     9                [{foreach from=$tags item=tag name=tags}{ldelim}name:"{$tag.name|@escape:'javascript'}",id:"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
    2010    {ldelim}
    2111      hintText: '{'Type in a search term'|@translate}',
     
    113103      <td>
    114104
    115 <select id="tags-{$element.id}" name="tags-{$element.id}">
     105<select name="tags-{$element.id}">
    116106{foreach from=$element.TAGS item=tag}
    117107  <option value="{$tag.id}" class="selected">{$tag.name}</option>
     
    132122{/foreach}
    133123
    134 {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
     124{if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
    135125
    136126<p>
    137   <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit">
    138   <input class="submit" type="reset" value="{'Reset'|@translate}">
     127  <input type="submit" value="{'Submit'|@translate}" name="submit">
     128  <input type="reset" value="{'Reset'|@translate}">
    139129</p>
    140130{/if}
     
    142132</form>
    143133
    144 <script type="text/javascript">// <![CDATA[
     134{footer_script}
    145135{literal}$(document).ready(function() {
    146         $(".elementEdit img").fadeTo("slow", 0.6); // Opacity on page load
    147         $(".elementEdit img").hover(function(){
    148                 $(this).fadeTo("slow", 1.0); // Opacity on hover
    149         },function(){
     136        $(".elementEdit img")
     137                .fadeTo("slow", 0.6) // Opacity on page load
     138                .hover(function(){
     139                        $(this).fadeTo("slow", 1.0); // Opacity on hover
     140                },function(){
    150141                $(this).fadeTo("slow", 0.6); // Opacity on mouseout
    151         });
     142                });
    152143});{/literal}
    153 // ]]>
    154 </script>
     144{/footer_script}
Note: See TracChangeset for help on using the changeset viewer.