I realize we're waay past the date for feature requests, but this (IMO) is a very simple feature that helps out in UX. This patch adds the capability to add regions clickable regions in the inline preview area, so that a user can directly click on regions to select the palette element to edit.
This is done by adding classes to elements in the preview.html which get scanned by color.js. Patch includes changes to the core preview.html.
Classnames are called hotspot-palette-XXX where XXX is the name of the palette element. You can add the classes to div, p, a or other elements. Event propagation is stopped so that when regions overlap, the "topmost" region is the "winner" (e.g. an anchor within a paragraph).
To test: apply patch, clear caches if necessary. Then go to the theme settings for Garland at admin/appearance/settings/garland. Click on the text and links in the preview, and the proper element will be selected.
For further testing, I'm also including a preview.html for Bartik. (Rename it to preview.html and place it in the color/ folder inside the bartik folder)
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | make_clicks_on_theme-828578-21-do-not-test.patch | 2.21 KB | sumeet.pareek |
| #20 | make_clicks_on_theme-828578-20.patch | 2.09 KB | zaporylie |
| #18 | 828578-18-hotspots_for_color_module_preview.patch | 2.06 KB | falkendk |
| #18 | interdiff.txt | 636 bytes | falkendk |
| #13 | 828578-13-hotspots_for_color_module_preview.patch | 2.07 KB | brianV |
Comments
Comment #1
janusman commentedBetter title.
Comment #2
janusman commentedComment #4
jensimmons commentedtagging
Comment #5
janusman commentedHmm, bad format in patch, new patch.
Comment #7
janusman commentedMust be brown paper bag day.
Comment #8
mcrittenden commentedGood idea, would make a nice last-minute feature if it's accepted.
Can we get a more understandable comment? I'd have trouble figuring out what this means. Maybe:
"Make clicks on elements in the preview box select the input text field that controls that element." or something? I don't see a need to mention the classname here, but that might just be me.
Comment #9
janusman commentedAgreed. New patch, which also fixes a class in preview.html from the previous patch.
Comment #10
tim.plunkettI don't think this is backportable, unfortunately. Moving to 8.x.
Comment #11
janusman commentedMy gut reaction was "maybe color.module won't even be in D8" =)
Comment #12
tim.plunkettNot if I have anything to do with it!
Comment #13
brianV commentedRe-rolled against latest HEAD
Comment #14
markhalliwell#13: 828578-13-hotspots_for_color_module_preview.patch queued for re-testing.
Comment #15
markhalliwellI'd rather this be on one line if possible. Also remove the extra space between "( function".
Any reason we can't just "return false;" here?
Also, if we're going to do this. We should probably also get some CSS styling to outline the element when you hover over it and also change the cursor to a pointer to imply that it is clickable. Bumping this to normal since I actually think this would be a nice feature to have.
Comment #16
tim.plunkettIt should be either
or
with the space after function, and if its split, indented 2 spaces.
We never return false; anymore, always explicitly use event.preventDefault(); and event.stopPropagation(); explicitly, because they are not always both needed.
Comment #17
markhalliwellFair enough.
Comment #18
falkendk commentedRerolled with the fix suggested by @tim.plunkett in #16
Comment #19
markhalliwellActually, per jQuery Coding Standards: Event Delegation this should probably be:
Comment #20
zaporylieI attach patch to fix #19
In the same time I think that support for bartik preview.html should be added to this patch.
Comment #21
sumeet.pareek commentedThe patch in #20 worked for me.
I am also attaching a patch that makes the Bartik theme's colored theme preview clickable too. But I would leave it to those more involved in this issue to take a call on if we should include support for Bartik and other theme's preview.html. I think we definitely should. Otherwise this nifty little UX addition would not be of much help.
If this goes in, the documentation for using colors module should also be updated.
Comment #22
sumeet.pareek commentedComment #23
alexpottThis issue introduces a new feature, so per https://www.drupal.org/core/beta-changes, we should postpone it to 8.1.x or later.
Comment #37
quietone commentedColor has been removed from core, #3270899: Remove Color module from core.
Comment #38
avpaderno