Class: ProoflinkConnect::ShareButton

Inherits:
Object
  • Object
show all
Defined in:
lib/prooflink_connect/share_button.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, options = {}) ⇒ ShareButton

Returns a new instance of ShareButton.



6
7
8
9
# File 'lib/prooflink_connect/share_button.rb', line 6

def initialize(message = nil, options = {})
  @message = message
  @options = options
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/prooflink_connect/share_button.rb', line 3

def message
  @message
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/prooflink_connect/share_button.rb', line 4

def options
  @options
end

Instance Method Details

#to_htmlObject



11
12
13
14
# File 'lib/prooflink_connect/share_button.rb', line 11

def to_html
  html = "<iframe src='#{ProoflinkConnect.config.protocol}://#{[ProoflinkConnect.config.subdomain, ProoflinkConnect.config.provider_endpoint].compact.join(".")}/#{@options[:locale]||"en"}/shares/button?message=#{CGI.escape @message}' style='width: 112px; height: 16px; border: 0;display: block' frameborder='0' scrolling='no'></iframe>"
  html.respond_to?(:html_safe) ? html.html_safe : html
end