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,138 @@
(function ($) {
'use strict';
Drupal.behaviors.fieldUIFieldsOverview = {
attach: function (context, settings) {
$('table#field-overview', context).once('field-field-overview', function () {
Drupal.fieldUIOverview.attach(this, settings.fieldUIRowsData, Drupal.fieldUIFieldOverview);
});
}
};
/**
* Row handlers for the 'Manage fields' screen.
*/
Drupal.fieldUIFieldOverview = Drupal.fieldUIFieldOverview || {};
Drupal.fieldUIFieldOverview.group = function (row, data) {
this.row = row;
this.name = data.name;
this.region = data.region;
this.tableDrag = data.tableDrag;
// Attach change listener to the 'group format' select.
this.$formatSelect = $('select.field-group-type', row);
this.$formatSelect.change(Drupal.fieldUIOverview.onChange);
return this;
};
Drupal.fieldUIFieldOverview.group.prototype = {
getRegion: function () {
return 'main';
},
regionChange: function (region, recurse) {
return {};
},
regionChangeFields: function (region, element, refreshRows) {
// Create a new tabledrag rowObject, that will compute the group's child
// rows for us.
var tableDrag = element.tableDrag;
var rowObject = new tableDrag.row(element.row, 'mouse', true);
// Skip the main row, we handled it above.
rowObject.group.shift();
// Let child rows handlers deal with the region change - without recursing
// on nested group rows, we are handling them all here.
$.each(rowObject.group, function () {
var childRow = this;
var childRowHandler = $(childRow).data('fieldUIRowHandler');
$.extend(refreshRows, childRowHandler.regionChange(region, false));
});
}
};
/**
* Row handlers for the 'Manage display' screen.
*/
Drupal.fieldUIDisplayOverview = Drupal.fieldUIDisplayOverview || {};
Drupal.fieldUIDisplayOverview.group = function (row, data) {
this.row = row;
this.name = data.name;
this.region = data.region;
this.tableDrag = data.tableDrag;
// Attach change listener to the 'group format' select.
this.$formatSelect = $('select.field-group-type', row);
this.$formatSelect.change(Drupal.fieldUIOverview.onChange);
return this;
};
Drupal.fieldUIDisplayOverview.group.prototype = {
getRegion: function () {
return (this.$formatSelect.val() === 'hidden') ? 'hidden' : 'content';
},
regionChange: function (region, recurse) {
// Default recurse to true.
recurse = (typeof recurse === 'undefined') || recurse;
// When triggered by a row drag, the 'format' select needs to be adjusted to
// the new region.
var currentValue = this.$formatSelect.val();
var value;
switch (region) {
case 'visible':
if (currentValue === 'hidden') {
// Restore the group format back to 'fieldset'.
value = 'fieldset';
}
break;
default:
value = 'hidden';
break;
}
if (typeof value !== 'undefined') {
this.$formatSelect.val(value);
}
var refreshRows = {};
refreshRows[this.name] = this.$formatSelect.get(0);
if (recurse) {
this.regionChangeFields(region, this, refreshRows);
}
return refreshRows;
},
regionChangeFields: function (region, element, refreshRows) {
// Create a new tabledrag rowObject, that will compute the group's child
// rows for us.
var tableDrag = element.tableDrag;
var rowObject = new tableDrag.row(element.row, 'mouse', true);
// Skip the main row, we handled it above.
rowObject.group.shift();
// Let child rows handlers deal with the region change - without recursing
// on nested group rows, we are handling them all here.
$.each(rowObject.group, function () {
var childRow = this;
var childRowHandler = $(childRow).data('fieldUIRowHandler');
$.extend(refreshRows, childRowHandler.regionChange(region, false));
});
}
};
})(jQuery);
+58
View File
@@ -0,0 +1,58 @@
(function ($) {
'use strict';
/**
* Drupal FieldGroup object.
*/
Drupal.FieldGroup = Drupal.FieldGroup || {};
Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
Drupal.FieldGroup.groupWithfocus = null;
Drupal.FieldGroup.setGroupWithfocus = function (element) {
element.css({display: 'block'});
Drupal.FieldGroup.groupWithfocus = element;
};
/**
* Behaviors.
*/
Drupal.behaviors.fieldGroup = {
attach: function (context, settings) {
settings.field_group = settings.field_group || drupalSettings.field_group;
if (typeof settings.field_group === 'undefined') {
return;
}
// Execute all of them.
$.each(Drupal.FieldGroup.Effects, function (func) {
// We check for a wrapper function in Drupal.field_group as
// alternative for dynamic string function calls.
var type = func.toLowerCase().replace('process', '');
if (typeof settings.field_group[type] !== 'undefined' && $.isFunction(this.execute)) {
this.execute(context, settings, settings.field_group[type]);
}
});
// Add a new ID to each fieldset.
$('.group-wrapper fieldset').each(function () {
// Tats bad, but we have to keep the actual id to prevent layouts to break.
var fieldgroupID = 'field_group-' + $(this).attr('id') + ' ' + $(this).attr('id');
$(this).attr('id', fieldgroupID);
});
// Set the hash in url to remember last userselection.
$('.group-wrapper ul li').each(function () {
var fieldGroupNavigationListIndex = $(this).index();
$(this).children('a').click(function () {
var fieldset = $('.group-wrapper fieldset').get(fieldGroupNavigationListIndex);
// Grab the first id, holding the wanted hashurl.
var hashUrl = $(fieldset).attr('id').replace(/^field_group-/, '').split(' ')[0];
window.location.hash = hashUrl;
});
});
}
};
})(jQuery);