Skip to content
This repository was archived by the owner on Aug 24, 2018. It is now read-only.

Update the gallery widget preview design.#188

Merged
westonruter merged 4 commits into
add/gallery-widgetfrom
update/gallery-widget-preview-design
Sep 11, 2017
Merged

Update the gallery widget preview design.#188
westonruter merged 4 commits into
add/gallery-widgetfrom
update/gallery-widget-preview-design

Conversation

@joemcgill

Copy link
Copy Markdown
Contributor

This is an initial implementation of the enhanced widget preview
design proposed in #62.

See: https://cloud.githubusercontent.com/assets/2846578/25029086/e8b7efa2-2087-11e7-8ea6-43679a3a2fb8.png

This is an initial implementation of the enhanced widget preview
design proposed in #62.

See: https://cloud.githubusercontent.com/assets/2846578/25029086/e8b7efa2-2087-11e7-8ea6-43679a3a2fb8.png
@joemcgill joemcgill mentioned this pull request Sep 8, 2017
@joemcgill

Copy link
Copy Markdown
Contributor Author

A couple of questions about this current implementation:

In the designs, @melchoyce specified showing the number of additional images with placeholder text reading "+ %d more", but that number is only available inside the template. I'm not exactly sure the best way to combine that data with a translatable string, so suggestions welcome.

There's probably a better way to enqueue the CSS here, but I couldn't get a callback on wp_default_styles to work.

@westonruter

Copy link
Copy Markdown
Contributor

showing the number of additional images with placeholder text reading "+ %d more", but that number is only available inside the template. I'm not exactly sure the best way to combine that data with a translatable string, so suggestions welcome.

That is currently a challenge in JS, since there isn't yet i18n in core (#20491). There was a workaround we did in #39087, but it wasn't pretty as we basically had to iterate over all possible numbers on the server and then export them to JS:

https://github.com/WordPress/wordpress-develop/blob/f5c342ce7671731dc24bc2e228640bdae767e87b/src/wp-includes/class-wp-customize-widgets.php#L707-L746

So that is one option. Maybe strings for numbers 1 to 25 could be generated. Or maybe the string could avoid needing to be translated by just omitting “more”? Or rather, the translated string could be just __( '+%d' ) and then it would be up to translators to modify this string to an appropriate math-like expression in the target language, but being math hopefully it wouldn't even need to be translated in the first place.

@westonruter westonruter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only other things I suggest would be to let the label be “+X” instead of “+More”. Also, clicking on the gallery preview I think should be a shortcut for “Edit Gallery”.

@joemcgill joemcgill left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear I tried this and couldn't get it to work, but 🤷‍♂️. Seems good now.

This drops the "more" text from the design until we have a better way
to handle i18n strings in JS.
@westonruter

Copy link
Copy Markdown
Contributor

@joemcgill haha! Behold what I just noticed when creating a Facebook post: +4

image

@joemcgill

Copy link
Copy Markdown
Contributor Author

@westonruter I updated the template to show the number instead of "More" until we have a better way of handling i18n in JS.

Preview gallery image

However, I do like the idea of putting that over an actual image instead of a grey box.

@melchoyce

Copy link
Copy Markdown
Contributor

Let's try the +# over an image with a 75% black overlay (or 75% opacity over a black bg, whichever) with white text, and bump up the font size a little.

This uses the sixth image in a gallery as the placeholder whenever there
are more than six images.
@joemcgill

Copy link
Copy Markdown
Contributor Author

How do you like this?

text over image

@westonruter

Copy link
Copy Markdown
Contributor

Looks amazing! (Ignore that Travis build error. It's a failure not an error on your part.)

@melchoyce

Copy link
Copy Markdown
Contributor

I think we can actually go lighter on the opacity, but let's merge and then fiddle later.

@westonruter westonruter merged commit ff52e6c into add/gallery-widget Sep 11, 2017
@westonruter westonruter deleted the update/gallery-widget-preview-design branch September 11, 2017 20:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants