Skip to content

Commit

Permalink
Move Form Options helper into select rendering classes
Browse files Browse the repository at this point in the history
The FormOptionsHelper is only needed in classes where a <select> tag is rendered. It was previously included in the Tags::Base class which unnecessarily included it every child Tag class.
  • Loading branch information
pinzonjulian committed Jun 25, 2023
1 parent f19f426 commit 77f3fc1
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion actionview/lib/action_view/helpers/tags/base.rb
Expand Up @@ -5,7 +5,6 @@ module Helpers
module Tags # :nodoc:
class Base # :nodoc:
include Helpers::ActiveModelInstanceTag, Helpers::TagHelper, Helpers::FormTagHelper
include FormOptionsHelper

attr_reader :object

Expand Down
Expand Up @@ -7,6 +7,7 @@ module Helpers
module Tags # :nodoc:
class CollectionCheckBoxes < Base # :nodoc:
include CollectionHelpers
include FormOptionsHelper

class CheckBoxBuilder < Builder # :nodoc:
def check_box(extra_html_options = {})
Expand Down
Expand Up @@ -7,6 +7,7 @@ module Helpers
module Tags # :nodoc:
class CollectionRadioButtons < Base # :nodoc:
include CollectionHelpers
include FormOptionsHelper

class RadioButtonBuilder < Builder # :nodoc:
def radio_button(extra_html_options = {})
Expand Down
Expand Up @@ -7,6 +7,7 @@ module Helpers
module Tags # :nodoc:
class CollectionSelect < Base # :nodoc:
include SelectRenderer
include FormOptionsHelper

def initialize(object_name, method_name, template_object, collection, value_method, text_method, options, html_options)
@collection = collection
Expand Down
Expand Up @@ -7,6 +7,7 @@ module Helpers
module Tags # :nodoc:
class GroupedCollectionSelect < Base # :nodoc:
include SelectRenderer
include FormOptionsHelper

def initialize(object_name, method_name, template_object, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options)
@collection = collection
Expand Down
1 change: 1 addition & 0 deletions actionview/lib/action_view/helpers/tags/select.rb
Expand Up @@ -7,6 +7,7 @@ module Helpers
module Tags # :nodoc:
class Select < Base # :nodoc:
include SelectRenderer
include FormOptionsHelper

def initialize(object_name, method_name, template_object, choices, options, html_options)
@choices = block_given? ? template_object.capture { yield || "" } : choices
Expand Down
Expand Up @@ -7,6 +7,7 @@ module Helpers
module Tags # :nodoc:
class TimeZoneSelect < Base # :nodoc:
include SelectRenderer
include FormOptionsHelper

def initialize(object_name, method_name, template_object, priority_zones, options, html_options)
@priority_zones = priority_zones
Expand Down
1 change: 1 addition & 0 deletions actionview/lib/action_view/helpers/tags/weekday_select.rb
Expand Up @@ -7,6 +7,7 @@ module Helpers
module Tags # :nodoc:
class WeekdaySelect < Base # :nodoc:
include SelectRenderer
include FormOptionsHelper

def initialize(object_name, method_name, template_object, options, html_options)
@html_options = html_options
Expand Down

0 comments on commit 77f3fc1

Please sign in to comment.