Sha256: e4de08f3e8ee602e457e54f2407daef171196e2c4df96d8082a7d1d3ae8a24c6

Contents?: true

Size: 996 Bytes

Versions: 2

Compression:

Stored size: 996 Bytes

Contents

module GoSocial
  module Assistant
    extend ActiveSupport::Concern

    module ClassMethods
      attr_reader :scriptized
      attr_writer :default_options
      alias_method :scriptized?, :scriptized

      def my_name
        self.name.demodulize
      end

      def help
        "Please HELP by filling in the help of the #{myname} button :) (see google+ button code)"
      end

      def options_to_data(opts)
        params = {}
        opts.each {|k, v| params["data-#{k}"] = v}
        params
      end

      def options_to_query(subject, opts)
        # formulate the url, and then strip the part before first '?'
        query_params = opts.slice(:url, :media, :description)
        full_url = subject.url_for(query_params)
        full_url.sub(/^([^?]*)/, '')
      end

      protected

      def help_note
        "Note: GoSocial will make sure that the widget scripts are rendered once only!"
      end

      def blank_content
        "".html_safe
      end
    end
  end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
go_social-0.0.1 lib/go_social/assistant.rb~
go_social-0.0.1 lib/go_social/view_helper/assistant.rb~