Skip to content

[Bridge\Twig] fix bootstrap checkbox_row to render properly & remove spaceless #24728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed

[Bridge\Twig] fix bootstrap checkbox_row to render properly & remove spaceless #24728

wants to merge 11 commits into from

Conversation

arkste
Copy link
Contributor

@arkste arkste commented Oct 28, 2017

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #24711
License MIT
Doc PR -

As discussed in #24711 i reverted the change i did in bootstrap_3_layout.html.twig (which caused an unnecessary empty div-container in the vertical-layout), added the checkbox_row block to the bootstrap_3_horizontal_layout.html.twig and removed spaceless (as proposed in #24727).

since i added {#--#} in bootstrap 3, i did the same for the same horizontal blocks in bootstrap 4 as well.

I moved the form_label_class & form_group_class blocks to the top of bootstrap_3_horizontal_layout.html.twig & bootstrap_4_horizontal_layout.html.twig, this should improve DX as they were spreaded across the file.

#24702 affected the bootstrap 4 horizontal layout as well, so i added the checkbox_row block to bootstrap 4 too.

ping @fabpot @nicolas-grekas

@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

I've added tests to make sure the checkbox row doesn't break again in bootstrap 3 & 4.

TwigBridge tests were failing because of the changes made in #24703, so i fixed them as well.

Tests are still failing, but this is related due to the timezone changes.

Please let me know if there's anything else i can do to get this merged.

@@ -8,20 +16,14 @@
{# Labels #}

{% block form_label -%}
{% spaceless %}
{% if label is same as(false) %}
<div class="{{ block('form_label_class') }}"></div>
{% else %}
Copy link
Member

Choose a reason for hiding this comment

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

these tags are missing the whitespace control to remove indentation spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed. please review the recent commit, thanks!

@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

Status: Needs Review

@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

@stof i've added more whitespace control tags to remove indentation spaces.

@nicolas-grekas nicolas-grekas changed the title [Bridge\Twig] fix bootstrap checkbox_row to render properly & remove … [Bridge\Twig] fix bootstrap checkbox_row to render properly & remove spaceless Oct 30, 2017
@nicolas-grekas
Copy link
Member

deps=low tests should not fail: Form's lowest dep for the bridge should be bumped (or vice-versa, didn't look precisely)

@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

@nicolas-grekas not sure what to do now, the deps are already on ~3.4|~4.0.

@nicolas-grekas
Copy link
Member

should be ~3.4-beta2|~4.0

@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

correct me if i'm wrong, but even changing the deps wont make the tests running green on deps=low, since travis runs the bridge tests from the vendor-folder (like /home/travis/build/symfony/symfony/src/Symfony/Bridge/Twig/vendor/symfony/form/Tests/AbstractLayoutTest.php:84) and the fixed tests are only in this PR.

@nicolas-grekas
Copy link
Member

it will: the CI builds per PR packages for that situation

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Oct 30, 2017
@@ -1,5 +1,13 @@
{% use "bootstrap_3_layout.html.twig" %}

{% block form_label_class -%}
col-sm-2
{%- endblock form_label_class %}
Copy link
Member

Choose a reason for hiding this comment

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

Can you move back this snippet to where it was before? That would ease merging older branches. Thanks.


{% block form_group_class -%}
col-sm-10
{%- endblock form_group_class %}
Copy link
Member

Choose a reason for hiding this comment

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

Same for this one. We try to not move snippets of code around as it makes merging branches more difficult.

@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

@fabpot i reverted the change for bootstrap 3 & 4.

{{- parent() -}}
{%- endblock button_widget %}

{% block checkbox_widget -%}
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
{% if 'checkbox-inline' in parent_label_class %}
{%- if 'checkbox-inline' in parent_label_class -%}
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure those added - are needed? Does they make a difference as there are already - signs at the end of the line before and at the beginning of the next line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually they're not needed, but i tried to keep it similar to the bs4 layout, will remove them in both templates.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

the diff should be reduced to the strict minimum (there are some added "-" that are not needed)

{{- form_errors(form) -}}
</div>{#--#}
</div>
{%- endblock checkbox_row %}
Copy link
Member

Choose a reason for hiding this comment

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

missing end of line

@fabpot
Copy link
Member

fabpot commented Oct 30, 2017

Thank you @arkste.

fabpot added a commit that referenced this pull request Oct 30, 2017
…y & remove spaceless (arkste)

This PR was squashed before being merged into the 3.4 branch (closes #24728).

Discussion
----------

[Bridge\Twig] fix bootstrap checkbox_row to render properly & remove spaceless

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24711
| License       | MIT
| Doc PR        | -

As discussed in #24711 i reverted the change i did in `bootstrap_3_layout.html.twig` (which caused an unnecessary empty div-container in the vertical-layout), added the `checkbox_row` block to the `bootstrap_3_horizontal_layout.html.twig` and removed `spaceless` (as proposed in #24727).

since i added `{#--#}` in bootstrap 3, i did the same for the same horizontal blocks in bootstrap 4 as well.

I moved the `form_label_class` & `form_group_class` blocks to the top of `bootstrap_3_horizontal_layout.html.twig` & `bootstrap_4_horizontal_layout.html.twig`, this should improve DX as they were spreaded across the file.

#24702 affected the bootstrap 4 horizontal layout as well, so i added the `checkbox_row` block to bootstrap 4 too.

ping @fabpot @nicolas-grekas

Commits
-------

f84749f [Bridge\Twig] fix bootstrap checkbox_row to render properly & remove spaceless
@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

seems like i pushed the EOL's while this was supposed to be merged. anything i should do now @fabpot ?

@fabpot
Copy link
Member

fabpot commented Oct 30, 2017

@arkste all is fine :) Thank you.

@arkste
Copy link
Contributor Author

arkste commented Oct 30, 2017

ok :)

@arkste arkste closed this Oct 30, 2017
@arkste arkste deleted the spaceless-bootstrap-fix branch October 30, 2017 19:15
This was referenced Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants