panmind-zendesk 1.0 → 1.0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +2 -6
  2. data/lib/panmind/zendesk.rb +21 -16
  3. metadata +6 -4
data/README.md CHANGED
@@ -13,14 +13,10 @@ and the necessary controller and routing code to implement
13
13
  Installation
14
14
  ------------
15
15
 
16
- Via RubyGems:
17
-
18
- gem install panmind-zendesk
19
-
20
- Or via Rails Plugin:
21
-
22
16
  script/plugin install git://github.com/Panmind/zendesk.git
23
17
 
18
+ Gems will follow soon, hopefully after the July 22nd Ruby Social Club in Milan.
19
+
24
20
 
25
21
  Configuration
26
22
  -------------
@@ -12,7 +12,7 @@ module Panmind
12
12
  # - vjt Wed Jul 21 13:00:42 CEST 2010
13
13
  #
14
14
  module Zendesk
15
- Version = 1.0
15
+ Version = "1.0.1.3"
16
16
 
17
17
  class ConfigurationError < StandardError; end
18
18
 
@@ -24,7 +24,7 @@ module Panmind
24
24
  def support_url; @support_url ||= "http://#{hostname}/home".freeze end
25
25
 
26
26
  # TODO these should become attr_readers and we set @variables directly
27
- attr_accessor :dropbox, :login, :login_url, :assets_path, :assets_name
27
+ attr_accessor :dropbox, :login, :login_url, :js_asset_path, :js_asset_name, :css_asset_path, :css_asset_name
28
28
 
29
29
  def set(options)
30
30
  self.token, self.hostname, self.login, self.login_url =
@@ -35,21 +35,25 @@ module Panmind
35
35
  "and e-mail and the login route helper name" # TODO don't require all these things
36
36
  end
37
37
 
38
+ if options[:dropbox].nil? or options[:dropbox][:dropboxID].blank?
39
+ raise ConfigurationError, "DropboxID is a required param in zenbox-2.0. Please configure options[:dropbox][:dropboxID]."
40
+ end
41
+
42
+ # Dropbox specific customizations, defaults in place
38
43
  self.dropbox = (options[:dropbox] || {}).reverse_merge(
39
- :tab_id => 'feedback',
40
- :tab_color => 'black',
41
- :title => 'Support',
42
- :text => "How may we help you? Please fill in details below, and we'll get back to you as soon as possible.",
43
- :url => Zendesk.hostname
44
+ :tabID => 'feedback',
45
+ :url => Zendesk.hostname
44
46
  ).freeze
45
47
 
46
- # TODO better configuration
47
- self.assets_path = options[:assets_path] || '//assets0.zendesk.com/external/zenbox'
48
- self.assets_name = options[:assets_name] || 'overlay'
48
+ # Path and name for css and asset required for zenbox 2.0
49
+ self.js_asset_path = options[:js_asset_path] || '//assets0.zendesk.com/external/zenbox'
50
+ self.js_asset_name = options[:js_asset_name] || 'zenbox-2.0'
51
+ self.css_asset_path = options[:css_asset_path] || '//assets0.zendesk.com/external/zenbox'
52
+ self.css_asset_name = options[:css_asset_name] || 'zenbox-2.0'
49
53
  end
50
54
 
51
55
  def enabled?
52
- Rails.env.production?
56
+ Rails.env.production? || Rails.env.development?
53
57
  end
54
58
 
55
59
  private
@@ -60,8 +64,9 @@ module Panmind
60
64
  module Helpers
61
65
  def zendesk_dropbox_config
62
66
  config = Zendesk.dropbox
63
- if config[:email].kind_of?(Proc)
64
- config = config.merge(:email => instance_exec(&config[:email]))
67
+
68
+ [:requester_email, :requester_name].each do |key|
69
+ config = config.merge(key => instance_exec(&config[key])) if config[key].kind_of?(Proc)
65
70
  end
66
71
 
67
72
  javascript_tag("var zenbox_params = #{config.to_json};").html_safe
@@ -69,10 +74,10 @@ module Panmind
69
74
 
70
75
  def zendesk_dropbox_tags
71
76
  return unless Zendesk.enabled?
72
-
77
+
73
78
  %(#{zendesk_dropbox_config}
74
- <style type='text/css'>@import url('#{Zendesk.assets_path}/#{Zendesk.assets_name}.css');</style>
75
- <script type='text/javascript' src='#{Zendesk.assets_path}/#{Zendesk.assets_name}.js'></script>).html_safe
79
+ <style type='text/css' media='screen,projection'>@import url('#{Zendesk.css_asset_path}/#{Zendesk.css_asset_name}.css');</style>
80
+ <script type='text/javascript' src='#{Zendesk.js_asset_path}/#{Zendesk.js_asset_name}.js'></script>).html_safe
76
81
  end
77
82
 
78
83
  def zendesk_link_to(text, options = {})
metadata CHANGED
@@ -1,12 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panmind-zendesk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 93
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- version: "1.0"
9
+ - 1
10
+ - 3
11
+ version: 1.0.1.3
10
12
  platform: ruby
11
13
  authors:
12
14
  - Marcello Barnaba
@@ -52,8 +54,8 @@ homepage: http://github.com/Panmind/zendesk
52
54
  licenses: []
53
55
 
54
56
  post_install_message:
55
- rdoc_options:
56
- - --charset=UTF-8
57
+ rdoc_options: []
58
+
57
59
  require_paths:
58
60
  - lib
59
61
  required_ruby_version: !ruby/object:Gem::Requirement