freshdesk-rails

Build Status Coverage Status

A library to integrate with freshdesk help desk.

Installation

Add this line to your application's Gemfile:

gem 'freshdesk-rails'

Make sure you have:

gem 'jquery-rails'

And then execute:

bundle

Or install it yourself as:

gem install freshdesk-rails

For rails, create config config/initializers/freshdesk-rails.rb

FreshdeskRails.configure do |config|
  config.default_locale = :en
  # list your help desks with locales.
  config.urls = {
    'zh-TW' => 'http://tw.example.freshdesk.com',
    'ja-JP' => 'http://jp.example.freshdesk.com',
    'en' => 'http://example.freshdesk.com'
  }
end

Usage

In rails controllers, you can call redirect_to_freshdesk to redirect with locale.

# using I18n.locale
redirect_to_freshdesk

Or you can assaign locale manaully

redirect_to_freshdesk :locale => :en

In view, you can use include_popup_freshdesk to include javascript plugin.

# in <head/>
include_popup_freshdesk {"utf8": "✓", "buttonType": "text", "buttonText": "Help", "buttonColor": "white", "buttonBg": "#09a8be", "alignment": "2", "offset": "350px", "submitThanks": "Thanks for your feedback", "formHeight": "500px", "formTitle": "Ask Something..." }

If you use turbolinks, you can assaign locale.

# in <body/>
= update_freshdesk_locale({"locale": "en", "submitThanks": "Thanks for your feedback", "formTitle": "Ask Something...", "buttonText": "Help"})

License

The gem is available as open source under the terms of the MIT License.

Contact

The project's website is located at https://github.com/emn178/freshdesk-rails
Author: [email protected]