Skip to content

Commit

Permalink
Fix form-horizontal for non-latin or long language strings (#15689)
Browse files Browse the repository at this point in the history
* Fix form-horizontal for non-latin or long language strings

* Limit a control-label width

* Fix control-label width for a spacer field

* fix the drone tests by removing a space that is to much

* Fix control-label width for a spacer field 2
  • Loading branch information
denysdesign authored and rdeutz committed May 22, 2017
1 parent dd60a72 commit 89230ad
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 17 deletions.
Expand Up @@ -78,7 +78,10 @@
</div>
<?php endif; ?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<?php $dataShowOn = ''; ?>
<?php
$dataShowOn = '';
$groupClass = $field->type === 'Spacer' ? ' field-spacer' : '';
?>
<?php if ($field->showon) : ?>
<?php JHtml::_('jquery.framework'); ?>
<?php JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); ?>
Expand All @@ -87,7 +90,7 @@
<?php if ($field->hidden) : ?>
<?php echo $field->input; ?>
<?php else : ?>
<div class="control-group"<?php echo $dataShowOn; ?>>
<div class="control-group<?php echo $groupClass; ?>"<?php echo $dataShowOn; ?>>
<?php if ($name != 'permissions') : ?>
<div class="control-label">
<?php echo $field->label; ?>
Expand Down
4 changes: 3 additions & 1 deletion administrator/templates/isis/css/template-rtl.css
Expand Up @@ -7289,7 +7289,6 @@ h6 {
max-height: 800px;
}
.form-horizontal .control-label {
width: auto;
padding-right: 5px;
text-align: left;
}
Expand All @@ -7301,6 +7300,9 @@ h6 {
width: 220px;
}
}
.form-horizontal .field-spacer>.control-label {
width: auto;
}
.form-horizontal #jform_catid_chzn {
vertical-align: middle;
}
Expand Down
4 changes: 3 additions & 1 deletion administrator/templates/isis/css/template.css
Expand Up @@ -7289,7 +7289,6 @@ h6 {
max-height: 800px;
}
.form-horizontal .control-label {
width: auto;
padding-right: 5px;
text-align: left;
}
Expand All @@ -7301,6 +7300,9 @@ h6 {
width: 220px;
}
}
.form-horizontal .field-spacer>.control-label {
width: auto;
}
.form-horizontal #jform_catid_chzn {
vertical-align: middle;
}
Expand Down
26 changes: 14 additions & 12 deletions administrator/templates/isis/less/blocks/_forms.less
Expand Up @@ -7,7 +7,6 @@
.form-horizontal {
// Float the labels left
.control-label {
width: auto;
padding-right: 5px;
text-align: left;
// Set a width for the spacer hr so it shows
Expand All @@ -18,6 +17,9 @@
}
}
}
.field-spacer>.control-label{
width: auto;
}
#jform_catid_chzn {
vertical-align: middle;
}
Expand Down Expand Up @@ -209,7 +211,7 @@ textarea.noResize {
border-width: 0 0 1px 1px;
.icon-minus:before {
content: "I";

}
}
&.btn-primary {
Expand Down Expand Up @@ -277,15 +279,15 @@ textarea.noResize {
padding-bottom: 15px;
}
}
table, thead, tbody, th, td, tr {
display: block;
table, thead, tbody, th, td, tr {
display: block;
}
table {
border: 1px solid #ddd;
}
thead {
th {

th {
position: absolute;
top: -9999px;
left: -9999px;
Expand All @@ -298,15 +300,15 @@ textarea.noResize {
}
}
}
tr {
tr {
margin: 0;
padding: 0;
border: 0;
}
td {
td {
border: none;
position: relative;
padding-left: 50%;
padding-left: 50%;
}
tbody {
td:first-of-type {
Expand All @@ -315,13 +317,13 @@ textarea.noResize {
&:before {top:18px;}
}
}
td:before {

td:before {
content: attr(data-column);
position: absolute;
top: 13px;
left: 10px;
padding-right: 10px;
padding-right: 10px;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion layouts/joomla/content/options_default.php
Expand Up @@ -25,6 +25,7 @@
foreach ($displayData->form->getFieldset($fieldname) as $field)
{
$datashowon = '';
$groupClass = $field->type === 'Spacer' ? ' field-spacer' : '';

if ($field->showon)
{
Expand All @@ -33,7 +34,7 @@
$datashowon = ' data-showon=\'' . json_encode(JFormHelper::parseShowOnConditions($field->showon, $field->formControl, $field->group)) . '\'';
}
?>
<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>
<?php endif; ?>
Expand Down
16 changes: 16 additions & 0 deletions libraries/joomla/form/fields/spacer.php
Expand Up @@ -104,4 +104,20 @@ protected function getTitle()
{
return $this->getLabel();
}

/**
* Method to get a control group with label and input.
*
* @param array $options Options to be passed into the rendering of the field
*
* @return string A string containing the html for the control group
*
* @since __DEPLOY_VERSION__
*/
public function renderField($options = array())
{
$options['class'] = empty($options['class']) ? 'field-spacer' : $options['class'] . ' field-spacer';

return parent::renderField($options);
}
}

0 comments on commit 89230ad

Please sign in to comment.