Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logic for resizing below 1024px where issue starts #55

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@

// is needed for IE9 compatibility
var opt = this.$element.get()[0];

if (!opt) {
throw new Error('Controlled error thrown on purpose!');
}

// get config properties
this.itemDialog = (options.mergeroot || opt.getAttribute('data-mergeroot') || '/mnt/override') + (options.itemdialog || opt.getAttribute('data-itemdialog'));
this.itemStorageNode = options.itemstoragenode || opt.getAttribute('data-itemstoragenode') || "items";
Expand All @@ -40,6 +45,7 @@
this.minElements = options.minelements || opt.getAttribute('data-minelements');
this.maxElements = options.maxelements || opt.getAttribute('data-maxelements');
this.readOnly = options.renderreadonly || opt.getAttribute('data-renderreadonly');
this.smallScreen = options.smallScreen || false;

// get the crx path of the current component from action attribute of the current form.
this.crxPath = this.$element.parents("form").attr("action");
Expand All @@ -49,13 +55,27 @@
// add the "+" button for adding new items
$(".coral-SpectrumMultiField-add", this.$element).attr("disabled", "disabled");
} else {
this._checkAndReinitializeForSmallerScreens();
// add button listeners
this._addListeners();
}
// get list elements
this._updateList(false);
},

/**
* Special handling for tablet and smaller viewports
*
* @private
*/
_checkAndReinitializeForSmallerScreens: function () {
if (window.innerWidth < 1024) {
$(document).one('foundation-contentloaded', function (e) {
$(e.target).find('.coral-Form-field.coral-GenericMultiField').each(function () {
new Merkle.GenericMultiField();
});
});
}
},
/**
* Performs an ajax call to the storage node and updates the list entries.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@
* @private
*/
function _getDomElementForDialog(dialog) {

var cqDialogForm;
if (dialog.getConfig().itemPath) {
cqDialogForm = ns.Helper.findDialog(dialog.getConfig().itemPath);
Expand Down