Skip to content

Fix form-horizontal for non-latin or long language strings#15689

Merged
rdeutz merged 8 commits into
joomla:stagingfrom
denysdesign:patch-5
May 22, 2017
Merged

Fix form-horizontal for non-latin or long language strings#15689
rdeutz merged 8 commits into
joomla:stagingfrom
denysdesign:patch-5

Conversation

@denysdesign

@denysdesign denysdesign commented Apr 30, 2017

Copy link
Copy Markdown
Contributor

Pull Request for Issue # .

Summary of Changes

Fix form-horizontal for non-latin or long language strings.

Please look for this languages specifies fix: @infograf768

Before fix:
before

After fix:
screenshot-lang j-2017-04-30-04-20-12

Optional width 200px:

max-width: 200px;
min-width: 200px;
width: 200px;

Testing latest version Firefox, Chrome and etc Chromius based brawsers.

@CB9TOIIIA

Copy link
Copy Markdown

Joomla pain :)

@b2z

b2z commented Apr 30, 2017

Copy link
Copy Markdown
Member

As a Russian language user I am definitely for it. Looking much better now.

@Arkadiy-Sedelnikov

Copy link
Copy Markdown
Contributor

Agree

@ghost

ghost commented Apr 30, 2017

Copy link
Copy Markdown

if 2 People test this PR successfully it could go in staging if Maintainers agree.

@ot2sen

ot2sen commented Apr 30, 2017

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on cc318d8

Tested with multiple languages and Russian in particular which had this issue.
Logic improvement on i18n to ensure any language looks good/correct in the interface for admin forms.


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

@brianteeman

Copy link
Copy Markdown
Contributor

Please do not edit the css file directly. That is not correct.

The correct way is to make the changes in the less file and then run generatecss.php from the build directory to create the css

@infograf768

infograf768 commented May 1, 2017

Copy link
Copy Markdown
Member

Unhappily, we have multiple .form-horizontal .control-label in the less => css files.
Some have width: auto; depending on the screen width.

Therefore the less files to modify has to be chosen carefully
Also nothing is changed for rtl here.

@infograf768

Copy link
Copy Markdown
Member

@ciar4n
Can you have a look?

@ciar4n

ciar4n commented May 1, 2017

Copy link
Copy Markdown
Contributor

The Bootstrap default is for the control-label to wrap at 160px so if the intent is to allow the label to wrap then simply removing https://github.com/joomla/joomla-cms/blob/staging/administrator/templates/isis/less/blocks/_forms.less#L10 should give the same result. If you wish to increase the label width you will also need to increase the left margin on .form-horizontal .controls by the same amount. Not sure if there is a need for setting the min and max width.. maybe you have your reasons?

Test RTL however it should be ok. Media queries should also be fine as is.. smaller screen sizes have the label and control in columns.

As mentioned by @brianteeman you will need to edit the LESS files and then compile rather than editing the CSS directly (https://docs.joomla.org/Joomla_LESS).

Fedik and others added 2 commits May 3, 2017 11:36
Limit a control-label width in form-horizontal
@Fedik

Fedik commented May 3, 2017

Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 6250e2f


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

@Quy

Quy commented May 3, 2017

Copy link
Copy Markdown
Contributor

It looks good. The only 1 display issue is under System > Global Configuration > Media that just needs markup change.

Before:
media-before

After:
media-after

@brianteeman

Copy link
Copy Markdown
Contributor

@Quy that might happen in other places too especially with extensions

@Fedik

Fedik commented May 3, 2017

Copy link
Copy Markdown
Member

it because a Spacer field displaying the text as a label, this is some very old legacy.
But even with this, it is looks better than on the screenshot from the pull description

@Fedik

Fedik commented May 3, 2017

Copy link
Copy Markdown
Member

upd: In theory, for a Spacer field we can force class in "JFormFieldSpacer::renderField", something like field-spacer and then in css use .field-spacer>.control-label{width:auto;}
@Quy what do you think?

@Quy

Quy commented May 3, 2017

Copy link
Copy Markdown
Contributor

Sounds good to me in theory. but I am no css guru. :)

@denysdesign

Copy link
Copy Markdown
Contributor Author

@Fedik it's nice idea!

@Fedik

Fedik commented May 4, 2017

Copy link
Copy Markdown
Member

@joomla-ua you will update the PR?

@infograf768

Copy link
Copy Markdown
Member

@Fedik
Not sure where to add the class in the library.

@Fedik

Fedik commented May 5, 2017

Copy link
Copy Markdown
Member

@infograf768
in JFormFieldSpacer field class, add method

public function renderField($options = array())
{
   $options['class'] = empty($options['class']) ? 'field-spacer' : $options['class'] .  ' field-spacer';
   
   return parent::renderField($options);
}

other solution can be, to add a layout (renderLayout) specially for a Spacer field instead of default joomla.form.renderfield

@dgrammatiko

Copy link
Copy Markdown
Contributor

I like the layout approach more

@Fedik

Fedik commented May 5, 2017

Copy link
Copy Markdown
Member

@DGT41 yeah, but how it should looks like? for not break current markup of the forms 😉

@infograf768

Copy link
Copy Markdown
Member

I can't get it to work here
we have to overwrite width: 160px; in

.form-horizontal .control-label {
    float: left;
    padding-top: 5px;
    width: 160px; 
}

and the code above does not.

@Fedik

Fedik commented May 6, 2017

Copy link
Copy Markdown
Member

@infograf768 I have sent pull with updates to @joomla-ua
the configuration page render the fields without use of renderField, that why the code from my previous comment not worked 😉

@DGT41 I think here we can use the class, because the layout it is a "new feature" and cannot be accepted until j3.8, I guess. And people will have ugly backend another half of year 😉
We can do the layout for Spacer field anytime later.

@infograf768

infograf768 commented May 6, 2017

Copy link
Copy Markdown
Member

Eager to test. We have multiple types of spacers and this should take into account all of them.
I would not consider this such a new feature that it could not go into a 3.7.2 (if no B/C impact on frontend).

Correction: just understood you meant the layout would be a new feature.

Fix control-label width for a spacer field
@Quy

Quy commented May 6, 2017

Copy link
Copy Markdown
Contributor

It works. I just noticed under System > Global Configuration > Templates, the following does not require the spacer pr because it is coded differently. Should System > Global Configuration > Media be changed to match?

Supported File Formats
Be careful before changing the file types. Read the tool tips before editing. 

@Fedik

Fedik commented May 6, 2017

Copy link
Copy Markdown
Member

@Quy that another field type note, that actually use a hack to be out of the ".control-label" 😄
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/fields/note.php#L60

@infograf768

Copy link
Copy Markdown
Member

Will test tomorrow. 😺

<?php $dataShowOn = ''; ?>
<?php
$dataShowOn = '';
$groupClass = $field->type === 'Spacer' ? ' field-spacer' : '';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure we need an uppercase for 'Spacer' ? We do not in the xmls.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@infograf768

Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 21929d6

Thanks. Works great.


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

@infograf768

Copy link
Copy Markdown
Member

@Fedik
We forgot something.
you should do the same for /layouts/joomla/content/options_default.php to cope with Global Configuration.

For example, I have added in /administrator/components/com_config/model/form/application.xml a new spacer field.

                <field name="spacer1"
			type="spacer"
			class="text"
			label="COM_CONFIG_FIELD_DEFAULT_CAPTCHA_DESC"
		/>

(I used an existing lang string).
And I get this
screen shot 2017-05-07 at 08 48 57

Should be easy

@infograf768

Copy link
Copy Markdown
Member

diff would be:

diff --git a/layouts/joomla/content/options_default.php b/layouts/joomla/content/options_default.php
index 9b42831..e36532c 100644
--- a/layouts/joomla/content/options_default.php
+++ b/layouts/joomla/content/options_default.php
@@ -26,4 +26,5 @@
 		{
 			$datashowon = '';
+			$groupClass = $field->type === 'Spacer' ? ' field-spacer' : '';
 
 			if ($field->showon)
@@ -34,5 +35,5 @@
 			}
 			?>
-			<div class="control-group"<?php echo $datashowon; ?>>
+			<div class="control-group<?php echo $groupClass; ?>"<?php echo $datashowon; ?>>
 				<?php if (!isset($displayData->showlabel) || $displayData->showlabel) : ?>
 					<div class="control-label"><?php echo $field->label; ?></div>

Fedik and others added 2 commits May 7, 2017 11:11
@infograf768

Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on d0e5e57


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

@infograf768

infograf768 commented May 7, 2017

Copy link
Copy Markdown
Member

@ot2sen
Please test again to get this one in.

@AlexRed

AlexRed commented May 7, 2017

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on d0e5e57

Patch ok for me


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

@ot2sen

ot2sen commented May 7, 2017

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on d0e5e57


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

@ghost

ghost commented May 7, 2017

Copy link
Copy Markdown

RTC after two successful tests.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label May 7, 2017
@infograf768 infograf768 added this to the Joomla 3.7.1 milestone May 7, 2017
@infograf768

Copy link
Copy Markdown
Member

@rdeutz
No need to wait 3.7.2 for that one. Can be merged imho for 3.7.1

@rdeutz

rdeutz commented May 7, 2017

Copy link
Copy Markdown
Contributor

I will keep 3.7.1 as light as possible, so if it is not without any doubt a bugfix it has to wait for 3.7.2

@infograf768

Copy link
Copy Markdown
Member

OK, no p

@rdeutz rdeutz modified the milestones: Joomla 3.7.2, Joomla 3.7.1 May 9, 2017
@rdeutz rdeutz modified the milestones: Joomla 3.7.2, Joomla 3.7.3 May 18, 2017
@rdeutz rdeutz removed their assignment May 22, 2017
@rdeutz rdeutz merged commit 89230ad into joomla:staging May 22, 2017
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 22, 2017
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.