The text to describe the format of your maximum resolution is rather hard to read. Due to tags, this patch removes these tags and turns them into normal text.

Would be even better if we could also change the default value from 0 to 0x0.

Comments

damien tournoud’s picture

Nitpicking really, but why not lowercasing those, while you are at it?

Bojhan’s picture

Industry standard I think, not sure.

dries’s picture

The better solution is probably to use two textfields? Like [ 640 ] x [ 480 ] px or something where [ ] is a textfield?

Bojhan’s picture

Doesn't sound as a bad idea, would probably also open the doors for contrib modules to add Percentage/inches stuff.

stborchert’s picture

StatusFileSize
new5.44 KB
new27.83 KB

Here's a patch with two textfields.

Bojhan’s picture

StatusFileSize
new4.39 KB
new0 bytes

What about this?

Bojhan’s picture

StatusFileSize
new973 bytes

wrong patch

Bojhan’s picture

StatusFileSize
new3.99 KB

try 3

stborchert’s picture

The last one don't include upload.admin.css.

Bojhan’s picture

StatusFileSize
new4.39 KB

including the right picture now as well

Status: Needs review » Needs work

The last submitted patch failed testing.

Bojhan’s picture

StatusFileSize
new3.94 KB

Fixing tests, removing .css

Bojhan’s picture

Status: Needs work » Needs review

marking,

Status: Needs review » Needs work

The last submitted patch failed testing.

seutje’s picture

StatusFileSize
new3.81 KB

when trying to apply the last patch it said like 62 was unknown line type, so I remade the patch and looks like a tab was messing things up, change the tab into spaces and made a new patch, tried to apply it and it works

(I didn't change anything to Bojhan's patch aside from the tab)

NOTE: this solution will cause screen readers not to read anything, as the "Maximum resolution ...." label isn't set as the label for any of the 2 fields, so even though this might be a usability improvement, it certainly isn't an accessibility improvement

seutje’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

Everett Zufelt’s picture

Issue tags: +Accessibility

It will be impossible to label two input fields with one label, as the for attribute of a label accepts only one element ID.

Recommendations:
1. use two labels, one for each input field.

2. If necessary hide one of the labels by using style="height: 0; overflow: hidden;", so that it does not display visually, but is available to screen-reader users. This will mean that there is less of a clickable area for the second input field.

Attempting to define a system class to make content invisible in #473396: Defining System-Wide Approaches to Remove, Make Invisible & Push Content Off-screen with CSS

kika’s picture

Issue tags: +ui-pattern
stborchert’s picture

Status: Needs work » Needs review
StatusFileSize
new19.13 KB
new5.57 KB

Here's another on with floated textfields and a label for each textfield.

seutje’s picture

I like this solution, but I'm wondering a few things:

do we rly need to t() the 'x' and 'px' and are there any reusable classes we can utilize for the floating?

stborchert’s picture

do we rly need to t() the 'x' and 'px'
Hm. Maybe someone like to translate it. Or append "pixels" instead of "px". But it wouldn't bother me if we don't wrap it in t().

are there any reusable classes we can utilize for the floating
I scanned current head for classes that uses float: left; only and found

.progress-disabled {
  float: left; /* LTR */
}
.ahah-progress {
  float: left; /* LTR */
}
.password-strength-title {
  float: left; /* LTR */
}

in system.css. Nothing to re-use in this issue.

eojthebrave’s picture

Status: Needs review » Needs work

I like where this is going. This patch will make the selection of max width/height for images much more intuitive and user friendly.

Couple of simple code styling fixes.

+ margin-left: .4em;

I think this should be 0.4em

+ if (($form_state['values']['upload_max_resolution_x'] != '0')) {

and

+ if (($form_state['values']['upload_max_resolution_y'] != '0')) {

These both have an extra set of parentheses that are not necessary.

Can we change the form_set_error() messages so that they are more specific. Something like, "The maximum allowed image height should be entered as a numeric value. Set to 0 for no restriction.", and the other one to "width".

+ '#field_suffix' => '<kbd>' . t('x') . '</kbd>'

Should have a comma at the end, we always add a trailing comma to large arrays.

stborchert’s picture

Assigned: Bojhan » Unassigned
Status: Needs work » Needs review
StatusFileSize
new5.52 KB

Ok, updated the patch according to eojthebrave's notes and removed the useless check if the value not equals '0' around is_numeric().

Bojhan’s picture

Lose the kdb and then I think this is RTBC

stborchert’s picture

StatusFileSize
new5.46 KB

Removed <kbd>.
Good enough for RTBC? :-)

Bojhan’s picture

Status: Needs review » Reviewed & tested by the community

Yes. RTBC

dries’s picture

The div with upload-max-resolution-y-wrapper seems to be unused? No one declares the class upload-max-resolution-y-wrapper.

damien tournoud’s picture

Also, could we use #attributes to set the needed class, instead of adding yet another wrapper div with #prefix and #suffix? It's better to stay away from those as much as possible.

dries’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Favorite-of-Dries

Looks like it needs one more re-roll. :)

stborchert’s picture

Status: Needs work » Needs review
StatusFileSize
new5.5 KB

@Dries: upload-max-resolution-y-wrapper is generated through forms api and is used in CSS.
In fact the CSS rule didn't had the effect I thought so I modified it a little.

@Damien: '#type' => 'item' did not have a '#attributes' key. Therefore we couldn't add these classes via '#attributes' => array('class' => 'form-item-wrapper form-item-resolution'),. I tried (in fact forms api is doing its magic even if its not documented) but the classes aren't added to the element.

So this has only very minor changes in upload.admin.css.

seutje’s picture

@stBorchert: why not just use 'markup'? because an 'item' with a description just generates an unbound label, and markup allows the use of attributes

$form['settings_general']['upload_max_resolution'] = array(
  '#value' => t('The maximum allowed image size (e.g. 640x480). Set to 0x0 for no restriction. If an <a href="!image-toolkit-link">image toolkit</a> is installed, files exceeding this value will be scaled down to fit.', array('!image-toolkit-link' => url('admin/settings/image-toolkit'))),
  '#attributes' => array('class' => 'form-item-wrapper form-item-resolution')
);

perhaps?

stborchert’s picture

@seutje: 'markup' isn't wrapped into tags so we can't position it and we aren't able to place the fields beneath it.
And (additionally) we wouldn't have a title for this "field group".
Well, the label is unbound but I know no better way to build a structure like the one the last patch is providing.

Bojhan’s picture

Can we have a screenshot?

stborchert’s picture

Layout didn't change since comment #20 --> screenshot

Bojhan’s picture

Oke, to me it still sounds rather RTBC then.

Status: Needs review » Needs work

The last submitted patch failed testing.

stborchert’s picture

Status: Needs work » Needs review
StatusFileSize
new5.41 KB

Ok bot, here's a new one. Especially for you.

dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

xmacinfo’s picture

Status: Fixed » Closed (fixed)
Issue tags: -Favorite-of-Dries, -Usability, -Accessibility, -ui-pattern, -ui-text

Automatically closed -- issue fixed for 2 weeks with no activity.