Changeset 18484


Ignore:
Timestamp:
Oct 5, 2012, 9:36:38 PM (12 years ago)
Author:
rvelices
Message:

added "are you sure?" confirmation before deleting all derivatives in maintenance or before deleting more than 500 derivatives in the batch manager

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

Legend:

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

    r17931 r18484  
    9595var nb_thumbs_page = {$nb_thumbs_page};
    9696var nb_thumbs_set = {$nb_thumbs_set};
     97var are_you_sure = "{'Are you sure?'|@translate|@escape:'javascript'}";
    9798var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}";
    9899var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}];
     
    188189    }
    189190    else {
    190       $(".thumbnails input[type=checkbox]").each(function() {
    191          if ($(this).is(':checked')) {
    192            nbSelected++;
    193          }
    194       });
     191      nbSelected = $(".thumbnails input[type=checkbox]").filter(':checked').length;
    195192    }
    196193
     
    418415
    419416  jQuery('#applyAction').click(function() {
    420                 if (jQuery('[name="selectAction"]').val() != 'generate_derivatives'
     417                var action = jQuery('[name="selectAction"]').val();
     418                if (action == 'delete_derivatives') {
     419                        var d_count = $('#action_delete_derivatives input[type=checkbox]').filter(':checked').length
     420                                , e_count = $('input[name="setSelected"]').is(':checked') ? nb_thumbs_set : $('.thumbnails input[type=checkbox]').filter(':checked').length;
     421                        if (d_count*e_count > 500)
     422                                return confirm(are_you_sure);
     423                }
     424               
     425                if (action != 'generate_derivatives'
    421426                        || derivatives.finished() )
    422427                {
     
    436441                        derivatives.elements = all_elements;
    437442                else
    438                         jQuery('input[name="selection[]"]').each(function() {
     443                        jQuery('.thumbnails input[type=checkbox]').each(function() {
    439444                                if (jQuery(this).attr('checked')) {
    440445                                        derivatives.elements.push(jQuery(this).val());
     
    581586        <option value="filter_dimension" {if isset($filter.dimension)}disabled="disabled"{/if}>{'Dimensions'|@translate}</option>
    582587      </select>
    583 <!--      <input id="removeFilters" class="submit" type="submit" value="Remove all filters" name="removeFilters"> -->
    584588      <a id="removeFilters" href="">{'Remove all filters'|@translate}</a>
    585589    </p>
     
    713717            {html_options options=$associate_options }
    714718         </select>
    715 <br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
     719<br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
    716720    </div>
    717721
     
    721725            {html_options options=$move_options }
    722726         </select>
    723 <br>{'... or '|@translate}</span><a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
     727<br>{'... or '|@translate} <a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
    724728    </div>
    725729
  • trunk/admin/themes/default/template/maintenance.tpl

    r13544 r18484  
    3636        <li><a href="{$U_MAINT_COMPILED_TEMPLATES}">{'Purge compiled templates'|@translate}</a></li>
    3737        <li>{'Delete multiple size images'|@translate}:
    38         {foreach from=$purge_derivatives key=name item=url name=loop}{if !$smarty.foreach.loop.first}, {/if}<a href="{$url}">{$name}</a>{/foreach}
     38        {foreach from=$purge_derivatives key=name item=url name=loop}{if !$smarty.foreach.loop.first}, {/if}<a href="{$url}"{if $smarty.foreach.loop.first} onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"{/if}>{$name}</a>{/foreach}
    3939        </li>
    4040</ul>
Note: See TracChangeset for help on using the changeset viewer.