Extract helper methods for labels from filters/_filter_fields (#27574)
This commit is contained in:
		
							
								
								
									
										12
									
								
								app/helpers/filters_helper.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/helpers/filters_helper.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					# frozen_string_literal: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module FiltersHelper
 | 
				
			||||||
 | 
					  def filter_action_label(action)
 | 
				
			||||||
 | 
					    safe_join(
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        t("simple_form.labels.filters.actions.#{action}"),
 | 
				
			||||||
 | 
					        content_tag(:span, t("simple_form.hints.filters.actions.#{action}"), class: 'hint'),
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
%hr.spacer/
 | 
					%hr.spacer/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.fields-group
 | 
					.fields-group
 | 
				
			||||||
  = f.input :filter_action, as: :radio_buttons, collection: %i(warn hide), include_blank: false, wrapper: :with_block_label, label_method: ->(action) { safe_join([t("simple_form.labels.filters.actions.#{action}"), content_tag(:span, t("simple_form.hints.filters.actions.#{action}"), class: 'hint')]) }, hint: t('simple_form.hints.filters.action'), required: true
 | 
					  = f.input :filter_action, as: :radio_buttons, collection: %i(warn hide), include_blank: false, wrapper: :with_block_label, label_method: ->(action) { filter_action_label(action) }, hint: t('simple_form.hints.filters.action'), required: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%hr.spacer/
 | 
					%hr.spacer/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user