Projet

Général

Profil

Révision 27370441

Ajouté par Assos Assos il y a plus de 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/field_group/field_group.js
41 41
    $('div.field-group-accordion-wrapper', context).once('fieldgroup-effects', function () {
42 42
      var wrapper = $(this);
43 43

  
44
      // Get the index to set active.
45
      var active_index = false;
46
      wrapper.find('.accordion-item').each(function(i) {
47
        if ($(this).hasClass('field-group-accordion-active')) {
48
          active_index = i;
49
        }
50
      });
51

  
44 52
      wrapper.accordion({
45
        autoHeight: false,
46
        active: '.field-group-accordion-active',
53
        heightStyle: "content",
54
        active: active_index,
47 55
        collapsible: true,
48 56
        changestart: function(event, ui) {
49 57
          if ($(this).hasClass('effect-none')) {
......
111 119
Drupal.FieldGroup.Effects.processTabs = {
112 120
  execute: function (context, settings, type) {
113 121
    if (type == 'form') {
122

  
123
      var errorFocussed = false;
124

  
114 125
      // Add required fields mark to any fieldsets containing required fields
115 126
      $('fieldset.vertical-tabs-pane', context).once('fieldgroup-effects', function(i) {
116 127
        if ($(this).is('.required-fields') && $(this).find('.form-required').length > 0) {
......
118 129
        }
119 130
        if ($('.error', $(this)).length) {
120 131
          $(this).data('verticalTab').link.parent().addClass('error');
121
          Drupal.FieldGroup.setGroupWithfocus($(this));
122
          $(this).data('verticalTab').focus();
132
          // Focus the first tab with error.
133
          if (!errorFocussed) {
134
            Drupal.FieldGroup.setGroupWithfocus($(this));
135
            $(this).data('verticalTab').focus();
136
            errorFocussed = true;
137
          }
123 138
        }
124 139
      });
125 140
    }
......
202 217
    $('.fieldset-wrapper .fieldset > legend').css({display: 'block'});
203 218
    $('.vertical-tabs fieldset.fieldset').addClass('default-fallback');
204 219

  
205

  
206 220
    // Add a new ID to each fieldset.
207
    $('.group-wrapper fieldset').each(function() {
221
    $('.group-wrapper .horizontal-tabs-panes > fieldset', context).once('group-wrapper-panes-processed', function() {
208 222
      // Tats bad, but we have to keep the actual id to prevent layouts to break.
209
      var fieldgorupID = 'field_group-' + $(this).attr('id') + ' ' + $(this).attr('id');
210
      $(this).attr('id', fieldgorupID);
211
    })
223
      var fieldgroupID = 'field_group-' + $(this).attr('id');
224
      $(this).attr('id', fieldgroupID);
225
    });
212 226
    // Set the hash in url to remember last userselection.
213
    $('.group-wrapper ul li').each(function() {
227
    $('.group-wrapper ul li').once('group-wrapper-ul-processed', function() {
214 228
      var fieldGroupNavigationListIndex = $(this).index();
215 229
      $(this).children('a').click(function() {
216 230
        var fieldset = $('.group-wrapper fieldset').get(fieldGroupNavigationListIndex);
......
219 233
        window.location.hash = hashUrl;
220 234
      });
221 235
    });
236

  
222 237
  }
223 238
};
224 239

  
225
})(jQuery);
240
})(jQuery);

Formats disponibles : Unified diff