ohsnap-rails 0.1.0
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/.DS_Store +0 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +95 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/ohsnap/rails/version.rb +5 -0
- data/lib/ohsnap/rails.rb +7 -0
- data/ohsnap-rails.gemspec +25 -0
- data/ohsnap.png +0 -0
- data/vendor/assets/javasccripts/ohsnap.js +56 -0
- metadata +87 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: d95eed1dea9ffbc82f9ed1c25ef17beea944f332
|
|
4
|
+
data.tar.gz: f1d95145527848bc555709dc847f6de5554dd019
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7ff1dcdbad751128fc4785382a0e1efe59544a8eb36c1aa0e752fbff5f67227613d8fb429d69f131d6edbb1a1275eb2bee56dbafeece052ad46d63f944540615
|
|
7
|
+
data.tar.gz: 7668ba439e4c06617bd9a08a1b121efbb886738c50b743177fc879e0282baa6f9a89fe9f3aca2064e464aa541bb291f4d01dc0a1b2aa79421f0316d074ff8b7e
|
data/.DS_Store
ADDED
|
Binary file
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Rahul Lakhaney
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Ohsnap
|
|
2
|
+
|
|
3
|
+
A ruby gem for ohsnap.js [library by justin domingue](https://github.com/justindomingue)
|
|
4
|
+
|
|
5
|
+
A simple notification jQuery/Zepto library designed to be used in mobile apps
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
[Live Demo](http://justindomingue.github.io/ohSnap/)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add this line to your application's Gemfile:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'ohsnap-rails'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
And then execute:
|
|
19
|
+
|
|
20
|
+
$ bundle
|
|
21
|
+
|
|
22
|
+
Or install it yourself as:
|
|
23
|
+
|
|
24
|
+
$ gem install ohsnap-rails
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
To your ```application.js``` file, add:
|
|
29
|
+
```Javascript
|
|
30
|
+
//= require ohsnap
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
In your html content add a div:
|
|
34
|
+
```HTML
|
|
35
|
+
<div id="ohsnap"></div>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Ohsnap created div with classes .alert .alert-color .So you would need to have:
|
|
39
|
+
|
|
40
|
+
```CSS
|
|
41
|
+
/* ALERTS */
|
|
42
|
+
/* inspired by Twitter Bootstrap */
|
|
43
|
+
|
|
44
|
+
.alert {
|
|
45
|
+
padding: 15px;
|
|
46
|
+
margin-bottom: 20px;
|
|
47
|
+
border: 1px solid #eed3d7;
|
|
48
|
+
border-radius: 4px;
|
|
49
|
+
position: absolute;
|
|
50
|
+
bottom: 0px;
|
|
51
|
+
right: 21px;
|
|
52
|
+
/* Each alert has its own width */
|
|
53
|
+
float: right;
|
|
54
|
+
clear: right;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.alert-red {
|
|
58
|
+
color: white;
|
|
59
|
+
background-color: #DA4453;
|
|
60
|
+
}
|
|
61
|
+
.alert-green {
|
|
62
|
+
color: white;
|
|
63
|
+
background-color: #37BC9B;
|
|
64
|
+
}
|
|
65
|
+
.alert-blue {
|
|
66
|
+
color: white;
|
|
67
|
+
background-color: #4A89DC;
|
|
68
|
+
}
|
|
69
|
+
.alert-yellow {
|
|
70
|
+
color: white;
|
|
71
|
+
background-color: #F6BB42;
|
|
72
|
+
}
|
|
73
|
+
.alert-orange {
|
|
74
|
+
color:white;
|
|
75
|
+
background-color: #E9573F;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
in your css file.
|
|
80
|
+
|
|
81
|
+
## Customizations
|
|
82
|
+
|
|
83
|
+
[Visit the offical ohsnap repo for customizations and a more detailed usage guide](https://github.com/justindomingue/ohSnap)
|
|
84
|
+
|
|
85
|
+
## Contributing
|
|
86
|
+
|
|
87
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rahullakhaney/ohsnap-rails
|
|
88
|
+
|
|
89
|
+
Follow me on [Twitter](https://www.twitter.com/istereotype) for more updates on the #20in20.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
95
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "ohsnap/rails"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/ohsnap/rails.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'ohsnap/rails/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "ohsnap-rails"
|
|
8
|
+
spec.version = Ohsnap::Rails::VERSION
|
|
9
|
+
spec.authors = ["Rahul Lakhaney"]
|
|
10
|
+
spec.email = ["rahul.lakhaney@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Ruby gem for ohsnap.}
|
|
13
|
+
spec.description = %q{Ruby gem for ohsnap. A simple notification jQuery/Zepto library designed to be used in mobile apps}
|
|
14
|
+
spec.homepage = "https://github.com/rahullakhaney/ohsnap-rails"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
19
|
+
spec.bindir = "exe"
|
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
25
|
+
end
|
data/ohsnap.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* == OhSnap!.js ==
|
|
3
|
+
* A simple jQuery/Zepto notification library designed to be used in mobile apps
|
|
4
|
+
*
|
|
5
|
+
* author: Justin Domingue
|
|
6
|
+
* date: september 18, 2015
|
|
7
|
+
* version: 0.1.4
|
|
8
|
+
* copyright - nice copyright over here
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* Shows a toast on the page
|
|
12
|
+
* Params:
|
|
13
|
+
* text: text to show
|
|
14
|
+
* color: color of the toast. one of red, green, blue, orange, yellow or custom
|
|
15
|
+
*/
|
|
16
|
+
function ohSnap(text, color, icon) {
|
|
17
|
+
var icon_markup = "",
|
|
18
|
+
html,
|
|
19
|
+
time = '5000',
|
|
20
|
+
$container = $('#ohsnap');
|
|
21
|
+
|
|
22
|
+
if (icon) {
|
|
23
|
+
icon_markup = "<span class='" + icon + "'></span> ";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Generate the HTML
|
|
27
|
+
html = $('<div class="alert alert-' + color + '">' + icon_markup + text + '</div>').fadeIn('fast');
|
|
28
|
+
|
|
29
|
+
// Append the label to the container
|
|
30
|
+
$container.append(html);
|
|
31
|
+
|
|
32
|
+
// Remove the notification on click
|
|
33
|
+
html.on('click', function() {
|
|
34
|
+
ohSnapX($(this));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// After 'time' seconds, the animation fades out
|
|
38
|
+
setTimeout(function() {
|
|
39
|
+
ohSnapX(html);
|
|
40
|
+
}, time);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function ohSnapX(element) {
|
|
44
|
+
// Called without argument, the function removes all alerts
|
|
45
|
+
// element must be a jQuery object
|
|
46
|
+
|
|
47
|
+
if (typeof element !== "undefined") {
|
|
48
|
+
element.fadeOut('fast', function() {
|
|
49
|
+
$(this).remove();
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
$('.alert').fadeOut('fast', function() {
|
|
53
|
+
$(this).remove();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ohsnap-rails
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Rahul Lakhaney
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.10'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
description: Ruby gem for ohsnap. A simple notification jQuery/Zepto library designed
|
|
42
|
+
to be used in mobile apps
|
|
43
|
+
email:
|
|
44
|
+
- rahul.lakhaney@gmail.com
|
|
45
|
+
executables: []
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".DS_Store"
|
|
50
|
+
- ".gitignore"
|
|
51
|
+
- ".travis.yml"
|
|
52
|
+
- Gemfile
|
|
53
|
+
- LICENSE.txt
|
|
54
|
+
- README.md
|
|
55
|
+
- Rakefile
|
|
56
|
+
- bin/console
|
|
57
|
+
- bin/setup
|
|
58
|
+
- lib/ohsnap/rails.rb
|
|
59
|
+
- lib/ohsnap/rails/version.rb
|
|
60
|
+
- ohsnap-rails.gemspec
|
|
61
|
+
- ohsnap.png
|
|
62
|
+
- vendor/assets/javasccripts/ohsnap.js
|
|
63
|
+
homepage: https://github.com/rahullakhaney/ohsnap-rails
|
|
64
|
+
licenses:
|
|
65
|
+
- MIT
|
|
66
|
+
metadata: {}
|
|
67
|
+
post_install_message:
|
|
68
|
+
rdoc_options: []
|
|
69
|
+
require_paths:
|
|
70
|
+
- lib
|
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '0'
|
|
81
|
+
requirements: []
|
|
82
|
+
rubyforge_project:
|
|
83
|
+
rubygems_version: 2.4.5.1
|
|
84
|
+
signing_key:
|
|
85
|
+
specification_version: 4
|
|
86
|
+
summary: Ruby gem for ohsnap.
|
|
87
|
+
test_files: []
|