Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature: [Form] Toggle Displaying Percent Type Symbol#28797

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
d42ohpaz wants to merge19 commits intosymfony:masterfromd42ohpaz:feature/percent-type-symbol
Closed

Feature: [Form] Toggle Displaying Percent Type Symbol#28797

d42ohpaz wants to merge19 commits intosymfony:masterfromd42ohpaz:feature/percent-type-symbol

Conversation

@d42ohpaz
Copy link

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#28796
LicenseMIT
Doc PRsymfony/symfony-docs#10464

PercentTypesymbol option

As of this writing, Symfony will forcibly append a percentage sign (%) to all input fields that are of thePercentType form type. This PR will introduce a boolean flag calledsymbol that, whenfalse, will not display the percentage sign. Each of the default layouts that definepercent_widget will respect this option.

By default, this new option will be set totrue so that it maintains backward compatibility. The unit tests have been updated where appropriate, and a new unit test has been added (as appropriate).

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

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

This looks quite good so far. I have just left a few comments.

Can we think of use cases where you would want to display another symbol than the percent character (then it could make sense to allow arbitrary strings for this option)?

* Deprecated the`--no-debug` console option, set the "APP_DEBUG"
environment variable to "0" instead.
* Deprecated the`Templating\Helper\TranslatorHelper::transChoice()` method, use the`trans()` one instead with a`%count%` parameter
* Only display`PercentType` percent symbol if the`symbol` option is`true`
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need a changelog entry for this in the FrameworkBundle.

{%-endblockdateinterval_widget %}

{%blockpercent_widget -%}
{%ifsymbol==true %}
Copy link
Member

Choose a reason for hiding this comment

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

let's shorten this:{% if symbol %} (and everywhere else below too)

Copy link
Member

Choose a reason for hiding this comment

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

It also seems like we need to take whitespace control (i.e. the- character) into account here too.

* add bundle name suggestion on wrongly overridden templates paths
* added`name` argument in`debug:twig` command and changed`filter` argument as`--filter` option
* deprecated the`transchoice` tag and filter, use the`trans` ones instead with a`%count%` parameter
* Update`percent_widget` to consider`symbol` option for`PercentType` when displaying the percent symbol
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need such an entry in the changelog file of the Twig bridge

* deprecated calling`FormRenderer::searchAndRenderBlock` for fields which were already rendered
* added a cause when a CSRF error has occurred
* deprecated the`scale` option of the`IntegerType`
* add`symbol` to`PercentType` options and make available as`FormView` vars
Copy link
Member

Choose a reason for hiding this comment

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

I would reword this a bit:

added asymbol option to thePercentType that allows to disable the output of the percent character

*/
publicfunctionbuildView(FormView$view,FormInterface$form,array$options)
{
$view->vars['symbol'] =isset($options['symbol']) ?$options['symbol'] :true;
Copy link
Member

Choose a reason for hiding this comment

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

Can be shortened as the option will always be set:

$view->vars['symbol'] =$options['symbol'];

@d42ohpaz
Copy link
Author

Can we think of use cases where you would want to display another symbol than the percent character (then it could make sense to allow arbitrary strings for this option)?

I missed finding this yesterday, but apparently there are a fewdifferent versions of a percent symbol:

U+0025 % Percent sign (HTML %) (% in HTML5[24]),
U+2030 ‰ per mille sign (HTML ‰ · ‰),
U+2031 ‱ per ten thousand sign (HTML ‱) a.k.a. basis point, and
U+FF05 % fullwidth percent sign (HTML % · see fullwidth forms)
U+FE6A ﹪ small percent sign (HTML ﹪ · see Small Form Variants)
There is also U+066A ٪ ARABIC PERCENT SIGN (HTML ٪), which has the circles replaced by square dots set on edge, the shape of the digit 0 in Arabic numerals.

And there areicons. Unless others object, I'll update the PR later today to allow arbitrary text or boolean false.

</div>
</div>
{%-else -%}
{{-block('form_widget_simple') -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please add more indention?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for the other twig parts


{%blockpercent_widget -%}
{%-ifsymbol==true -%}
<divclass="input-group">
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please add more indention?

@d42ohpaz
Copy link
Author

As for the failed unit tests, I could use some guidance on how to set up an environment and/or execute the tests so that I can reproduce their failures.

@xabbuh
Copy link
Member

@dohpaz42 Sorry, I missed your question. I thinkhttps://symfony.com/doc/current/contributing/code/tests.html should provide some useful insights.

@xabbuh
Copy link
Member

@9ae8sdf76 Do you think you will be able to finish this pull request?

OskarStark reacted with eyes emoji

@fabpot
Copy link
Member

@xabbuh Can you take over this one?

@OskarStark
Copy link
Contributor

I could overtake this too, I just need to know what’s featurewise missing here?

xabbuh reacted with thumbs up emoji

@fabpot
Copy link
Member

@OskarStark Thank you. I think it's ok feature-wise. It's more about rebasing/squashing and fixing tests if needed after that.

OskarStark reacted with thumbs up emoji

@OskarStark
Copy link
Contributor

Done in#30433

This one can be closed

@fabpotfabpot closed thisMar 4, 2019
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@OskarStarkOskarStarkOskarStark requested changes

@xabbuhxabbuhxabbuh requested changes

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

6 participants

@d42ohpaz@xabbuh@fabpot@OskarStark@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp