Dotclear

Changeset 3182:adf3c934173f for admin/js


Ignore:
Timestamp:
02/22/16 16:15:18 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Disable submit button unless at least one item selected whenever is possible, closes #1600

Location:
admin/js
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_comments.js

    r2566 r3182  
    6060     }); 
    6161     $('.checkboxes-helpers').each(function() { 
    62           dotclear.checkboxesHelpers(this); 
     62          dotclear.checkboxesHelpers(this,undefined,'#form-comments td input[type=checkbox]','#form-comments #do-action'); 
    6363     }); 
    6464     $('#form-comments td input[type=checkbox]').enableShiftClick(); 
    6565     dotclear.commentsActionsHelper(); 
     66     dotclear.condSubmit('#form-comments td input[type=checkbox]','#form-comments #do-action'); 
    6667     $('form input[type=submit][name=delete_all_spam]').click(function(){ 
    6768          return window.confirm(dotclear.msg.confirm_spam_delete); 
  • admin/js/_media.js

    r3153 r3182  
    135135 
    136136     $('.checkboxes-helpers').each(function() { 
    137           dotclear.checkboxesHelpers(this); 
     137          dotclear.checkboxesHelpers(this,undefined,'#form-medias input[type="checkbox"]','#form-medias #delete_medias'); 
    138138     }); 
     139     dotclear.condSubmit('#form-medias input[type="checkbox"]','#form-medias #delete_medias'); 
    139140 
    140141     $('#form-medias #delete_medias').click(function(e) { 
  • admin/js/_posts_actions.js

    r1806 r3182  
    1313          legend_click: true 
    1414     }); 
     15     dotclear.condSubmit('table.posts-list td input[type=checkbox]','input[type=submit]'); 
    1516}); 
  • admin/js/_posts_list.js

    r2811 r3182  
    6060     }); 
    6161     $('.checkboxes-helpers').each(function() { 
    62           dotclear.checkboxesHelpers(this); 
     62          dotclear.checkboxesHelpers(this,undefined,'#form-entries td input[type=checkbox]','#form-entries #do-action'); 
    6363     }); 
    6464     $('#form-entries td input[type=checkbox]').enableShiftClick(); 
     65     dotclear.condSubmit('#form-entries td input[type=checkbox]','#form-entries #do-action'); 
    6566     dotclear.postsActionsHelper(); 
    6667}); 
  • admin/js/_users.js

    r2566 r3182  
    11$(function() { 
    22     $('.checkboxes-helpers').each(function() { 
    3           dotclear.checkboxesHelpers(this); 
     3          dotclear.checkboxesHelpers(this,undefined,'#form-users input[type="checkbox"]','#form-users #do-action'); 
    44     }); 
     5     dotclear.condSubmit('#form-users input[type="checkbox"]','#form-users #do-action'); 
    56     $('#form-users').submit(function() { 
    67          var action = $(this).find('select[name="action"]').val(); 
  • admin/js/_users_actions.js

    r2566 r3182  
    9393$(function() { 
    9494     $('.checkboxes-helpers').each(function() { 
    95           dotclear.checkboxesHelpers(this); 
     95          dotclear.checkboxesHelpers(this,undefined,'#form-blogs input[type="checkbox"]','#form-blogs #do-action'); 
    9696     }); 
     97     dotclear.condSubmit('#form-blogs input[type="checkbox"]','#form-blogs #do-action'); 
    9798     $('#permissions-form').updatePermissionsForm(); 
    9899}); 
  • admin/js/common.js

    r2810 r3182  
    311311     msg: {}, 
    312312 
     313     condSubmit: function(chkboxes,target) { 
     314          var checkboxes = $(chkboxes), 
     315              submitButt = $(target); 
     316 
     317          if (checkboxes === undefined || submitButt === undefined) { 
     318               return; 
     319          } 
     320 
     321          // Set initial state 
     322         submitButt.attr("disabled", !checkboxes.is(":checked")); 
     323         if (!checkboxes.is(":checked")) { 
     324          submitButt.addClass('disabled'); 
     325         } else { 
     326          submitButt.removeClass('disabled'); 
     327         } 
     328 
     329          checkboxes.click(function() { 
     330               // Update target state 
     331              submitButt.attr("disabled", !checkboxes.is(":checked")); 
     332              if (!checkboxes.is(":checked")) { 
     333               submitButt.addClass('disabled'); 
     334              } else { 
     335               submitButt.removeClass('disabled'); 
     336              } 
     337          }); 
     338     }, 
     339 
    313340     hideLockable: function() { 
    314341          $('div.lockable').each(function() { 
     
    342369     }, 
    343370 
    344      checkboxesHelpers: function(e, target) { 
     371     checkboxesHelpers: function(e, target, c, s) { 
    345372          $(e).append(document.createTextNode(dotclear.msg.to_select)); 
    346373          $(e).append(document.createTextNode(' ')); 
     
    352379                    $(e).parents('form').find('input[type="checkbox"]').check(); 
    353380               } 
    354  
     381               if (c !== undefined && s !== undefined) { 
     382                    dotclear.condSubmit(c,s); 
     383               } 
    355384               return false; 
    356385          }).appendTo($(e)); 
     
    363392                    $(e).parents('form').find('input[type="checkbox"]').unCheck(); 
    364393               } 
    365  
     394               if (c !== undefined && s !== undefined) { 
     395                    dotclear.condSubmit(c,s); 
     396               } 
    366397               return false; 
    367398          }).appendTo($(e)); 
     
    374405                    $(e).parents('form').find('input[type="checkbox"]').toggleCheck(); 
    375406               } 
    376  
     407               if (c !== undefined && s !== undefined) { 
     408                    dotclear.condSubmit(c,s); 
     409               } 
    377410               return false; 
    378411          }).appendTo($(e)); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map