Skip to content

[Form] Remaining changes for bootstrap 4 file fields #27958

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

Merged
merged 1 commit into from
Jul 16, 2018
Merged

[Form] Remaining changes for bootstrap 4 file fields #27958

merged 1 commit into from
Jul 16, 2018

Conversation

apfelbox
Copy link
Contributor

@apfelbox apfelbox commented Jul 15, 2018

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

Hi again,

This is a follow-up PR for #27919

Apparently I talked about it in the previous PR, but forgot to actually push the change. Sorry about that! 😞

This PR no actually adds this instead of just talking about it:

2018-07-15 at 17 52

Sorry again, just forgot to actually update the last PR.

@apfelbox
Copy link
Contributor Author

Also I changed the previous fake-id from "nope" to a more readable "n/a"

@@ -119,7 +119,7 @@
<{{ element|default('div') }} class="custom-file">
{%- set type = type|default('file') -%}
{{- block('form_widget_simple') -}}
<label for="{{ form.vars.id }}" class="custom-file-label">Choose File</label>
<label for="{{ form.vars.id }}" class="custom-file-label">{{ attr.placeholder | default("") }}</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

attr.placeholder|default('') for consistency

Copy link
Contributor

Choose a reason for hiding this comment

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

also it should be translatable i guess 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed the inconsistency (my tunnel vision was strong there I guess).

@apfelbox
Copy link
Contributor Author

@ro0NL

also it should be translatable i guess 🤔

I want to answer it here, as this is an important point and I don't want to discuss it in a collapsed code comment.

I thought about that as well, but as the default placeholder ({attr: { placeholder: "..." } }) is both visible to the user and not translated by default as well, I didn't want to make this inconsistent here.
It would be weird if this field works differently from all other fields. WDYT?

@ro0NL
Copy link
Contributor

ro0NL commented Jul 16, 2018

@apfelbox AFAIK we're already translating placeholders, ... and title attributes for that matter:

{%- if attrname in ['placeholder', 'title'] -%}
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"

{%- if placeholder is not none -%}
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)) }}</option>
{%- endif -%}

@apfelbox
Copy link
Contributor Author

WELL… updated. 😅

@ro0NL
Copy link
Contributor

ro0NL commented Jul 16, 2018

im guessing some composer constraint needs a bump for tests to pass :)

@apfelbox
Copy link
Contributor Author

The symfony/form constraint already points to the next, not yet released version. What do we need to bump?

@fabpot
Copy link
Member

fabpot commented Jul 16, 2018

Thank you @apfelbox.

@fabpot fabpot merged commit 3cd2eef into symfony:4.1 Jul 16, 2018
fabpot added a commit that referenced this pull request Jul 16, 2018
…lbox)

This PR was merged into the 4.1 branch.

Discussion
----------

[Form] Remaining changes for bootstrap 4 file fields

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no>
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

Hi again,

This is a follow-up PR for #27919

Apparently I talked about it in the previous PR, but forgot to actually push the change. Sorry about that! 😞

This PR no actually adds this instead of just talking about it:

![2018-07-15 at 17 52](https://user-images.githubusercontent.com/1032411/42735630-e19b22be-8857-11e8-85b8-6d64e17c2be2.png)

Sorry again, just forgot to actually update the last PR.

Commits
-------

3cd2eef Add placeholder support in bootstrap 4 file fields
@apfelbox apfelbox deleted the bootstrap-file-label branch July 16, 2018 13:54
nicolas-grekas pushed a commit to nicolas-grekas/symfony that referenced this pull request Jul 23, 2018
…s (apfelbox)

This PR was merged into the 4.1 branch.

Discussion
----------

[Form] Remaining changes for bootstrap 4 file fields

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no>
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

Hi again,

This is a follow-up PR for symfony#27919

Apparently I talked about it in the previous PR, but forgot to actually push the change. Sorry about that! 😞

This PR no actually adds this instead of just talking about it:

![2018-07-15 at 17 52](https://user-images.githubusercontent.com/1032411/42735630-e19b22be-8857-11e8-85b8-6d64e17c2be2.png)

Sorry again, just forgot to actually update the last PR.

Commits
-------

3cd2eef Add placeholder support in bootstrap 4 file fields
@fabpot fabpot mentioned this pull request Jul 23, 2018
nicolas-grekas added a commit that referenced this pull request Aug 7, 2018
… in bootstrap 4 (MrMitch)

This PR was merged into the 4.1 branch.

Discussion
----------

[Form] Remove extra .form-group wrapper around file widget in bootstrap 4

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

This is a follow-up to #27958 and #27919 by @apfelbox .

It fixes an extra space between the help text of a FileType widget and the widget itself. The extra space was caused by a `.form-group` wrapper in the `file_widget` block.

Commits
-------

01e7fe4 [Form] Remove extra .form-group wrapper around file widget in bootstrap 4
symfony-splitter pushed a commit to symfony/twig-bridge that referenced this pull request Aug 7, 2018
…ap 4

This is a follow-up to symfony/symfony#27958 and
symfony/symfony#27919.

It fixes an extra space between the help text of a FileType widget and the
widget itself. The extra space was cause by a .form-group wrapper in the
file_widget block.
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