addfolder

This commit is contained in:
2018-04-23 21:14:46 +02:00
parent cec9a0314b
commit a7cb972085
192 changed files with 16037 additions and 24 deletions
@@ -0,0 +1,68 @@
(function ($) {
'use strict';
Drupal.FieldGroup = Drupal.FieldGroup || {};
Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
/**
* Implements Drupal.FieldGroup.processHook().
*/
Drupal.FieldGroup.Effects.processAccordion = {
execute: function (context, settings, group_info) {
$('div.field-group-accordion-wrapper', context).once('fieldgroup-effects').each(function () {
var wrapper = $(this);
// Get the index to set active.
var active_index = false;
wrapper.find('.accordion-item').each(function (i) {
if ($(this).hasClass('field-group-accordion-active')) {
active_index = i;
}
});
wrapper.accordion({
heightStyle: 'content',
active: active_index,
collapsible: true,
changestart: function (event, ui) {
if ($(this).hasClass('effect-none')) {
ui.options.animated = false;
}
else {
ui.options.animated = 'slide';
}
}
});
if (group_info.context === 'form') {
var $firstErrorItem = false;
// Add required fields mark to any element containing required fields
wrapper.find('div.field-group-accordion-item').each(function (i) {
var $this = $(this);
if ($this.is('.required-fields') && ($this.find('[required]').length > 0 || $this.find('.form-required').length > 0)) {
$('h3.ui-accordion-header a').eq(i).addClass('form-required');
}
if ($('.error', $this).length) {
// Save first error item, for focussing it.
if (!$firstErrorItem) {
$firstErrorItem = $this.parent().accordion('activate', i);
}
$('h3.ui-accordion-header').eq(i).addClass('error');
}
});
// Save first error item, for focussing it.
if (!$firstErrorItem) {
$('.ui-accordion-content-active', $firstErrorItem).css({height: 'auto', width: 'auto', display: 'block'});
}
}
});
}
};
})(jQuery);
@@ -0,0 +1,23 @@
(function ($) {
'use strict';
Drupal.FieldGroup = Drupal.FieldGroup || {};
Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
/**
* This script adds the required and error classes to the details wrapper.
*/
Drupal.behaviors.fieldGroupDetails = {
attach: function (context) {
$(context).find('.field-group-details').once('field-group-details').each(function () {
var $this = $(this);
if ($this.is('.required-fields') && ($this.find('[required]').length > 0 || $this.find('.form-required').length > 0)) {
$('summary', $this).first().addClass('form-required');
}
});
}
};
})(jQuery);
@@ -0,0 +1,24 @@
(function ($) {
'use strict';
Drupal.FieldGroup = Drupal.FieldGroup || {};
Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
/**
* This script adds the required and error classes to the fieldset wrapper.
*/
Drupal.behaviors.fieldGroupDFieldset = {
attach: function (context) {
$(context).find('.field-group-fieldset').once('field-group-fieldset').each(function () {
var $this = $(this);
if ($this.is('.required-fields') && ($this.find('[required]').length > 0 || $this.find('.form-required').length > 0)) {
$('legend', $this).first().addClass('form-required');
}
});
}
};
})(jQuery);
@@ -0,0 +1,70 @@
(function ($) {
'use strict';
Drupal.FieldGroup = Drupal.FieldGroup || {};
Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
/**
* Implements Drupal.FieldGroup.processHook().
*/
Drupal.FieldGroup.Effects.processHtml_element = {
execute: function (context, settings, group_info) {
$('.field-group-html-element', context).once('fieldgroup-effects').each(function () {
var $wrapper = $(this);
if ($wrapper.hasClass('fieldgroup-collapsible')) {
Drupal.FieldGroup.Effects.processHtml_element.renderCollapsible($wrapper);
}
else {
// Add required field markers if needed
if (group_info.settings.show_label && $wrapper.is('.required-fields') && ($wrapper.find('[required]').length > 0 || $wrapper.find('.form-required').length > 0)) {
$wrapper.find(group_info.settings.label_element + ':first').addClass('form-required');
}
}
});
},
renderCollapsible: function($wrapper) {
// Turn the legend into a clickable link, but retain span.field-group-format-toggler
// for CSS positioning.
var $toggler = $('.field-group-toggler:first', $wrapper);
var $link = $('<a class="field-group-title" href="#"></a>');
$link.prepend($toggler.contents());
// Add required field markers if needed
if ($wrapper.is('.required-fields') && ($wrapper.find('[required]').length > 0 || $wrapper.find('.form-required').length > 0)) {
$link.addClass('form-required');
}
$link.appendTo($toggler);
// .wrapInner() does not retain bound events.
$link.click(function () {
var wrapper = $wrapper.get(0);
// Don't animate multiple times.
if (!wrapper.animating) {
wrapper.animating = true;
var speed = $wrapper.hasClass('speed-fast') ? 300 : 1000;
if ($wrapper.hasClass('effect-none') && $wrapper.hasClass('speed-none')) {
$('> .field-group-wrapper', wrapper).toggle();
}
else if ($wrapper.hasClass('effect-blind')) {
$('> .field-group-wrapper', wrapper).toggle('blind', {}, speed);
}
else {
$('> .field-group-wrapper', wrapper).toggle(speed);
}
wrapper.animating = false;
}
$wrapper.toggleClass('collapsed');
return false;
});
}
};
})(jQuery);
@@ -0,0 +1,129 @@
.horizontal-tabs {
margin: 0 0 1em 0; /* LTR */
padding: 0;
border: 1px solid #ccc;
position: relative; /* IE6/7 */
}
[dir="rtl"] .horizontal-tabs {
margin: 0 0 1em 0;
}
.horizontal-tabs .horizontal-tabs-list {
display: inline-block;
margin: 0;
border: 0;
padding: 0px;
list-style: none;
background-color: #dedede;
border-right: 1px solid #dedede; /* LTR */
width: 100%;
height: auto;
clear: both;
}
[dir="rtl"] .horizontal-tabs .horizontal-tabs-list {
border-right: 0;
border-left: 1px solid #dedede;
}
.horizontal-tabs-pane {
padding: 0 1em;
border: 0;
}
.horizontal-tabs-pane > summary {
display: none;
}
/* Layout of each tab */
.horizontal-tabs .horizontal-tab-button {
background: #eee;
border-right: 1px solid #ccc; /* LTR */
padding: 1px;
padding-top: 0;
margin: 0;
min-width: 5em; /* IE7 */
float: left; /* LTR */
}
[dir="rtl"] .horizontal-tabs .horizontal-tab-button {
border-right: 0;
border-left: 1px solid #ccc;
float: right;
}
.horizontal-tabs .horizontal-tab-button a {
display: block;
text-decoration: none;
padding: 0.5em 0.6em;
}
.horizontal-tabs .horizontal-tab-button a:hover {
outline: none;
background-color: #ededdd;
}
.horizontal-tabs .horizontal-tab-button li:hover,
.horizontal-tabs .horizontal-tab-button li:focus {
background-color: #ddd;
}
.horizontal-tabs ul.horizontal-tabs-list :focus {
outline: none;
}
.horizontal-tab-button a:focus strong,
.horizontal-tab-button a:active strong,
.horizontal-tab-button a:hover strong {
text-decoration: none;
outline: none;
}
.horizontal-tab-button.selected {
background-color: #fff;
padding: 0 0 1px 0;
}
[dir="rtl"] .horizontal-tab-button.selected {
border-left-width: 0;
border-right-width: 1px;
}
.horizontal-tabs ul.horizontal-tabs-list li a,
.horizontal-tabs ul.horizontal-tabs-list li.selected a {
display: block;
text-decoration: none;
padding: 0.5em 0.6em 0.3em 0.6em;
position:relative;
top: 0px;
}
.horizontal-tab-button .selected strong {
color: #000;
}
.horizontal-tab-button .summary {
display: block;
}
.horizontal-tab-button .summary {
line-height: normal;
margin-bottom: 0;
}
/**
* tab content
*/
div.field-group-htabs-wrapper .field-group-format-wrapper {
clear: both;
padding: 0 0 0.6em;
}
/*hide*/
.horizontal-tabs .horizontal-tab-hidden {
display: block;
position: absolute;
top: -100000px;
width: 100%;
}
@@ -0,0 +1,248 @@
(function ($) {
'use strict';
Drupal.FieldGroup = Drupal.FieldGroup || {};
Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
/**
* This script transforms a set of fieldsets into a stack of horizontal
* tabs. Another tab pane can be selected by clicking on the respective
* tab.
*
* Each tab may have a summary which can be updated by another
* script. For that to work, each fieldset has an associated
* 'horizontalTabCallback' (with jQuery.data() attached to the fieldset),
* which is called every time the user performs an update to a form
* element inside the tab pane.
*/
Drupal.behaviors.horizontalTabs = {
attach: function (context) {
var width = drupalSettings.widthBreakpoint || 640;
var mq = '(max-width: ' + width + 'px)';
if (window.matchMedia(mq).matches) {
return;
}
$(context).find('[data-horizontal-tabs-panes]').once('horizontal-tabs').each(function () {
var $this = $(this).addClass('horizontal-tabs-panes');
var focusID = $(':hidden.horizontal-tabs-active-tab', this).val();
var tab_focus;
// Check if there are some details that can be converted to horizontal-tabs
var $details = $this.find('> details');
if ($details.length === 0) {
return;
}
// If collapse.js did not do his work yet, call it directly.
if (!$($details[0]).hasClass('.collapse-processed')) {
Drupal.behaviors.collapse.attach(context);
}
// Create the tab column.
var tab_list = $('<ul class="horizontal-tabs-list"></ul>');
$(this).wrap('<div class="horizontal-tabs clearfix"></div>').before(tab_list);
// Transform each details into a tab.
$details.each(function (i) {
var $this = $(this);
var summaryElement = $this.find('> summary .details-title');
if (!summaryElement.length) {
summaryElement = $this.find('> summary');
}
var summary = summaryElement.clone().children().remove().end().text();
var horizontal_tab = new Drupal.horizontalTab({
title: $.trim(summary),
details: $this
});
horizontal_tab.item.addClass('horizontal-tab-button-' + i);
tab_list.append(horizontal_tab.item);
$this
.removeClass('collapsed')
// prop() can't be used on browsers not supporting details element,
// the style won't apply to them if prop() is used.
.attr('open', true)
.addClass('horizontal-tabs-pane')
.data('horizontalTab', horizontal_tab);
if (this.id === focusID) {
tab_focus = $this;
}
});
$(tab_list).find('> li:first').addClass('first');
$(tab_list).find('> li:last').addClass('last');
if (!tab_focus) {
// If the current URL has a fragment and one of the tabs contains an
// element that matches the URL fragment, activate that tab.
var hash = window.location.hash.replace(/[=%;,\/]/g, '');
if (hash !== '#' && $(hash, this).length) {
tab_focus = $(window.location.hash, this).closest('.horizontal-tabs-pane');
}
else {
tab_focus = $this.find('> .horizontal-tabs-pane:first');
}
}
if (tab_focus.length) {
tab_focus.data('horizontalTab').focus();
}
});
}
};
/**
* The horizontal tab object represents a single tab within a tab group.
*
* @param {object} settings
* An object with the following keys:
* - title: The name of the tab.
* - details: The jQuery object of the details element that is the tab pane.
*/
Drupal.horizontalTab = function (settings) {
var self = this;
$.extend(this, settings, Drupal.theme('horizontalTab', settings));
this.link.attr('href', '#' + settings.details.attr('id'));
this.link.on('click', function (e) {
e.preventDefault();
self.focus();
});
// Keyboard events added:
// Pressing the Enter key will open the tab pane.
this.link.on('keydown', function (event) {
event.preventDefault();
if (event.keyCode === 13) {
self.focus();
// Set focus on the first input field of the visible details/tab pane.
$('.horizontal-tabs-pane :input:visible:enabled:first').trigger('focus');
}
});
// Only bind update summary on forms.
if (this.details.drupalGetSummary) {
this.details
.on('summaryUpdated', function () {
self.updateSummary();
})
.trigger('summaryUpdated');
}
};
Drupal.horizontalTab.prototype = {
/**
* Displays the tab's content pane.
*/
focus: function () {
this.details
.removeClass('horizontal-tab-hidden')
.siblings('.horizontal-tabs-pane')
.each(function () {
var tab = $(this).data('horizontalTab');
tab.details.addClass('horizontal-tab-hidden');
tab.item.removeClass('selected');
})
.end()
.siblings(':hidden.horizontal-tabs-active-tab')
.val(this.details.attr('id'));
this.item.addClass('selected');
// Mark the active tab for screen readers.
$('#active-horizontal-tab').remove();
this.link.append('<span id="active-horizontal-tab" class="visually-hidden">' + Drupal.t('(active tab)') + '</span>');
},
/**
* Updates the tab's summary.
*/
updateSummary: function () {
this.summary.html(this.details.drupalGetSummary());
},
/**
* Shows a horizontal tab pane.
*
* @return {Drupal.horizontalTab} The current horizontal tab.
*/
tabShow: function () {
// Display the tab.
this.item.removeClass('horizontal-tab-hidden');
// Update .first marker for items. We need recurse from parent to retain the
// actual DOM element order as jQuery implements sortOrder, but not as public
// method.
this.item.parent().children('.horizontal-tab-button').removeClass('first')
.filter(':visible:first').addClass('first');
// Display the details element.
this.details.removeClass('horizontal-tab-hidden');
// Focus this tab.
this.focus();
return this;
},
/**
* Hides a horizontal tab pane.
*
* @return {Drupal.horizontalTab} The current horizontal tab.
*/
tabHide: function () {
// Hide this tab.
this.item.addClass('horizontal-tab-hidden');
// Update .first marker for items. We need recurse from parent to retain the
// actual DOM element order as jQuery implements sortOrder, but not as public
// method.
this.item.parent().children('.horizontal-tab-button').removeClass('first')
.filter(':visible:first').addClass('first');
// Hide the details element.
this.details.addClass('horizontal-tab-hidden');
// Focus the first visible tab (if there is one).
var $firstTab = this.details.siblings('.horizontal-tabs-pane:not(.horizontal-tab-hidden):first');
if ($firstTab.length) {
$firstTab.data('horizontalTab').focus();
}
else {
// Hide the vertical tabs (if no tabs remain).
this.item.closest('.form-type-horizontal-tabs').hide();
}
return this;
}
};
/**
* Theme function for a horizontal tab.
*
* @param {object} settings
* An object with the following keys:
* - title: The name of the tab.
* @return {object}
* This function has to return an object with at least these keys:
* - item: The root tab jQuery element
* - link: The anchor tag that acts as the clickable area of the tab
* (jQuery version)
* - summary: The jQuery element that contains the tab summary
*/
Drupal.theme.horizontalTab = function (settings) {
var tab = {};
var idAttr = settings.details.attr('id');
tab.item = $('<li class="horizontal-tab-button" tabindex="-1"></li>')
.append(tab.link = $('<a href="#' + idAttr + '"></a>')
.append(tab.title = $('<strong></strong>').text(settings.title))
);
// No need to add summary on frontend.
if (settings.details.drupalGetSummary) {
tab.link.append(tab.summary = $('<span class="summary"></span>'));
}
return tab;
};
})(jQuery, Modernizr);
@@ -0,0 +1,39 @@
(function ($) {
'use strict';
Drupal.FieldGroup = Drupal.FieldGroup || {};
Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
/**
* Implements Drupal.FieldGroup.processHook().
*/
Drupal.FieldGroup.Effects.processTabs = {
execute: function (context, settings, group_info) {
if (group_info.context === 'form') {
// Add required fields mark to any element containing required fields
var direction = group_info.settings.direction;
$(context).find('[data-' + direction + '-tabs-panes] details').once('fieldgroup-effects').each(function () {
var $this = $(this);
if (typeof $(this).data(direction + 'Tab') !== 'undefined') {
if ($this.is('.required-fields') && ($this.find('[required]').length > 0 || $this.find('.form-required').length > 0)) {
$this.data(direction + 'Tab').link.find('strong:first').addClass('form-required');
}
if ($('.error', $this).length) {
$this.data(direction + 'Tab').link.parent().addClass('error');
Drupal.FieldGroup.setGroupWithfocus($this);
$this.data(direction + 'Tab').focus();
}
}
});
}
}
};
})(jQuery, Modernizr);