bootstrap_notify 0.0.1

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: 8ec1e5d6c9e8584be43eeba02b77154c403c0fb0
4
+ data.tar.gz: d8fddd0e81bb7c528b0693d42731b77a08f943bd
5
+ SHA512:
6
+ metadata.gz: a8d174af24676ed4b62f7de3b676f74180aed51b00365b673d5cb929861ceb48e5be7358f423acb7e232ef33efd53b659c705220434527eda3b764cc88e3d170
7
+ data.tar.gz: be0ef0808c4ae365e8982f4534bb31eb35bf1239520e9c55a6359fc5418db9240fb1075cee765e3cb571f6d4b335eddf7b4890be1a2316a9296c32d1ba0b0bea
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Alexander Gorbunov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # Bootstrap Notify - Rails notifications made easy.
2
+
3
+ **BootstrapNotify** aims to be a simple notification system that you can easily drop into your Rails project for nice looking notify flashes.
4
+ BootstrapNotify is based off of bootstrap-notify by user goodybag http://goodybag.github.com/bootstrap-notify/
5
+
6
+ You can see a demo at:
7
+ http://goodybag.github.com/bootstrap-notify
8
+
9
+ This is a based off of my SCSS conversion of bootstrap-notify.
10
+
11
+ Requirements:
12
+ * SCSS version of bootstrap installed from https://github.com/thomas-mcdonald/bootstrap-sass
13
+ * jQuery
14
+
15
+ ## Installation
16
+
17
+ Add it to your Gemfile:
18
+
19
+ ```ruby
20
+ gem 'bootstrap_notify', git: 'git@git.nnbs.ru:gem/bootstrap_notify.git', tag: 'v0.0.0'
21
+ ```
22
+
23
+ Include the javascripts in application.js. Make sure to include **after** jQuery:
24
+
25
+ ```
26
+ //= require jquery
27
+ //= require jquery_ujs
28
+ //= require bootstrap_notify
29
+ ```
30
+
31
+ Import the SCSS after you import bootstrap:
32
+
33
+ ```
34
+ @import "bootstrap";
35
+ @import "bootstrap_notify";
36
+ ```
37
+
38
+ ## Implementation
39
+ Quick and Dirty style:
40
+
41
+ Create a partial with the contents
42
+
43
+ ```ruby
44
+ # app/views/partials/_notify.html.haml
45
+ - if !notice.blank?
46
+ :javascript
47
+ $(document).ready(function () {
48
+ $('.top-right').notify({
49
+ message: { text: "#{notice}" }
50
+ }).show();
51
+ });
52
+ ```
53
+ Render the partial in your layout with the `<head>` tag, after your javascript and CSS have been included.
54
+
55
+ ```ruby
56
+ # app/views/layouts/application.html.haml
57
+ = render(:partial => "partials/notify")
58
+ ```
59
+
60
+ Don't forget to include the div to attach the notification to:
61
+
62
+ ```
63
+ # app/views/layouts/application.html.haml
64
+ .notifications.top-right
65
+ ```
66
+
67
+ Additional configuration and placement options can be found at:
68
+ http://goodybag.github.com/bootstrap-notify
69
+
70
+ ## Customizing Placement
71
+ You can offset the placement of the notification by adjusting the top, bottom, left or right variables.
72
+
73
+ ```
74
+ $notify_right: 100px;
75
+ $notify_left: $notify_right;
76
+ $notify_top: 500px;
77
+ $notify_bottom: $notify_top;
78
+ @import "bootstrap_notify";
79
+ ```
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'BootstrapNotify'
18
+ rdoc.options << '--line-numbers'
19
+ # rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1 @@
1
+ //= require_tree .
@@ -0,0 +1,92 @@
1
+ /**
2
+ * bootstrap-notify.js v1.0.0
3
+ * --
4
+ * Copyright 2012 Nijiko Yonskai <nijikokun@gmail.com>
5
+ * Copyright 2012 Goodybag, Inc.
6
+ * --
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ (function ($) {
21
+ var Notification = function (element, options) {
22
+ // Element collection
23
+ this.$element = $(element);
24
+ this.$note = $('<div class="alert"></div>');
25
+ this.options = $.extend(true, {}, $.fn.notify.defaults, options);
26
+ this._link = null;
27
+
28
+ // Setup from options
29
+ if (this.options.transition)
30
+ if (this.options.transition === 'fade')
31
+ this.$note.addClass('in').addClass(this.options.transition);
32
+ else this.$note.addClass(this.options.transition);
33
+ else this.$note.addClass('fade').addClass('in');
34
+
35
+ if (this.options.type)
36
+ this.$note.addClass('alert-' + this.options.type);
37
+ else this.$note.addClass('alert-success');
38
+
39
+ if (this.options.message)
40
+ if (typeof this.options.message === 'string')
41
+ this.$note.html(this.options.message);
42
+ else if (typeof this.options.message === 'object')
43
+ if (this.options.message.html)
44
+ this.$note.html(this.options.message.html);
45
+ else if (this.options.message.text)
46
+ this.$note.text(this.options.message.text);
47
+
48
+ if (this.options.closable)
49
+ this._link = $('<a class="close pull-right">&times;</a>'),
50
+ $(this._link).on('click', $.proxy(Notification.onClose, this)),
51
+ this.$note.prepend(this._link);
52
+
53
+ return this;
54
+ };
55
+
56
+ Notification.onClose = function () {
57
+ this.options.onClose();
58
+ $(this.$note).remove().css("display", "");
59
+ this.options.onClosed();
60
+ };
61
+
62
+ Notification.prototype.show = function () {
63
+ if (this.options.fadeOut.enabled)
64
+ this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', $.proxy(Notification.onClose, this));
65
+
66
+ this.$element.append(this.$note);
67
+ this.$note.alert();
68
+ };
69
+
70
+ Notification.prototype.hide = function () {
71
+ if (this.options.fadeOut.enabled)
72
+ this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', $.proxy(Notification.onClose, this));
73
+ else Notification.onClose.call(this);
74
+ };
75
+
76
+ $.fn.notify = function (options) {
77
+ return new Notification(this, options);
78
+ };
79
+
80
+ $.fn.notify.defaults = {
81
+ type: 'success',
82
+ closable: true,
83
+ transition: 'fade',
84
+ fadeOut: {
85
+ enabled: true,
86
+ delay: 3000
87
+ },
88
+ message: null,
89
+ onClose: function () {},
90
+ onClosed: function () {}
91
+ }
92
+ })(window.jQuery);
@@ -0,0 +1 @@
1
+ @import "bootstrap_notify/**/*"
@@ -0,0 +1,5 @@
1
+ //Customize the placement of your notifications
2
+ $notify_right: 10px !default;
3
+ $notify_left: $notify_right !default;
4
+ $notify_top: 50px !default;
5
+ $notify_bottom: $notify_top !default;
@@ -0,0 +1,138 @@
1
+ /**
2
+ * bangTidy2 Style - Ported from Growl Style
3
+ * Ported and Cleaned By Nijikokun @nijikokun
4
+ * Less By Vitaly @Laboratory
5
+ * SCSS by jclay
6
+ * Original Author Daryl Ginn
7
+ * Based On http://dribbble.com/shots/527056-Growl-Theme-2
8
+ *
9
+ * To use, for style use: bangTidy
10
+ *
11
+ */
12
+
13
+ $glossLight: rgba(0, 0, 0, 0.80);
14
+ $glossDark: rgba(0, 0, 0, 0.88);
15
+ $box_shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
16
+ $text_shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
17
+ $border_radius: 4px;
18
+
19
+ .alert-bangTidy {
20
+ box-sizing: border-box;
21
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
22
+ background: $glossLight;
23
+ background: -moz-linear-gradient(top, $glossLight 0%, $glossDark 100%);
24
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, $glossLight), color-stop(100%, $glossDark));
25
+ background: -webkit-linear-gradient(top, $glossLight 0%, $glossDark 100%);
26
+ background: -o-linear-gradient(top, $glossLight 0%, $glossDark 100%);
27
+ background: -ms-linear-gradient(top, $glossLight 0%, $glossDark 100%);
28
+ background: linear-gradient(top, $glossLight 0%, $glossDark 100%);
29
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '@{glossLight}', endColorstr = '@{glossDark}', GradientType = 0);
30
+ border: 1px solid #000;
31
+ -webkit-box-shadow: $box_shadow;
32
+ -moz-box-shadow: $box_shadow;
33
+ -o-box-shadow: $box_shadow;
34
+ box-shadow: $box_shadow;
35
+ -webkit-border-radius: $border_radius;
36
+ -moz-border-radius: $border_radius;
37
+ -o-border-radius: $border_radius;
38
+ border-radius: $border_radius;
39
+ overflow: hidden;
40
+ color: white;
41
+ -webkit-text-shadow: $text_shadow;
42
+ -moz-text-shadow: $text_shadow;
43
+ -o-text-shadow: $text_shadow;
44
+ text-shadow: $text_shadow;
45
+ -webkit-font-smoothing: antialiased;
46
+ }
47
+
48
+
49
+ @-webkit-keyframes notification {
50
+ 0% { -webkit-transform: rotateY(-90deg); opacity: 0; }
51
+ 70% { -webkit-transform: rotateY(20deg); opacity: .8; }
52
+ 90% { -webkit-transform: rotateY(-10deg); opacity: 1; }
53
+ 100% { -webkit-transform: rotateY(-0deg); opacity: 1; }
54
+ }
55
+
56
+ @-moz-keyframes notification {
57
+ 0% { -moz-transform: rotateY(-90deg); opacity: 0; }
58
+ 70% { -moz-transform: rotateY(20deg); opacity: .8; }
59
+ 90% { -moz-transform: rotateY(-10deg); opacity: 1; }
60
+ 100% { -moz-transform: rotateY(-0deg); opacity: 1; }
61
+ }
62
+
63
+ @-ms-keyframes notification {
64
+ 0% { -ms-transform: rotateY(-90deg); opacity: 0; }
65
+ 70% { -ms-transform: rotateY(20deg); opacity: .8; }
66
+ 90% { -ms-transform: rotateY(-10deg); opacity: 1; }
67
+ 100% { -ms-transform: rotateY(-0deg); opacity: 1; }
68
+ }
69
+
70
+ @-o-keyframes notification {
71
+ 0% { -o-transform: rotateY(-90deg); opacity: 0; }
72
+ 70% { -o-transform: rotateY(20deg); opacity: .8; }
73
+ 90% { -o-transform: rotateY(-10deg); opacity: 1; }
74
+ 100% { -o-transform: rotateY(-0deg); opacity: 1; }
75
+ }
76
+
77
+ keyframes notification {
78
+ 0% { transform: rotateY(-90deg); opacity: 0; }
79
+ 70% { transform: rotateY(20deg); opacity: .8; }
80
+ 90% { transform: rotateY(-10deg); opacity: 1; }
81
+ 100% { transform: rotateY(-0deg); opacity: 1; }
82
+ }
83
+
84
+ .notifications > div {
85
+ -webkit-animation: notification .75s linear;
86
+ -moz-animation: notification .75s linear;
87
+ -ms-animation: notification .75s linear;
88
+ -o-animation: notification .75s linear;
89
+ animation: notification .75s linear;
90
+ }
91
+
92
+ .alert-blackgloss:before {
93
+ background: -webkit-gradient(linear, 0% -16.5%, 16.5% -100%, from(rgba(255,255,255,.0)), to(rgba(255,255,255,.6)), color-stop(.99,rgba(255,255,255,.2)),color-stop(.5,rgba(255,255,255,.0))) no-repeat;
94
+ -webkit-mask-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,.5)), color-stop(.8,rgba(255,255,255,.0)));
95
+ position: absolute;
96
+ content: '.';
97
+ line-height: 0;
98
+ top: 0;
99
+ right: 0;
100
+ bottom: 0;
101
+ left: 0;
102
+ display: block;
103
+ overflow: hidden;
104
+ text-indent: -99999px;
105
+ -webkit-border-radius: 5px;
106
+ }
107
+
108
+ .alert-blackgloss {
109
+ background: rgba(0,0,0,1);
110
+ -webkit-box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 1px rgba(255,255,255,.1);
111
+ -moz-box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 1px rgba(255,255,255,.1);
112
+ -ms-box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 1px rgba(255,255,255,.1);
113
+ -o-box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 1px rgba(255,255,255,.1);
114
+ box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 1px rgba(255,255,255,.1);
115
+ border: 1px solid rgba(0,0,0,.95);
116
+ -webkit-border-radius: 5px;
117
+ -moz-border-radius: 5px;
118
+ -ms-border-radius: 5px;
119
+ -o-border-radius: 5px;
120
+ border-radius: 5px;
121
+ -webkit-font-smoothing: antialiased;
122
+ text-shadow: 0 1px 2px rgba(0,0,0,.5);
123
+ color: #fff;
124
+ -webkit-transform: rotateY(-0deg);
125
+ -moz-transform: rotateY(-0deg);
126
+ -o-transform: rotateY(-0deg);
127
+ transform: rotateY(-0deg);
128
+ position: relative;
129
+ background-clip: padding-box;
130
+ }
131
+
132
+ .alert-blackgloss .close {
133
+ position: relative;
134
+ top: -3px;
135
+ right: -25px;
136
+ color: #fff;
137
+ content: 'x';
138
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Bootstrap-notify.css.scss
3
+ *
4
+ * @author Vitaly @Laboratory
5
+ * @author Nijiko Yonskai
6
+ * @copyright 2012 Vitaly
7
+ * @copyright 2013 Nijiko Yonskai
8
+ */
9
+
10
+ @import "variables";
11
+
12
+ .notifications {
13
+ position: fixed;
14
+
15
+ &.top-right {
16
+ right: $notify_right;
17
+ top: $notify_top;
18
+ }
19
+
20
+ &.top-left {
21
+ left: $notify_left;
22
+ top: $notify_top;
23
+ }
24
+
25
+ &.bottom-left {
26
+ left: $notify_left;
27
+ bottom: $notify_bottom;
28
+ }
29
+
30
+ &.bottom-right {
31
+ right: $notify_right;
32
+ bottom: $notify_bottom;
33
+ }
34
+
35
+ > div {
36
+ position: relative;
37
+ z-index: 9999;
38
+ margin: 5px 0px;
39
+ }
40
+
41
+ &.center {
42
+ top: 48%;
43
+ left: 0;
44
+ width: 100%;
45
+
46
+ > div {
47
+ margin: 5px auto;
48
+ width: 20%;
49
+ text-align: center;
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,4 @@
1
+ require 'bootstrap_notify/engine'
2
+
3
+ module BootstrapNotify
4
+ end
@@ -0,0 +1,5 @@
1
+ module BootstrapNotify
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace BootstrapNotify
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module BootstrapNotify
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bootstrap_notify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Gorbunov
8
+ - Joel Clay
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-09-23 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.2.8
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 3.2.8
28
+ - !ruby/object:Gem::Dependency
29
+ name: bootstrap-sass
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: jquery-rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: BootstrapNotify makes it easy to drop in beautiful flash notifications
57
+ in Rails!
58
+ email:
59
+ - lexgorbunov@gmail.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - MIT-LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - app/assets/javascripts/bootstrap_notify.js
68
+ - app/assets/javascripts/bootstrap_notify/bootstrap-notify.js
69
+ - app/assets/stylesheets/bootstrap_notify.css.scss
70
+ - app/assets/stylesheets/bootstrap_notify/_variables.css.scss
71
+ - app/assets/stylesheets/bootstrap_notify/alert-bangtidy.css.scss
72
+ - app/assets/stylesheets/bootstrap_notify/bootstrap-notify.css.scss
73
+ - lib/bootstrap_notify.rb
74
+ - lib/bootstrap_notify/engine.rb
75
+ - lib/bootstrap_notify/version.rb
76
+ homepage:
77
+ licenses: []
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.2.2
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: BootstrapNotify makes it easy to drop in beautiful flash notifications in
99
+ Rails!
100
+ test_files: []