Hi,
I am trying to add preview for DAM assets in "path browser" component.
Unfortunately these events not triggered on first load of dialog. if I click path browser button second time the alert("path browser button clicked"); is displayed.
AEM 6.3 is the environment.
(function (document, $) {
var rel_preview_enabled_path_browser = "[data-enable-path-browser-preview='true'] .js-coral-pathbrowser-button";
var rel_path_browser_item = ".coral-Pathbrowser-picker[data-enable-path-browser-preview=\"true\"] .coral-ColumnView-item";
var rel_path_browser_preview = ".path-browser-preview";
var rel_path_browser_preview_image = rel_path_browser_preview + " .path-browser-preview-image";
var rel_active_item = ".coral-ColumnView-column.is-active .coral-ColumnView-item.is-active";
var previewUrl;
$(document).on("click", rel_preview_enabled_path_browser, function (e) {
alert("path browser button clicked");
});
$(document).on("click", rel_path_browser_item, function (e) {
alert("path browser item selected");
});
})(document, Granite.$);
Thanks,
Sri
Views
Replies
Total Likes
Did you look through the Coral API reference docs? Reference Materials
Views
Replies
Total Likes
@smacdonald2008 thanks for reply. I did read the coral ui documentation. I could not find events for coral icon -filesearch. I knew there were events like coral-overlay:open for dialogs.
Not really sure, how to bind/listen to coral path browser icon click events. I tried to bind/listen to coral-columnview-item click events, it didn't work either. I had this js as part of clientlib and categories value as 'cq.authoring.dialog'. Please let me know, if above closure does not work, i will wrap the bind events in document.ready and give it a try.
Thanks.
Views
Replies
Total Likes
You can try:- AEM Touch UI Custom Validation - Adobe Experience Manager | AEM/CQ | Apache Sling
// Registering custom validators is done by calling the jQuery based $.validator.register method. The register method takes a single JavaScript object literal argument. The parameter looks for four properties: selector, validate, show and clear, of which the only selector is required.
The selector property ties the validator to the form elements on the page. The property accepts any jQuery selector such as a class ( .my-class-name), type ( INPUT) or attribute ( INPUT[type="text"]) selectors.
The validate property is the function that validates the form element's input. The function provides the form element as a jQuery object as the single available parameter. The field is treated as invalid if this function returns a string literal as the validation error message.
I hope this would help you.
Views
Replies
Total Likes
Hi,
Did you get any solution for this?
Regards,
Manish
Views
Replies
Total Likes
Yes. Following worked for me . AEM 6.3 is the environment.
;(function (channel, $) {
'use strict';
var previewUrl;
var rel_path_browser_preview = ".path-browser-preview";
var rel_path_browser_preview_image = rel_path_browser_preview + " .path-browser-preview-image";
channel.on('click', '.coral-PathBrowser[data-enable-path-browser-preview=\"true\"] .coral-InputGroup .coral-InputGroup-button', function(event) {
var target = $(event.target);
var pathBrowser = target.closest("[data-enable-path-browser-preview='true']");
previewUrl = pathBrowser.data("previewUrl") || "$path.thumb.319.319.png";
if (pathBrowser.length) {
var $pathBrowser = pathBrowser.data("pathBrowser");
var $pathBrowserPicker = $pathBrowser.$picker;
var $pickerPanel = $pathBrowserPicker.find(".coral-Pathbrowser-pickerPanel");
var $pickerColumnView = $pickerPanel.find(".coral-ColumnView");
var newPreview = $pickerPanel.find('.path-browser-preview');
if(!newPreview.length) {
$pickerColumnView.css({
width: "75%"
});
var $preview = $("<div class='" + rel_path_browser_preview.substr(1) + "'><div class='path-browser-preview-text'>Preview</div><div class='path-browser-preview-image'></div></div>");
$preview.css({
width: "25%",
height: "100%",
"border-left": "1px solid black",
float: "right"
});
$pickerPanel.append($preview);
};
}
});
channel.on('coral-columnview-item-select', function(event) {
var activeItem = $('.coral-ColumnView-column.is-active .coral-ColumnView-item.is-active');
var path = activeItem.data('value');
var previewImage = $(rel_path_browser_preview_image);
previewImage.find("img").remove();
if (path) {
var previewThumbnail = previewUrl.replace("$path", path);
previewImage.append("<img src='" + previewThumbnail + "'>");
}
});
})(jQuery(document), Granite.$);
I want my dam assets icons to be displayed along side there names in path browser.
did you achieve that too?
any idea?
Views
Replies
Total Likes
I didn't have that requirement as OOTB component provides name of dam asset and I needed only preview of dam asset when name is clicked.
Views
Replies
Total Likes
Use pathfield as resourcetype
Views
Replies
Total Likes
With pathfield i was getting below error.
Do i specifically need to change this clientlib.
Views
Replies
Total Likes
I mean if you use pathfield, you should be seeing thumbnail without writing any custom code
Views
Replies
Total Likes
what is the resourcetype for pathfield (path)
Views
Replies
Total Likes
granite/ui/components/coral/foundation/form/pathfield
Views
Replies
Total Likes
Can you share
1. dialog screen shot
2. all properties of field in which you are adding this.
Views
Replies
Total Likes
Did you also implement a way to load the preview as soon as the path browser is opened?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies