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

Update jquery.minicolors.js (color picker) + add rgb(a) & CSS-wide keywords support + fix RTL #10129

Merged
merged 5 commits into from May 2, 2016

Conversation

cyrezdev
Copy link
Contributor

@cyrezdev cyrezdev commented Apr 29, 2016

New Pull Request for #7602 and Issue #7401 .

As requested by @wilsonge to contribute these changes back to the library (https://github.com/claviska/jquery-minicolors/), i did it 😄 . The updated library includes other fixes.
A special thanks to @claviska for his suggestions, help and the time he took in make it happen! 👍
All documentation on this color picker library available here: http://labs.abeautifulsite.net/jquery-minicolors/

Summary of Changes

  • Update library jquery.minicolors.js to latest version 2.2.4 released on 18 March 2016
  • Full B/C (keep previous behavior as default, both in library itself, and in Joomla)
  • Add 2 form xml attributes: format and keywords
  • Allow to set the format to hex (current format), rgb and rgba
  • Allow usage of CSS-wide keywords transparent, initial, inherit
  • Fix RTL issue with color input value (color hex and rgb(a) values should be LTR) and fix position of the picker on RTL, when using default position.

Documentation

New XML attributes

keywords (optional)

CSS-wide keywords can be assigned by setting the keywords attribute to a comma-separated list of valid keywords: transparent,inherit,initial

XML: keywords="transparent,inherit,initial"
Usage: enter the keyword in the field input (script will allow only a keyword listed in the xml attribute)
See screen shot for testing.

format (optional)

For Joomla, i've integrate the rgb(a) format option as a one xml attribute. (no need to set a data-opacity attribute).
Format could be: hex (default), rgb or rgba (with opacity slider)

XML: format="rgba"
Usage: Will return a validated color hex or rgb(a)
See screen shot for testing.

RTL support

Add RTL support. If position is default, the picker will be on the left if RTL language (currently it's right on LTR).
The input value was converted to RTL before, but with issue in some cases. To prevent this, the input value will always be LTR as it is not to be translated or converted as a CSS code value.
joomla_color_picker_rtl

NOTE: When this PR will be merged, i will update JDocs accordingly ;-)

Testing Instructions

Add these fields to the settings part of an xml file of one extension (eg. template Isis). Then go to that extension settings in the admin and test the different color fields.

<field name="color1" type="color" label="Color field default (HEX)" />
<field name="color2" type="color" label="HEX + keywords" keywords="transparent,initial,inherit" />
<field name="color3" type="color" label="RGB" format="rgb" />
<field name="color4" type="color" label="RGB + keywords" format="rgb" keywords="transparent,initial,inherit" />
<field name="color5" type="color" label="RGB(A)" format="rgba" />
<field name="color6" type="color" label="RGB(A) + keywords" format="rgba" keywords="transparent,initial,inherit" />

capture d ecran 2016-04-29 a 01 42 34

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on 2211e19

worked. had to clena browser cache after apply patch.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10129.

@Twincarb
Copy link
Contributor

Twincarb commented May 1, 2016

library jquery.minicolors.js latest version 2.2.4 released on 18 Mar. Can you clarify which one is in use here.

I have tested with no issues detected and functionality is as described 😄
Will submit a success result once the version is identified.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10129.

@cyrezdev
Copy link
Contributor Author

cyrezdev commented May 1, 2016

library jquery.minicolors.js latest version 2.2.4 released on 18 Mar. Can you clarify which one is in use here.

@Twincarb Yes you're right, i've mentionned 2.2.3, but it's 2.2.4! 👍 (will update description)
I was mistaken by the package.json version which was not updated : https://github.com/claviska/jquery-minicolors/blob/master/package.json#L3 ;-)
So yes, no worry, it is the latest released version in this PR ! ;-)

@Twincarb
Copy link
Contributor

Twincarb commented May 1, 2016

I have tested this item ✅ successfully on 2211e19

Is it worth adding the version number to the .js file? I know the developer hasn't but I guess it's always worth asking him.
Then we have an easy way of comparing the version of the file.
😄


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10129.

@cyrezdev
Copy link
Contributor Author

cyrezdev commented May 1, 2016

@Twincarb Yes, i agree!
@claviska a suggestion here, to add the release version in jquery.minicolors.js and minified files... ;-)

@cyrezdev
Copy link
Contributor Author

cyrezdev commented May 1, 2016

@andrepereiradasilva, @Twincarb Thanks for testing!

@brianteeman
Copy link
Contributor

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10129.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label May 1, 2016
@brianteeman brianteeman added this to the Joomla! 3.6.0 milestone May 1, 2016
@rdeutz rdeutz merged commit 8204775 into joomla:staging May 2, 2016
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 2, 2016
@cyrezdev cyrezdev mentioned this pull request May 2, 2016
@cyrezdev
Copy link
Contributor Author

cyrezdev commented May 2, 2016

Just mentioned here PR #10199 concerning version adjusted to 3.6.0 for new attributes.

Now, will work on the documentation for JDocs ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants