Skip to content

Commit

Permalink
Merge branch 'main' into issue/org.json-update
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbailescu authored Dec 14, 2023
2 parents 53be6ce + 35679bc commit bd56d90
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static String getBlueprintPath(@NotNull Resource resource, @NotNull LiveR
if (relationshipManager.isSource(resource)) {
// the resource is a blueprint
RangeIterator liveCopiesIterator = relationshipManager.getLiveRelationships(resource, null, null);
if (liveCopiesIterator != null) {
if (liveCopiesIterator != null && liveCopiesIterator.hasNext()) {
LiveRelationship relationship = (LiveRelationship) liveCopiesIterator.next();
LiveCopy liveCopy = relationship.getLiveCopy();
if (liveCopy != null) {
Expand Down
128 changes: 96 additions & 32 deletions content/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* which allows selection of panel container items for editing, as well as other operations such as reordering of panels.
* @param {PanelSelectorConfig} config The Panel Selector configuration object
*/
var PanelSelector = ns.util.createClass({
window.CQ.CoreComponents.PanelSelector = ns.util.createClass({

/**
* The Panel Selector configuration Object
Expand Down Expand Up @@ -178,7 +178,7 @@
items.push({
id: child.path,
name: child.name,
title: getTitle(child, panelContainerItems[child.name], index + 1)
title: that.getTitle(child, panelContainerItems[child.name], index + 1)
});
});

Expand Down Expand Up @@ -379,6 +379,37 @@
that._unbindEvents();
that._elements.popover.parentNode.removeChild(that._elements.popover);
}
},

/**
* Retrieves a title from item data. If no item data exists, or it doesn't have a title
* instead lookup the editable display name of the corresponding [Editable]{@link Granite.author.Editable}.
* Prefixes each title with an index.
*
* @param {Granite.author.Editable} editable The [Editable]{@link Granite.author.Editable} representing the item
* @param {Object} item The item data
* @param {Number} index Index of the item
* @returns {String} The title
*/
getTitle: function(editable, item, index) {
var title = "<span class='foundation-layout-util-subtletext cmp-panelselector__indexMarker'>" + index + "</span>&nbsp;&nbsp;";
var subTitle = "";

title = title + " " + Granite.I18n.getVar(ns.editableHelper.getEditableDisplayableName(editable));

if (item) {
if (item[PN_PANEL_TITLE]) {
subTitle = item[PN_PANEL_TITLE];
} else if (item.title) {
subTitle = item.title;
}
}

if (subTitle) {
title = title + ": <span class='foundation-layout-util-subtletext'>" + subTitle + "</span>";
}

return title;
}
});

Expand All @@ -393,7 +424,7 @@
order: "before COPY",
execute: function(editable, param, target) {
if (!panelSelector || !panelSelector.isOpen()) {
panelSelector = new PanelSelector({
panelSelector = new window.CQ.CoreComponents.PanelSelector({
"editable": editable,
"target": target[0]
});
Expand Down Expand Up @@ -423,35 +454,4 @@
}
});

/**
* Retrieves a title from item data. If no item data exists, or it doesn't have a title
* instead lookup the editable display name of the corresponding [Editable]{@link Granite.author.Editable}.
* Prefixes each title with an index.
*
* @param {Granite.author.Editable} editable The [Editable]{@link Granite.author.Editable} representing the item
* @param {Object} item The item data
* @param {Number} index Index of the item
* @returns {String} The title
*/
function getTitle(editable, item, index) {
var title = "<span class='foundation-layout-util-subtletext cmp-panelselector__indexMarker'>" + index + "</span>&nbsp;&nbsp;";
var subTitle = "";

title = title + " " + Granite.I18n.getVar(ns.editableHelper.getEditableDisplayableName(editable));

if (item) {
if (item[PN_PANEL_TITLE]) {
subTitle = item[PN_PANEL_TITLE];
} else if (item.title) {
subTitle = item.title;
}
}

if (subTitle) {
title = title + ": <span class='foundation-layout-util-subtletext'>" + subTitle + "</span>";
}

return title;
}

}(jQuery, Granite.author, jQuery(document), this));
Loading

0 comments on commit bd56d90

Please sign in to comment.