Ignore:
Timestamp:
Jan 12, 2014, 7:13:40 PM (7 years ago)
Author:
mistic100
Message:

integrate in new tags manager + rename in Coloured Tags
(my apologies to translators :-) )

Location:
extensions/typetags/template
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • extensions/typetags/template/admin.tpl

    r26663 r26665  
    1 {combine_script id="jquery.ui.draggable"}
    2 {combine_script id="jquery.ui.droppable"}
    3 {combine_script id="farbtastic" require="jquery" path=$ROOT_URL|@cat:"plugins/typetags/admin/farbtastic/farbtastic.js"}
    4 {combine_css path=$ROOT_URL|@cat:"plugins/typetags/admin/farbtastic/farbtastic.css"}
    5 {combine_css path=$ROOT_URL|@cat:"plugins/typetags/admin/typetags_style.css"}
     1{combine_script id="farbtastic" require="jquery" path=$TYPETAGS_PATH|cat:"template/farbtastic/farbtastic.js"}
     2{combine_css path=$TYPETAGS_PATH|cat:"template/farbtastic/farbtastic.css"}
     3{combine_css path=$TYPETAGS_PATH|cat:"template/style.css"}
    64
    7 {footer_script}{literal}
    8 // set all containers the same size
    9 function equilibrate() {
    10   var h=0;
    11   jQuery("#associations ul")
    12     .css('height', 'auto')
    13     .each(function() {
    14       h = Math.max(h, jQuery(this).height());
    15     })
    16     .promise().done(function() {
    17       jQuery("#associations ul").css({'height': h+'px'});
    18     });
    19    
    20   //jQuery("#tt-NULL").css('height', 'auto');
    21 }
    22 
    23 // generate tag:typetag couples before submit the form
    24 function save_datas(form) {
    25   var out = '';
    26  
    27   jQuery(".tt-container").each(function() {
    28     var section = jQuery(this).attr('id');
    29     jQuery("> li", this).each(function() {
    30       out += jQuery(this).attr('id') + ':' + section + ';';
    31     });
    32   });
    33  
    34   jQuery('#assoc-input').val(out);
    35   submit(form);
    36 }
    37 
    38 // colorpicker
     5{footer_script}
     6// init colorpicker
    397jQuery('#colorpicker').farbtastic('#hexval');
    40 
    41 // move each tag in it's typetag container
    42 jQuery('ul#tt-NULL li').each(function() {
    43   var $target = jQuery('ul#' + jQuery(this).attr('data'));
    44   jQuery(this).appendTo($target).css('float', 'left');
    45   if ($($target).attr('id') == 'tt-NULL') jQuery(this).css({'display':'inline-block','float':'none'});
    46 });
    47 equilibrate();
    48 
    49 // init drag
    50 jQuery("li").draggable({
    51   revert: "invalid",
    52   helper: "clone",
    53   cursor: "move"
    54 });
    55 
    56 // init drop
    57 jQuery('.tt-container').droppable({
    58   accept: "li",
    59   hoverClass: "active",
    60   drop: function(event, ui) {
    61     var $gallery = this;
    62     ui.draggable.fadeOut(function() {
    63       jQuery(this).appendTo($gallery).css('float', 'left').css('display','').fadeIn();
    64       if ($($gallery).attr('id') == 'tt-NULL') jQuery(this).css({'display':'inline-block','float':'none'});
    65       equilibrate();
    66     });     
    67   }
    68 });
    69 {/literal}{/footer_script}
     8{/footer_script}
    709
    7110<div class="titrePage">
    72   <h2>TypeT@gs</h2>
     11  <h2>Coloured Tags</h2>
    7312</div>
    74  
    75 <form action="{$typetags_ADMIN}" method="post" name="form">
     13
     14<form action="{$F_ACTION}" method="post" name="form">
    7615  <fieldset>
    7716  {if isset($IN_EDIT)}
    78     <legend>{'Edit typetag'|@translate}</legend>
     17    <legend>{'Edit color'|translate}</legend>
    7918    <div class="edit-container">
    8019      <div id="colorpicker"></div>
    81       <p><b>{'Edited TypeTag'|@translate} : <input type="text" readonly="readonly" size="18" style="background-color:{$typetag.OLD_COLOR};color:{$typetag.COLOR_TEXT};" value="{$typetag.OLD_NAME}"></b></p>
     20      <p><b>{'Edit color'|translate} : <input type="text" readonly="readonly" size="18" style="background-color:{$typetag.OLD_COLOR};color:{$typetag.COLOR_TEXT};" value="{$typetag.OLD_NAME}"></b></p>
    8221      <p>&nbsp;</p>
    83       <p>{'New name'|@translate} : <input type="text" size="18" name="typetag_name" value="{$typetag.NAME}"></p>
    84       <p>{'New color'|@translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{$typetag.COLOR}"></p>
     22      <p>{'New name'|translate} : <input type="text" size="18" name="typetag_name" value="{$typetag.NAME}"></p>
     23      <p>{'New color'|translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{$typetag.COLOR}"></p>
    8524      <p>&nbsp;</p>
    8625      <p>
    8726        <input type="hidden" name="edited_typetag" value="{$edited_typetag}">
    88         <input class="submit" type="submit" name="edittypetag" value="{'Modify'|@translate}">
    89         <input class="submit" type="submit" name="cancel" value="{'Reset'|@translate}">
     27        <input class="submit" type="submit" name="edittypetag" value="{'Save'|translate}">
     28        <input class="submit" type="submit" name="cancel" value="{'Reset'|translate}">
    9029      </p>
    9130    </div>
    9231  {else}
    93     <legend>{'Create a Typetag'|@translate}</legend>
     32    <legend>{'Add a new color'|translate}</legend>
    9433    <div class="edit-container">
    9534      <div id="colorpicker"></div>
    96       <p>{'New TypeTag'|@translate} : <input type="text" size="18" name="typetag_name" value="{if isset($typetag.NAME)}{$typetag.NAME}{/if}"></p>
    97       <p>{'Color TypeTag'|@translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{if isset($typetag.COLOR)}{$typetag.COLOR}{else}#444444{/if}"></p>
     35      <p>&nbsp;</p>
     36      <p>{'Name'|translate} : <input type="text" size="18" name="typetag_name" value="{if isset($typetag.NAME)}{$typetag.NAME}{/if}"></p>
     37      <p>{'Color'|translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{if isset($typetag.COLOR)}{$typetag.COLOR}{else}#444444{/if}"></p>
    9838      <p>&nbsp;</p>
    9939      <p>
    100         <input class="submit" type="submit" name="addtypetag" value="{'Create a Typetag'|@translate}">
     40        <input class="submit" type="submit" name="addtypetag" value="{'Add'|translate}">
    10141      </p>
    10242    </div>
     
    10545</form>
    10646
    107 {if !empty($typetags_selection) and !isset($IN_EDIT)}
    108 <form action="{$typetags_ADMIN}" method="post" name="form" onsubmit="save_datas(this);">
     47{if !empty($typetags)}
     48<fieldset>
     49  <legend>{'Manage colors'|translate}</legend>
     50
     51  <ul class="tagSelection typetagSelection">
     52  {foreach from=$typetags item=typetag}
     53    <li style="background-color:{$typetag.color};color:{$typetag.color_text};">
     54      <span class="buttons">
     55        <a href="{$typetag.u_edit}" title="{'edit'|translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" class="button" alt="{'edit'|translate}"></a>
     56        <a href="{$typetag.u_delete}" title="{'delete'|translate}" onclick="return confirm('{'Are you sure?'|translate}');"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'delete'|translate}"></a>
     57      </span>
     58      {$typetag.name}
     59    </li>
     60  {/foreach}
     61  </ul>
     62
     63  <p style="text-align:left;">{'Go to <a href="%s">Photos/Tags</a> to manage associations.'|translate:($ROOT_URL|cat:'admin.php?page=tags')}</p>
     64</fieldset>
     65{/if}
     66
     67
     68<form action="{$F_ACTION}" method="post" name="form">
    10969  <fieldset>
    110     <legend>{'Edit and associate TypeTags'|@translate}</legend>
    111    
    112     <ul id="tt-NULL" class="tt-container NULL">
    113       <h5>{'Not associated'|@translate}</h5>
    114       {foreach from=$typetags_association item=tag}
    115       <li id="t-{$tag.tagid}" data="tt-{$tag.typetagid}">
    116         {$tag.tagname}
    117       </li>
    118       {/foreach}
    119     </ul>
    120    
    121     <div id="associations">
    122     {foreach from=$typetags_selection item=typetag}
    123       <ul id="tt-{$typetag.id}" class="tt-container" style="box-shadow:inset 0 0 5px {$typetag.color};">
    124         <span class="buttons">
    125           <a href="{$typetag.u_edit}" title="{'edit'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" class="button" alt="{'edit'|@translate}"></a>
    126           <a href="{$typetag.u_delete}" title="{'delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'delete'|@translate}"></a>
    127         </span>
    128         <h5 style="background-color:{$typetag.color};color:{$typetag.color_text};">{$typetag.name}</h5>
    129       </ul>
    130     {/foreach}
    131     </div>
    132    
    133     <div style="clear:both;"></div>
    134     <p style="margin-top:20px;">
    135       <input type="hidden" name="associations" id="assoc-input">
    136       <input class="submit" type="submit" name="associate" value="{'Validate'|@translate}">
    137       <input class="submit" type="submit" name="delete_all_assoc" value="{'Delete all associations'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
    138     </p>
     70    <legend>{'Configuration'|translate}</legend>
     71
     72    <b>{'Display colored tags'|translate}</b>
     73    <label><input type="radio" name="show_all" value="false" {if not $SHOW_ALL}checked="checked"{/if}> {'Only on tags page'|translate}</label>
     74    <label><input type="radio" name="show_all" value="true" {if $SHOW_ALL}checked="checked"{/if}> {'Everywhere'|translate}</label>
     75
     76    <p><input class="submit" type="submit" name="save_config" value="{'Submit'|translate}"></p>
    13977  </fieldset>
    14078</form>
    141 {/if}
    142 
    143 {if !isset($IN_EDIT)}
    144 <form action="{$typetags_ADMIN}" method="post" name="form">
    145 <fieldset>
    146   <legend>{'Configuration'|@translate}</legend>
    147   <b>{'Display colored tags'|@translate}</b>
    148   <label><input type="radio" name="show_all" value="false" {if not $SHOW_ALL}checked="checked"{/if}> {'Only on tags page'|@translate}</label>
    149   <label><input type="radio" name="show_all" value="true" {if $SHOW_ALL}checked="checked"{/if}> {'Everywhere'|@translate}</label>
    150   <p><input class="submit" type="submit" name="save_config" value="{'Submit'|@translate}"></p>
    151 </fieldset>
    152 </form>
    153 {/if}
Note: See TracChangeset for help on using the changeset viewer.