usersnap-rails 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +77 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/usersnap-rails.js.erb +8 -0
- data/app/assets/stylesheets/usersnap-rails.css +3 -0
- data/lib/usersnap-rails.rb +6 -0
- data/lib/usersnap-rails/version.rb +3 -0
- data/usersnap-rails.gemspec +24 -0
- data/vendor/assets/javascripts/usersnap.js +8 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c845d049ae07e8fc6d75769493a2848507e67bf
|
4
|
+
data.tar.gz: 224a330732000541b5ddb77401d228a807646fe8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 079516e6f9eb44062fa54daa02d54c54f996c06f43466acfaf7345680d245aaafeaaee19d1fe9cd66ebcc904bda8fb351b927446a23de2dd9c240115e71f362d
|
7
|
+
data.tar.gz: 088a06a5e26763b46ea675db65d10e461c8d75955934c98143430030e8b5e06b091d191c9b1f8eb0652c97d17e01954e1a144185cc432f5155e09101675119e1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 r11runner
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# usersnap-rails
|
2
|
+
|
3
|
+
The usersnap-rails gem integrates the [Usersnap](https://usersnap.com/) widget with the Rails asset pipeline.
|
4
|
+
In order to use it you have to [register an account at Usersnap](https://usersnap.com/#signup) and add your project. Each project has its own API-key.
|
5
|
+
This gem isn't maintained by the official Usersnap team, and it comes without any guarantee.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'usersnap-rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
### Include JavaScript assets
|
21
|
+
Add to your app/assets/javascripts/application.js
|
22
|
+
```
|
23
|
+
//= require usersnap-rails
|
24
|
+
```
|
25
|
+
|
26
|
+
### Include stylesheet assets
|
27
|
+
Add to your app/assets/stylesheets/application.css
|
28
|
+
```
|
29
|
+
*= require usersnap-rails
|
30
|
+
```
|
31
|
+
|
32
|
+
Or if your manifest file is .scss
|
33
|
+
```
|
34
|
+
@import "usersnap-rails";
|
35
|
+
```
|
36
|
+
|
37
|
+
### Configure your Usersnap API key
|
38
|
+
usersnap-rails assumes that your Usersnap API key is stored in a config variable called usersnap_api_key
|
39
|
+
Set its value in an initializer (e.g. config/initializers/usersnap.rb) or in the environment-specific config files:
|
40
|
+
```
|
41
|
+
Rails.application.config.usersnap_api_key = "x1x2a1-whatever-aa55";
|
42
|
+
```
|
43
|
+
Restart the application.
|
44
|
+
|
45
|
+
### Activate the Usersnap widget in views
|
46
|
+
On the pages where the Usersnap widget should appear, add an element with the ID "include-usersnap-widget".
|
47
|
+
```
|
48
|
+
<div id="include-usersnap-widget"></div>
|
49
|
+
```
|
50
|
+
If you want it to appear an all pages, add it to app/views/layouts/application.html.erb.
|
51
|
+
If you want to make the Usersnap widget available only to specific users, you can write something like this:
|
52
|
+
```
|
53
|
+
<% if current_user.is_allowed_to_report_bug? %>
|
54
|
+
<div id="include-usersnap-widget"></div>
|
55
|
+
<% end %>
|
56
|
+
```
|
57
|
+
|
58
|
+
The positioning of the hidden element doesn't influence where the Usersnap widget will appear.
|
59
|
+
|
60
|
+
### Customizing
|
61
|
+
Usersnap provides a [JavaScript API](https://usersnap.com/docs) to customize the widget: position, language, several event handlers etc. e.g.
|
62
|
+
```
|
63
|
+
var _usersnapconfig = {
|
64
|
+
halign: 'left',
|
65
|
+
btnText: 'Report a bug'
|
66
|
+
};
|
67
|
+
```
|
68
|
+
Add your customizing code to an arbitrary js-file and reference it in your JavaScript manifest file.
|
69
|
+
The [Usersnap Developer API and Documentation](https://usersnap.com/docs) gives an overview about the customizing possibilities.
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it ( https://github.com/r11runner/usersnap-rails/fork )
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'usersnap-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "usersnap-rails"
|
8
|
+
spec.version = UsersnapRails::VERSION
|
9
|
+
spec.authors = ["r11runner"]
|
10
|
+
spec.email = ["r11runner@gmail.com"]
|
11
|
+
spec.summary = %q{Integrate the Usersnap-widget with Rails}
|
12
|
+
spec.homepage = "https://github.com/r11runner/usersnap-rails"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "rails", ">=4.0"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
function loadUsersnapWidget(apiKey){
|
2
|
+
var s = document.createElement("script");
|
3
|
+
s.type = "text/javascript";
|
4
|
+
s.async = true;
|
5
|
+
s.src = '//api.usersnap.com/load/' + apiKey + '.js';
|
6
|
+
var x = document.getElementsByTagName('script')[0];
|
7
|
+
x.parentNode.insertBefore(s, x);
|
8
|
+
};
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: usersnap-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.11
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- r11runner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- r11runner@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- app/assets/javascripts/usersnap-rails.js.erb
|
68
|
+
- app/assets/stylesheets/usersnap-rails.css
|
69
|
+
- lib/usersnap-rails.rb
|
70
|
+
- lib/usersnap-rails/version.rb
|
71
|
+
- usersnap-rails.gemspec
|
72
|
+
- vendor/assets/javascripts/usersnap.js
|
73
|
+
homepage: https://github.com/r11runner/usersnap-rails
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Integrate the Usersnap-widget with Rails
|
97
|
+
test_files: []
|