jquery-toastmessage-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04ca75e3b62674854be7d5c3365e179b625835ca
4
+ data.tar.gz: c212de6e543c2074857da3acdda9dff83b79222b
5
+ SHA512:
6
+ metadata.gz: a7375705ecb1e77c9fd1be44f1368d2e40cdc69b6e78655183780451b74d53fdb42c09495c84d0ffcaedb5b6e7da52e2dd9dcd3ec21a8e899567846a0e686d06
7
+ data.tar.gz: 3e5c783912b8b98a3d656ed988d004470a08b4347dae0c9e18bcdc19b77fe4064e3ca0c53af7cfd53889c89e498461e351fa31eab66f309b188448e4662a6c8a
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jquery-toastmessage-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2015 Reyes Yang
2
+
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # jquery-toastmessage-rails
2
+
3
+ Package [jquery-toastmessage-plugin](http://akquinet.github.io/jquery-toastmessage-plugin/) for the Rails asset pipeline.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'jquery-toastmessage-rails'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install jquery-toastmessage-rails
20
+
21
+ ## Usage
22
+
23
+ Require jquery-toastmessage-plugin in our application.js:
24
+
25
+ ```javascript
26
+ //= require jquery.toastmessage
27
+ ```
28
+
29
+ Also require jquery-toastmessage-plugin stylesheets in out application.css:
30
+
31
+ ```css
32
+ /*
33
+ *= require jquery.toastmessage
34
+ */
35
+ ```
36
+
37
+ ## Release
38
+
39
+ See [VERSIONS.md](VERSIONS.md) for details.
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( https://github.com/[my-github-username]/jquery-toastmessage-rails/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/VERSIONS.md ADDED
@@ -0,0 +1,5 @@
1
+ # Bundled Versions
2
+
3
+ | date | Gem | jQuery Toastmessage Plugin |
4
+ |------------|--------|----------------------------|
5
+ | 2015-03-24 | 1.0.0 | 0.2.0 |
@@ -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 'jquery/toastmessage/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jquery-toastmessage-rails"
8
+ spec.version = Jquery::Toastmessage::Rails::VERSION
9
+ spec.authors = ["Reyes Yang\n"]
10
+ spec.email = ["reyes.yang@gmail.com"]
11
+ spec.summary = %q{jQuery Toastmessage Plugin packaged for the Rails asset pipeline}
12
+ spec.description = %q{jQuery Toastmessage Plugin's JavaScript, Stylesheet and images packaged for Rails asset pipeline}
13
+ spec.homepage = "https://github.com/reyesyang/jquery-toastmessage-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'rails', '>= 3.1.0'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,161 @@
1
+ /*
2
+ * Copyright 2010 akquinet
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ /**
17
+ * This JQuery Plugin will help you in showing some nice Toast-Message like notification messages. The behavior is
18
+ * similar to the android Toast class.
19
+ * You have 4 different toast types you can show. Each type comes with its own icon and colored border. The types are:
20
+ * - notice
21
+ * - success
22
+ * - warning
23
+ * - error
24
+ *
25
+ * The following methods will display a toast message:
26
+ *
27
+ * $().toastmessage('showNoticeToast', 'some message here');
28
+ * $().toastmessage('showSuccessToast', "some message here");
29
+ * $().toastmessage('showWarningToast', "some message here");
30
+ * $().toastmessage('showErrorToast', "some message here");
31
+ *
32
+ * // user configured toastmessage:
33
+ * $().toastmessage('showToast', {
34
+ * text : 'Hello World',
35
+ * sticky : true,
36
+ * position : 'top-right',
37
+ * type : 'success',
38
+ * close : function () {console.log("toast is closed ...");}
39
+ * });
40
+ *
41
+ * To see some more examples please have a look into the Tests in src/test/javascript/ToastmessageTest.js
42
+ *
43
+ * For further style configuration please see corresponding css file: jquery-toastmessage.css
44
+ *
45
+ * This plugin is based on the jquery-notice (http://sandbox.timbenniks.com/projects/jquery-notice/)
46
+ * but is enhanced in several ways:
47
+ *
48
+ * configurable positioning
49
+ * convenience methods for different message types
50
+ * callback functionality when closing the toast
51
+ * included some nice free icons
52
+ * reimplemented to follow jquery plugin good practices rules
53
+ *
54
+ * Author: Daniel Bremer-Tonn
55
+ **/
56
+ (function($)
57
+ {
58
+ var settings = {
59
+ inEffect: {opacity: 'show'}, // in effect
60
+ inEffectDuration: 600, // in effect duration in miliseconds
61
+ stayTime: 3000, // time in miliseconds before the item has to disappear
62
+ text: '', // content of the item. Might be a string or a jQuery object. Be aware that any jQuery object which is acting as a message will be deleted when the toast is fading away.
63
+ sticky: false, // should the toast item sticky or not?
64
+ type: 'notice', // notice, warning, error, success
65
+ position: 'top-right', // top-left, top-center, top-right, middle-left, middle-center, middle-right ... Position of the toast container holding different toast. Position can be set only once at the very first call, changing the position after the first call does nothing
66
+ closeText: '', // text which will be shown as close button, set to '' when you want to introduce an image via css
67
+ close: null // callback function when the toastmessage is closed
68
+ };
69
+
70
+ var methods = {
71
+ init : function(options)
72
+ {
73
+ if (options) {
74
+ $.extend( settings, options );
75
+ }
76
+ },
77
+
78
+ showToast : function(options)
79
+ {
80
+ var localSettings = {};
81
+ $.extend(localSettings, settings, options);
82
+
83
+ // declare variables
84
+ var toastWrapAll, toastItemOuter, toastItemInner, toastItemClose, toastItemImage;
85
+
86
+ toastWrapAll = (!$('.toast-container').length) ? $('<div></div>').addClass('toast-container').addClass('toast-position-' + localSettings.position).appendTo('body') : $('.toast-container');
87
+ toastItemOuter = $('<div></div>').addClass('toast-item-wrapper');
88
+ toastItemInner = $('<div></div>').hide().addClass('toast-item toast-type-' + localSettings.type).appendTo(toastWrapAll).html($('<p>').append (localSettings.text)).animate(localSettings.inEffect, localSettings.inEffectDuration).wrap(toastItemOuter);
89
+ toastItemClose = $('<div></div>').addClass('toast-item-close').prependTo(toastItemInner).html(localSettings.closeText).click(function() { $().toastmessage('removeToast',toastItemInner, localSettings) });
90
+ toastItemImage = $('<div></div>').addClass('toast-item-image').addClass('toast-item-image-' + localSettings.type).prependTo(toastItemInner);
91
+
92
+ if(navigator.userAgent.match(/MSIE 6/i))
93
+ {
94
+ toastWrapAll.css({top: document.documentElement.scrollTop});
95
+ }
96
+
97
+ if(!localSettings.sticky)
98
+ {
99
+ setTimeout(function()
100
+ {
101
+ $().toastmessage('removeToast', toastItemInner, localSettings);
102
+ },
103
+ localSettings.stayTime);
104
+ }
105
+ return toastItemInner;
106
+ },
107
+
108
+ showNoticeToast : function (message)
109
+ {
110
+ var options = {text : message, type : 'notice'};
111
+ return $().toastmessage('showToast', options);
112
+ },
113
+
114
+ showSuccessToast : function (message)
115
+ {
116
+ var options = {text : message, type : 'success'};
117
+ return $().toastmessage('showToast', options);
118
+ },
119
+
120
+ showErrorToast : function (message)
121
+ {
122
+ var options = {text : message, type : 'error'};
123
+ return $().toastmessage('showToast', options);
124
+ },
125
+
126
+ showWarningToast : function (message)
127
+ {
128
+ var options = {text : message, type : 'warning'};
129
+ return $().toastmessage('showToast', options);
130
+ },
131
+
132
+ removeToast: function(obj, options)
133
+ {
134
+ obj.animate({opacity: '0'}, 600, function()
135
+ {
136
+ obj.parent().animate({height: '0px'}, 300, function()
137
+ {
138
+ obj.parent().remove();
139
+ });
140
+ });
141
+ // callback
142
+ if (options && options.close !== null)
143
+ {
144
+ options.close();
145
+ }
146
+ }
147
+ };
148
+
149
+ $.fn.toastmessage = function( method ) {
150
+
151
+ // Method calling logic
152
+ if ( methods[method] ) {
153
+ return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
154
+ } else if ( typeof method === 'object' || ! method ) {
155
+ return methods.init.apply( this, arguments );
156
+ } else {
157
+ $.error( 'Method ' + method + ' does not exist on jQuery.toastmessage' );
158
+ }
159
+ };
160
+
161
+ })(jQuery);
@@ -0,0 +1,143 @@
1
+ .toast-container {
2
+ width: 280px;
3
+ z-index: 9999;
4
+ }
5
+
6
+
7
+ * html .toast-container {
8
+ position: absolute;
9
+ }
10
+
11
+ .toast-item {
12
+ height: auto;
13
+ background: #333;
14
+ opacity: 0.9;
15
+ border-radius: 10px;
16
+ -moz-border-radius: 10px;
17
+ -webkit-border-radius: 10px;
18
+ color: #eee;
19
+ padding-top: 20px;
20
+ padding-bottom: 20px;
21
+ padding-left: 6px;
22
+ padding-right: 6px;
23
+ font-family: lucida Grande;
24
+ font-size: 14px;
25
+ border: 2px solid #999;
26
+ display: block;
27
+ position: relative;
28
+ margin: 0 0 12px 0;
29
+ }
30
+
31
+ .toast-item p {
32
+ text-align: left;
33
+ margin-left: 50px;
34
+ }
35
+
36
+ .toast-item-close {
37
+ background:image-url("jquery-toastmessage/close.gif");
38
+ width:22px;
39
+ height:22px;
40
+ position: absolute;
41
+ top:7px;
42
+ right:7px;
43
+ }
44
+
45
+ .toast-item-image {
46
+ width:32px;
47
+ height: 32px;
48
+ position: absolute;
49
+ top: 50%;
50
+ margin-top: -16px;
51
+ left: 10px;
52
+ }
53
+
54
+ .toast-item-image-notice {
55
+ background:image-url("jquery-toastmessage/notice.png");
56
+ }
57
+
58
+ .toast-item-image-success {
59
+ background:image-url("jquery-toastmessage/success.png");
60
+ }
61
+
62
+ .toast-item-image-warning {
63
+ background:image-url("jquery-toastmessage/warning.png");
64
+ }
65
+
66
+ .toast-item-image-error {
67
+ background:image-url("jquery-toastmessage/error.png");
68
+ }
69
+
70
+
71
+ /**
72
+ * toast types
73
+ *
74
+ * pattern: toast-type-[value]
75
+ * where 'value' is the real value of the plugin option 'type'
76
+ *
77
+ */
78
+ .toast-type-notice {
79
+ color: white;
80
+ }
81
+
82
+ .toast-type-success {
83
+ color: white;
84
+ }
85
+
86
+ .toast-type-warning {
87
+ color: white;
88
+ border-color: #FCBD57;
89
+ }
90
+
91
+ .toast-type-error {
92
+ color: white;
93
+ border-color: #B32B2B;
94
+ }
95
+
96
+ /**
97
+ * positions
98
+ *
99
+ * pattern: toast-position-[value]
100
+ * where 'value' is the real value of the plugin option 'position'
101
+ *
102
+ */
103
+ .toast-position-top-left {
104
+ position: fixed;
105
+ left: 20px;
106
+ top: 20px;
107
+ }
108
+
109
+ .toast-position-top-center {
110
+ position: fixed;
111
+ top: 20px;
112
+ left: 50%;
113
+ margin-left: -140px;
114
+ }
115
+
116
+ .toast-position-top-right {
117
+ position: fixed;
118
+ top: 20px;
119
+ right: 20px;
120
+ }
121
+
122
+ .toast-position-middle-left {
123
+ position: fixed;
124
+ left: 20px;
125
+ top: 50%;
126
+ margin-top: -40px;
127
+ }
128
+
129
+ .toast-position-middle-center {
130
+ position: fixed;
131
+ left: 50%;
132
+ margin-left: -140px;
133
+ margin-top: -40px;
134
+ top: 50%;
135
+ }
136
+
137
+ .toast-position-middle-right {
138
+ position: fixed;
139
+ right: 20px;
140
+ margin-left: -140px;
141
+ margin-top: -40px;
142
+ top: 50%;
143
+ }
@@ -0,0 +1 @@
1
+ require 'jquery/toastmessage/rails'
@@ -0,0 +1,3 @@
1
+ require "jquery/toastmessage/rails/engine"
2
+ require "jquery/toastmessage/rails/version"
3
+
@@ -0,0 +1,8 @@
1
+ module Jquery
2
+ module Toastmessage
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Jquery
2
+ module Toastmessage
3
+ module Rails
4
+ VERSION = "1.0.0"
5
+ JQUERY_TOASTMESSAGE_PLUGIN_VERSION = "0.2.0"
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery-toastmessage-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - |
8
+ Reyes Yang
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-03-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 3.1.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 3.1.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.7'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.7'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ description: jQuery Toastmessage Plugin's JavaScript, Stylesheet and images packaged
57
+ for Rails asset pipeline
58
+ email:
59
+ - reyes.yang@gmail.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - VERSIONS.md
70
+ - jquery-toastmessage-rails.gemspec
71
+ - lib/assets/images/jquery-toastmessage/close.gif
72
+ - lib/assets/images/jquery-toastmessage/error.png
73
+ - lib/assets/images/jquery-toastmessage/notice.png
74
+ - lib/assets/images/jquery-toastmessage/success.png
75
+ - lib/assets/images/jquery-toastmessage/warning.png
76
+ - lib/assets/javascripts/jquery.toastmessage.js
77
+ - lib/assets/stylesheets/jquery.toastmessage.css.scss
78
+ - lib/jquery-toastmessage-rails.rb
79
+ - lib/jquery/toastmessage/rails.rb
80
+ - lib/jquery/toastmessage/rails/engine.rb
81
+ - lib/jquery/toastmessage/rails/version.rb
82
+ homepage: https://github.com/reyesyang/jquery-toastmessage-rails
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.4.5
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: jQuery Toastmessage Plugin packaged for the Rails asset pipeline
106
+ test_files: []