module Shareable::ActionViewExtension
Helpers
¶ ↑
Public Instance Methods
html_attributes(attributes, opts={})
click to toggle source
# File lib/shareable/helpers/action_view_extension.rb, line 6 def html_attributes(attributes, opts={}) opts = { :data => false }.merge(opts) prefix = opts[:data] ? 'data-' : '' attributes.map { |(k, v)| if v.present? %{#{prefix}#{k.to_s.camelize(:lower)}="#{html_escape( v )}"}.html_safe end }.compact.join( " " ).html_safe end
Protected Instance Methods
refine_options(options={},button=nil)
click to toggle source
# File lib/shareable/helpers/action_view_extension.rb, line 45 def refine_options(options={},button=nil) options[:options] ||= {} options[:options].merge! options.except(:options) if options.has_key?(:buttons) then options[:buttons].map!(&:to_s) end if options[:url].blank? then options[:options][:url] = request.url end #only do for button method calls, don't do this render_shareable if button #add values from configuration to our options for each option that is not passed as part of the button method call (Shareable::Helpers::SocialButtons.config_options[button] - options[:options].keys).each do |key| options[:options][key] = Shareable.config.config.values_at(key).first end end options end