Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[WIP] [Form] [TwigBridge] Bootstrap horizontal theme missing tests #16351

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 2 commits into from
Closed

[WIP] [Form] [TwigBridge] Bootstrap horizontal theme missing tests #16351

wants to merge 2 commits into from

Conversation

chesedo
Copy link

@chesedo chesedo commented Oct 27, 2015

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

The current bootstrap horizontal theme has a limitation where the inputs will always have col-sm-2 class applied to them and the developer has no way on changing this when he wants larger/smaller labels or wants to target another screen size only. The same applies for the div around the input.

PR checks if a label's class has a col-* class set and then uses it rather than the default so that the developer can change them as is needed. Again the same for the div by checking the group_attr.class

This is my first contribution to Symfony and from the contribution docs I see that the following is still needed.

ToDo

  • Create Doc and its PR
  • Edit CHANGELOG???

For the Doc it seems best to edit cookbook/form/form_customization.rst and add another 'admonition' below the "built-in form themes" section that highlights this capability?

I'm not sure what will go into the CHANGELOG?

@lyrixx
Copy link
Member

lyrixx commented Oct 27, 2015

Hello.

Thanks for your first contribution.

Unfortunately I'm 👎 with this PR because you can easily change this value thanks to form theming.

@chesedo
Copy link
Author

chesedo commented Oct 27, 2015

NP, had to create a theme with the PR code in a project awhile ago where some inputs were shorter than the full width and just thought it might be helpful as part of the core theme.

Note that in creating the tests for the PR a bug was found (see 2nd commit). If the PR is turned down, should I file a bug and create a PR with that fix or can I just create a PR (that is if that is still seen as a bug)?

@lyrixx
Copy link
Member

lyrixx commented Oct 27, 2015

You could remove non bug fix commit and edit the pr title ;)

@fabpot
Copy link
Member

fabpot commented Nov 7, 2015

@pieter2627 Can you update this PR to just keep the bug fix? Thanks.

@chesedo
Copy link
Author

chesedo commented Nov 7, 2015

Yes, I'll see to do so soon. (Will also include the test as it exposed the bug and confirms the fix)

Pieter added 2 commits November 7, 2015 16:28
`AbstractBootstrap3HorizontalLayoutTest.php` extends the non-horizontal equivalent version just like it does in the theme. Certain tests are redeclared to match how they differ in the horizontal layout.

`FormExtensionBootstrap3HorizontalLayoutTest.php` uses the skeleton from the other themes' tests.
Using spaceless meant that the horizontal layout will fail the `testTextareaWithWhitespaceOnlyContentRetainsValueWhenRenderingForm` test.
@chesedo chesedo changed the title [WIP] [Form] [TwigBridge] Bootstrap horizontal theme custom column width [WIP] [Form] [TwigBridge] Bootstrap horizontal theme missing tests Nov 7, 2015
@chesedo
Copy link
Author

chesedo commented Nov 14, 2015

I have pushed the updated code, but the tests seem to have failed due to an issue that existed in the 2.8 branch at the time. I can rebase them on the latest 2.8 and update the PR if needed?

Also the title is updated as @lyrixx suggested, but I'm not sure if the description should be amended (to keep the base of the discussion) or completely redone to just have the bug fix?

</div>
</div>
{% endspaceless %}
{##}</div>
Copy link
Member

Choose a reason for hiding this comment

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

Why have you added {##} here?

Copy link
Author

Choose a reason for hiding this comment

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

It was the only why I could think of to have a 'space control' between the two closing div tags without having to use spaceless. I guess the last closing div can also be moved directly to the end of the previous one, but that will break the indents.

@fabpot
Copy link
Member

fabpot commented Nov 28, 2015

Thank you @pieter2627.

fabpot added a commit that referenced this pull request Nov 28, 2015
…ng tests (pieter2627)

This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #16351).

Discussion
----------

[WIP] [Form] [TwigBridge] Bootstrap horizontal theme missing tests

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

The current bootstrap horizontal theme has a limitation where the inputs will always have `col-sm-2` class applied to them and the developer has no way on changing this when he wants larger/smaller labels or wants to target another screen size only. The same applies for the `div` around the `input`.

PR checks if a label's class has a `col-*` class set and then uses it rather than the default so that the developer can change them as is needed. Again the same for the `div` by checking the `group_attr.class`

This is my first contribution to Symfony and from the contribution docs I see that the following is still needed.

### ToDo
- [ ] Create Doc and its PR
- [ ] Edit `CHANGELOG???`

For the Doc it seems best to edit `cookbook/form/form_customization.rst` and add another 'admonition' below the "built-in form themes" section that highlights this capability?

I'm not sure what will go into the CHANGELOG?

Commits
-------

a35d3d4 [WIP] [Form] [TwigBridge] Bootstrap horizontal theme missing tests
@fabpot fabpot closed this Nov 28, 2015
@chesedo chesedo deleted the Bootstrap_Theme_Custom_Column_Width branch November 30, 2015 08:04
This was referenced Nov 30, 2015
@fabpot fabpot mentioned this pull request Dec 26, 2015
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.

4 participants