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.
- data/README.md +2 -6
- data/lib/panmind/zendesk.rb +21 -16
- 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
|
-------------
|
data/lib/panmind/zendesk.rb
CHANGED
@@ -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, :
|
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
|
-
:
|
40
|
-
:
|
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
|
-
#
|
47
|
-
self.
|
48
|
-
self.
|
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
|
-
|
64
|
-
|
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.
|
75
|
-
<script type='text/javascript' src='#{Zendesk.
|
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:
|
4
|
+
hash: 93
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
|
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
|
-
|
57
|
+
rdoc_options: []
|
58
|
+
|
57
59
|
require_paths:
|
58
60
|
- lib
|
59
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|