Skip to content
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

Fix typos and remove unused options in ActionView::Helpers::DateTimeSelector #43566

Merged

Conversation

shunichi
Copy link
Contributor

Summary

This fixes following:

  • ActionView::Helpers::DateTimeSelector has some wrong comments.
  • ActionView::Helpers::DateTimeSelector#select_year has some unused code.

No behavior changed.

Other Information

No other information.

@rails-bot rails-bot bot added the actionview label Oct 29, 2021
@@ -1012,14 +1012,14 @@ def build_options(selected, options = {})
end

# Build select option HTML for year.
# If <tt>year_format</tt> option is not passed
# If <tt>year_format</tt> option is not passed to DateTimeSelector
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this change since it doesn't make sense. We don't pass this option to a module. The example already explain to who we pass it.

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 reverted the change.

I think you mean the comment implies the option is passed to date_select or datetime_select. Is it correct?

# build_year_options(1998, start: 1998, end: 2000)
# => "<option value="1998" selected="selected">1998</option>
# <option value="1999">1999</option>
# <option value="2000">2000</option>"
#
# If <tt>year_format</tt> option is passed
# build_year_options(1998, start: 1998, end: 2000, year_format: ->year { "Heisei #{ year - 1988 }" })
# If <tt>year_format: ->year { "Heisei #{ year - 1988 }</tt> option is passed to DateTimeSelector
Copy link
Member

Choose a reason for hiding this comment

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

Also remove this change. The example should be enough.

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 reverted the change.

@@ -938,7 +938,7 @@ def month_name(number)
#
# year_name(1998) # => 1998
#
# If the <tt>:year_format</tt> option is passed:
# If the <tt>year_format: ->(year) { "Heisei #{year - 1988}" }</tt> option is passed:
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this from here and add to the example

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 reverted the change.

@@ -1019,7 +1019,7 @@ def build_options(selected, options = {})
# <option value="2000">2000</option>"
#
# If <tt>year_format</tt> option is passed
# build_year_options(1998, start: 1998, end: 2000, year_format: ->year { "Heisei #{ year - 1988 }" })
# build_year_options(1998, start: 1998, end: 2000)
# => "<option value="1998" selected="selected">Heisei 10</option>
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 think year_format option should not be passed to build_year_options. it doesn't deal with the option.

Copy link
Member

Choose a reason for hiding this comment

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

True. In that case let's remove it.

Choose a reason for hiding this comment

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

@rafaelfranca @shunichi Looks like this whole piece of doc is no longer relevant, lines 1021-1023 ?

Otherwise this PR looks pretty good to me. Can I help in some way to move it forward?

Copy link
Contributor Author

@shunichi shunichi Jan 24, 2022

Choose a reason for hiding this comment

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

This comment is so confusing.

In the comment, option is not build_year_options' argument but DateTimeSelector.new's.

Other methods likemonth_name have similar comments. But they have no arguments named options. So their comments are less confusing.

I removed the comment about year_format at 0c53554843bc51fbfa86c3678bd9cf5e741d6da9

@shunichi
Copy link
Contributor Author

@rafaelfranca
Is there anything to do for merging this PR?

@pjfitzgibbons
Copy link

@shunichi Looks like you need to rebase from main? The buildkite errors don't seem to have anything to do with your PR.

@shunichi shunichi force-pushed the fix-typos-and-remove-unused-options branch from 0c53554 to a692bb6 Compare January 25, 2022 00:53
@shunichi
Copy link
Contributor Author

@pjfitzgibbons I rebased and squashed commits.

@pjfitzgibbons
Copy link

Looks great! Still failing buildkite... in ActiveJob though. Are you rebased w/ rails:main ?

@shunichi
Copy link
Contributor Author

@pjfitzgibbons

Are you rebased w/ rails:main ?

Yes, I rebased onto 23ce9a7 which is rails:main HEAD at the time of rebase.

@rafaelfranca rafaelfranca merged commit ef5b9ff into rails:main Jan 27, 2022
@shunichi shunichi deleted the fix-typos-and-remove-unused-options branch January 27, 2022 01:52
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.

None yet

3 participants