User tests: Successful: Unsuccessful:
Pull Request for Issue #28995
This PR adds a "Copy" button allowing you to copy the API token to your clipboard.
Evergreen browsers get to use the async Clipboard API, however this will only work over a secure connection (https://
), so if you're on a insecure protocol, you will fallback to execCommand(...)
.
NOTE: The button is supposed to appear next to the input, however you'll see it appear below the input. This is due to the way Joomla is styling it's parameters. It's out of scope and I will NOT fix that in this PR, so please do not flag it as an issue.
node build.js --compile-js
from your terminaladministrator/index.php?option=com_users
and click on a userJoomla API Token
tabCopy
buttonThe token will be copied to your clipboard
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings JavaScript Repository NPM Change Front End Plugins |
Labels |
Added:
?
NPM Resource Changed
?
|
@Quy will cappitalise the m
in message
once I figure out how to.
Joomla.renderMessages({ error: [Joomla.Text._('JGLOBAL_WARNCOOKIES')] }, undefined, false, 6000);
Joomla.renderMessages({ danger: [Joomla.Text._('JGLOBAL_WARNCOOKIES')] }, undefined, false, 6000);
Joomla.renderMessages({ message: [Joomla.Text._('JGLOBAL_WARNCOOKIES')] }, undefined, false, 6000);
Joomla.renderMessages({ success: [Joomla.Text._('JGLOBAL_WARNCOOKIES')] }, undefined, false, 6000);
Joomla.renderMessages({ warning: [Joomla.Text._('JGLOBAL_WARNCOOKIES')] }, undefined, false, 6000);
Joomla.renderMessages({ notice: [Joomla.Text._('JGLOBAL_WARNCOOKIES')] }, undefined, false, 6000);
From the above, the only one that has a capitalised title is the error
, so how sure how this works
@wilsonge @SharkyKZ perhaps one of you may know more about this.
The only alerts where the title's first letter is capitalised is an error
. The language strings are defined here: https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/language/en-GB/joomla.ini#L42-L46
It means the JS string is missing. Add it using Text::script('MESSAGE');
.
Please move plugins/user/token/src/Field/layouts/token.php
outside of src
directory.
Do we have other situations where a copy button would be useful for an input field? The base of the question is wouldn't it make more sense to have this as a parameter to our normal input field or use a more generic name instead of "token"?
I have tested this item
Works as described.
If merged then the styling issue will need to be resolved - its a quick fix
As for using this functionality elsewhere - I am not aware of anywhere else that this would currently be useful.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Pending |
Setting back to Pending. @Fedik's comment needs to be addressed.
I've added return parent::getInput();
If I use return $this->getRenderer('token')->render($this->getLayoutData());
in the getInput()
method, the field doesn't get displayed.
This is done in other plugins too:
https://github.com/joomla/joomla-cms/blob/4.0-dev/plugins/user/terms/src/Field/TermsField.php#L46
If I use return $this->getRenderer('token')->render($this->getLayoutData()); in the getInput() method, the field doesn't get displayed.
I suspect something mixed up with layout name and layout path, the rendered cannot find the layout, and so renders nothing.
This is done in other plugins too
That crazy, there also wrong
That need to fix someday by someone
All that need for render a custom layout is a property with layout name, no need override getInput().
so just
/**
* Layout to render the form field
*
* @var string
*/
protected $renderLayout = 'plugins.token.token';
Btw, the layout name for the token field will be plugins.token.token
(not token
)
and because of this, the method getLayoutPaths
in this pull also incorrect, because it search for <base/template>layouts/token.php
but should search for <base/template>layouts/plugins/token/token.php
And a default layout file itself need to be under layouts/plugins/token/token.php
, not in plugins/user/token/layouts/token.php
.
If it work as it is, it is good, but better if we make it correct, because other people will copy this for sure, and then show as "good example"
A bit later, I try to look in detail, and try to help.
Thanks Fedik, I'll look into it again today or tomorrow
Layouts can be in the plugin directory, as long as those paths are included. Either way works.
That is true. However I have seen that other core plugins use root /layouts/plugins/blabla,
I prefer to keep it consistent
Category | Administration Language & Strings JavaScript Repository NPM Change Front End Plugins | ⇒ | Administration Language & Strings JavaScript Repository NPM Change Layout Front End Plugins |
Label is missing, layout is still broken and overrides don't work.
@C-Lodder see C-Lodder#14 for fixing label issues.
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-30 12:07:57 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
M in
message
should be capitalized.