-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Tech] - Fixed save queries, Added share queries in saved/successful … #16
[Tech] - Fixed save queries, Added share queries in saved/successful … #16
Conversation
@@ -9,6 +9,11 @@ | |||
</coral-dialog-content> | |||
<coral-dialog-footer> | |||
<button class="executeQueryButton" type="button" is="coral-button" variant="primary" disabled>Open</button> | |||
<button type="button" autocomplete="off" is="coral-button" icon="share" variant="secondary" trackingfeature="" trackingelement="" tracking="ON" class="shareQueryButton coral3-Button coral3-Button--secondary" size="M" disabled> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us call the classes in the more UI-style manner) See below, in the <coral-icon>
tag, all classes are dash-separated and mostly go with the small letter (except for the "Icon" which has some special meaning).
We can do this in a voice call later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks
return function () { | ||
foundationUi.notify('URL copied to clipboard'); | ||
const urlWithoutParams = window.location.origin + window.location.pathname; | ||
navigator.clipboard.writeText(urlWithoutParams + '?query=' + encodeURIComponent(query)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-query
. The query param doesn't go without a prefix. A number of variants has already changed, though) The latest one is -query
@@ -93,6 +107,7 @@ | |||
function toggleActionButtonsState(value) { | |||
$('.deleteQueryButton').prop('disabled', value); | |||
$('.executeQueryButton').prop('disabled', value); | |||
$('.shareQueryButton').prop('disabled', value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be far better, to create a common class for them all
- Please take a note, that in Granite, there's a particular way to change states of things
$(window).adaptTo("foundation-registry").register("foundation.collection.action.activecondition", {
name: "some.name.of.condition",
handler: function(name, el, config, collection, selections) {
return selections.every(function(item) {
return item.value; // of item['some-attr'], etc.
});
}
});
Then, in the button itself
<button
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/collection/action"
action="some.action"
activeCondition="some.name.of.condition"/>
This is the way it was invented to be. Merely to avoid the event listeners like above. This is an element of reactive programming, like in React/angular etc. But frankly speaking, it was invented for Lists (Tables etc). I have no idea how it would work with a TextArea. But it's worth trying))
$(document).on('click', '.executeQueryButton', function () { | ||
executeAction && executeAction(); | ||
}); | ||
|
||
$(document).on('click', '.deleteQueryButton', function () { | ||
deleteAction && deleteAction(); | ||
}); | ||
|
||
$(document).on('click', '.shareQueryButton', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using registered actions instead of direct event hooks
…queries dialogs