Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ability to exclude widget from the script tag #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/intercom-rails/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def self.reset!
config_group :inbox do
config_accessor :counter # Keep this for backwards compatibility
config_accessor :style do |value|
raise ArgumentError, "inbox.style must be one of :default or :custom" unless [:default, :custom].include?(value)
raise ArgumentError, "inbox.style must be one of :default, :custom, :none or false" unless [:default, :custom, :none, false].include?(value)
end
end

Expand Down
2 changes: 2 additions & 0 deletions lib/intercom-rails/script_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def widget_options_from_config
'#IntercomDefaultWidget'
when :custom
'#Intercom'
when :none, false
nil
else
nil
end
Expand Down
8 changes: 8 additions & 0 deletions spec/script_tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ def sha256_hmac(secret, input)
IntercomRails.config.inbox.style = :custom
expect(ScriptTag.new.intercom_settings['widget']).to eq({'activator' => '#Intercom'})
end
it 'knows about :none' do
IntercomRails.config.inbox.style = :none
expect(ScriptTag.new.intercom_settings['widget']).to eq(nil)
end
it 'knows about false' do
IntercomRails.config.inbox.style = false
expect(ScriptTag.new.intercom_settings['widget']).to eq(nil)
end
end

context 'company' do
Expand Down