Simplify svg_tag 'source' parameter
This commit is contained in:
		
							parent
							
								
									f95a93b1e4
								
							
						
					
					
						commit
						461f0bb812
					
				@ -48,7 +48,7 @@ module ApplicationHelper
 | 
				
			|||||||
    current = html_options.delete(:current)
 | 
					    current = html_options.delete(:current)
 | 
				
			||||||
    return "" if (current == :hide) && (url_for(options) == request.path)
 | 
					    return "" if (current == :hide) && (url_for(options) == request.path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    name = svg_tag("pictograms/#{image}.svg#icon") + name if image
 | 
					    name = svg_tag("pictograms/#{image}") + name if image
 | 
				
			||||||
    classes = class_names(html_options[:class], "image-button", active: current == :active)
 | 
					    classes = class_names(html_options[:class], "image-button", active: current == :active)
 | 
				
			||||||
    html_options.merge!(class: classes) { |k, v1, v2| "#{v1} #{v2}" }
 | 
					    html_options.merge!(class: classes) { |k, v1, v2| "#{v1} #{v2}" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -56,9 +56,8 @@ module ApplicationHelper
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def svg_tag(source, options = {})
 | 
					  def svg_tag(source, options = {})
 | 
				
			||||||
    image_name, id = source.split('#')
 | 
					 | 
				
			||||||
    content_tag :svg, options do
 | 
					    content_tag :svg, options do
 | 
				
			||||||
      tag.use href: "#{image_path(image_name)}##{id}"
 | 
					      tag.use href: image_path(source + ".svg") + "#icon"
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user