notification-cis 0.0.4

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.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ notification-cis (0.0.1)
5
+ jquery-rails
6
+ railties (~> 3.1)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionpack (3.2.14)
12
+ activemodel (= 3.2.14)
13
+ activesupport (= 3.2.14)
14
+ builder (~> 3.0.0)
15
+ erubis (~> 2.7.0)
16
+ journey (~> 1.0.4)
17
+ rack (~> 1.4.5)
18
+ rack-cache (~> 1.2)
19
+ rack-test (~> 0.6.1)
20
+ sprockets (~> 2.2.1)
21
+ activemodel (3.2.14)
22
+ activesupport (= 3.2.14)
23
+ builder (~> 3.0.0)
24
+ activesupport (3.2.14)
25
+ i18n (~> 0.6, >= 0.6.4)
26
+ multi_json (~> 1.0)
27
+ builder (3.0.4)
28
+ erubis (2.7.0)
29
+ hike (1.2.3)
30
+ i18n (0.6.5)
31
+ journey (1.0.4)
32
+ jquery-rails (3.0.4)
33
+ railties (>= 3.0, < 5.0)
34
+ thor (>= 0.14, < 2.0)
35
+ json (1.8.1)
36
+ multi_json (1.8.2)
37
+ rack (1.4.5)
38
+ rack-cache (1.2)
39
+ rack (>= 0.4)
40
+ rack-ssl (1.3.3)
41
+ rack
42
+ rack-test (0.6.2)
43
+ rack (>= 1.0)
44
+ railties (3.2.14)
45
+ actionpack (= 3.2.14)
46
+ activesupport (= 3.2.14)
47
+ rack-ssl (~> 1.3.2)
48
+ rake (>= 0.8.7)
49
+ rdoc (~> 3.4)
50
+ thor (>= 0.14.6, < 2.0)
51
+ rake (10.1.0)
52
+ rdoc (3.12.2)
53
+ json (~> 1.4)
54
+ sprockets (2.2.2)
55
+ hike (~> 1.2)
56
+ multi_json (~> 1.0)
57
+ rack (~> 1.0)
58
+ tilt (~> 1.1, != 1.3.0)
59
+ thor (0.18.1)
60
+ tilt (1.4.1)
61
+
62
+ PLATFORMS
63
+ ruby
64
+
65
+ DEPENDENCIES
66
+ notification-cis!
@@ -0,0 +1,46 @@
1
+ #notification-cis
2
+
3
+ This gem is inspired by the notifications introduced in Windows 8.
4
+
5
+ Features
6
+ 1. Notifications slide in and out from the upper right corner of the page
7
+ 2. Configurable life span of the notification
8
+ 3. Option to display a heading
9
+ 4. Theme options (see CSS for built in themes)
10
+ 5. Ability to make the notification sticky
11
+
12
+
13
+ ### INSTALLTION
14
+
15
+ First thing you need to do is the installation , you can follow the below mentioned steps to install the gem inside your rails application.
16
+ You need to add sudo if you are not using rvm(ruby version manager)
17
+
18
+
19
+ Add this following line in your Gemfile.
20
+ ```
21
+ gem 'notification-cis'
22
+ ```
23
+
24
+ Then run,
25
+
26
+ ```
27
+ bundle install
28
+ ```
29
+ Run the generator to create the initial files.
30
+
31
+ ```
32
+ rails g notification-cis:install
33
+ ```
34
+
35
+
36
+ Then add the below line in application.html.erb
37
+
38
+ ```rhtml
39
+ <% = flash_helper(flash)%>
40
+ ```
41
+
42
+ ### Reference Site
43
+
44
+ For more information you can refer to following site:
45
+
46
+ <a href="http://jquery-plugins.net/tag/notification">notification</a>
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,113 @@
1
+ /*
2
+ * jQuery Notifications plugin 1.1
3
+ *
4
+ * http://programmingmind.com
5
+ *
6
+ * Copyright (c) 2009 David Ang
7
+ *
8
+ *
9
+ * Dual licensed under the MIT and GPL licenses:
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ * http://www.gnu.org/licenses/gpl.html
12
+ *
13
+ * Version Changes
14
+ *
15
+ * 1.1 8/17/2008
16
+ * - Allow users to choose between slide or fade effect
17
+ * - Fixed fadeSpeed option settings
18
+ *
19
+ * 1.0 8/9/2008
20
+ * - Initial release
21
+ */
22
+ (function($){
23
+ var template;
24
+ var counter = 0;
25
+
26
+ $.notifications = function(msg, options) {
27
+ counter++;
28
+
29
+ msg = "<br/>" +msg ;
30
+
31
+ var settings = $.extend({}, $.notifications.defaults, options);
32
+
33
+ if (!template) {
34
+ template = $('<div id="jquery-notifications"></div>').appendTo(document.body);
35
+ }
36
+
37
+ var n = $( '<div class="' + settings.type + '" id="jquery-notifications-' + counter + '">' + msg + '</div>').hide().appendTo("#jquery-notifications");
38
+ if( settings.effect == "fade" ) {
39
+ n.fadeIn( settings.fadeSpeed );
40
+ } else {
41
+ n.slideDown( settings.fadeSpeed );
42
+ }
43
+
44
+ if (settings.stick) {
45
+ var close = $('<a href="javascript:void(0);">' + settings.close + '</a>').click(function() {
46
+ if (settings.effect == "fade") {
47
+ $(this.parentNode).fadeOut( settings.fadeSpeed, function() {
48
+ $(this).remove();
49
+ });
50
+ }
51
+ else {
52
+ $(this.parentNode).slideUp( settings.fadeSpeed, function() {
53
+ $(this).remove();
54
+ });
55
+ }
56
+ });
57
+ close.appendTo(n);
58
+ }
59
+
60
+ if (!settings.stick) {
61
+ var notificationsDelayer = delayTimer(settings.timeout);
62
+ notificationsDelayer(update, { counter: counter, effect: settings.effect, fadeSpeed : settings.fadeSpeed } );
63
+ }
64
+ };
65
+
66
+ $.notifications.success = function( msg, options ){
67
+ return $.notifications( '<img src="/assets/notification_top_ok.png" style="vertical-align: middle; "/> '+msg, $.extend( {}, options, { type : "success"}) );
68
+ };
69
+
70
+ $.notifications.error = function( msg, options ){
71
+ return $.notifications( '<img src="/assets/notification_top_error.png" style="vertical-align: middle; "/> '+msg, $.extend( { }, options, { type : "error" }) );
72
+ };
73
+
74
+ $.notifications.warning = function( msg, options ){
75
+ return $.notifications( '<img src="/assets/notification_top_alert.png" style="vertical-align: middle; "/> '+msg, $.extend( {}, options, { type : "warning" }) );
76
+ };
77
+
78
+ function update(params) {
79
+ if (params.effect == "fade") {
80
+ $("#jquery-notifications-" + params.counter).fadeOut( params.fadeSpeed, function(){
81
+ $(this).remove();
82
+ });
83
+ } else {
84
+ $("#jquery-notifications-" + params.counter).slideUp( params.fadeSpeed, function(){
85
+ $(this).remove();
86
+ });
87
+ }
88
+ }
89
+
90
+ function delayTimer(delay) {
91
+ var timer;
92
+ return function(fn, params) {
93
+ timer = clearTimeout(timer);
94
+ if (fn)
95
+ timer = setTimeout(function() {
96
+ fn(params);
97
+ }, delay);
98
+ return timer;
99
+ };
100
+ }
101
+
102
+ $.notifications.defaults = {
103
+ type: "notice",
104
+ timeout: 5000,
105
+ stick: false,
106
+ fadeSpeed : 800,
107
+ close : "x",
108
+ effect : "bottom"
109
+ };
110
+
111
+ $.n = $.notifications;
112
+
113
+ })(jQuery);
@@ -0,0 +1,11 @@
1
+ /* jQuery Notifications plugin - http://programmingmind.com */
2
+ /* notification container */
3
+ #jquery-notifications {position: fixed;width: 100%; left: 0; top: 0;opacity:0.8;font-size:20px;}
4
+ /* common style properties for all the notification messages */
5
+ #jquery-notifications div.notice, #jquery-notifications div.success, #jquery-notifications div.warning, #jquery-notifications div.error {margin: 0; padding: 5px; height:80px; text-align:center;padding-left: 10px; border-bottom: 2px solid}
6
+ #jquery-notifications div.notice {background:#1f1f1f; color:#FFFFFF; border-color:#eae9e4}
7
+ #jquery-notifications div.success {background:#1f1f1f; color:#FFFFFF; border-color:#eae9e4}
8
+ #jquery-notifications div.warning {background:#1f1f1f; color:#FFFFFF; border-color:#eae9e4}
9
+ #jquery-notifications div.error {background:#1f1f1f; color:#FFFFFF; border-color:#eae9e4}
10
+ /* style property for the close text */
11
+ #jquery-notifications div > a {position:absolute; right: 0; margin-right:10px; color: #000000; text-decoration:none; border: 1px solid black; padding-right: 5px; padding-left: 5px}`
@@ -0,0 +1,54 @@
1
+ require 'rails'
2
+
3
+ if ::Rails.version < "3.1" || !::Rails.application.config.assets.enabled
4
+ module NotificationCis
5
+ module Generators
6
+ class InstallGenerator < ::Rails::Generators::Base
7
+
8
+ desc "This generator installs Jquery , CSS and Images"
9
+ source_root File.expand_path('../../../../../app/assets', __FILE__)
10
+
11
+ def copy_jquery_nested
12
+ copy_file "javascripts/jquery.notifications.min.js", "public/javascripts/jquery.notifications.min.js"
13
+ copy_file "stylesheets/jquery.notifications.css", "public/stylesheets/jquery.notifications.css"
14
+ copy_file "images/notification_top_alert.png", "public/images/notification_top_alert.png"
15
+ copy_file "images/notification_top_error.png", "public/images/notification_top_error.png"
16
+ copy_file "images/notification_top_ok.png", "public/images/notification_top_ok.png"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ else
22
+ module NotificationCis
23
+ module Generators
24
+ class InstallGenerator < ::Rails::Generators::Base
25
+ desc "This generator installs Jquery , CSS and Images"
26
+ source_root File.expand_path('../../../../../app/assets', __FILE__)
27
+ def add_assets
28
+ if detect_js_format.nil?
29
+ copy_file "images/notification_top_alert.png", "app/assets/images/notification_top_alert.png"
30
+ copy_file "images/notification_top_error.png", "app/assets/images/notification_top_error.png"
31
+ copy_file "images/notification_top_ok.png", "app/assets/images/notification_top_ok.png"
32
+ copy_file "javascripts/jquery.notifications.min.js", "app/assets/javascripts/jquery.nested.min.js"
33
+ else
34
+ insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require jquery.notifications.min\n", :after => "jquery_ujs\n"
35
+ end
36
+ if detect_css_format.nil?
37
+ copy_file "stylesheets/jquery.notifications.css", "app/assets/stylesheets/jquery.notifications.css"
38
+ else
39
+ insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "#{detect_css_format[1]} require jquery.notifications\n", :after => "require_self\n"
40
+ end
41
+
42
+ end
43
+
44
+ def detect_js_format
45
+ return ['.js.coffee', '#='] if File.exist?('app/assets/javascripts/application.js.coffee')
46
+ return ['.js', '//='] if File.exist?('app/assets/javascripts/application.js')
47
+ end
48
+ def detect_css_format
49
+ return ['.css', '*='] if File.exist?('app/assets/stylesheets/application.css')
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,12 @@
1
+ module NotificationCis
2
+ end
3
+
4
+
5
+ require "notification_cis/rails" if defined?(Rails)
6
+
7
+
8
+
9
+
10
+
11
+
12
+
@@ -0,0 +1,3 @@
1
+ require 'notification_cis/rails'
2
+ require 'notification_cis/rails/engine' if ::Rails.version >= '3.1'
3
+ require 'notification_cis/rails/railtie'
@@ -0,0 +1,6 @@
1
+ module NotificationCis
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ require 'notification_cis/view_helpers'
2
+ module NotificationCis
3
+ class Railtie < ::Rails::Railtie
4
+ initializer "notification_cis.view_helpers" do
5
+ ActionView::Base.send :include, ViewHelpers
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,21 @@
1
+ module NotificationCis
2
+ module ViewHelpers
3
+ def flash_helper(flash_message)
4
+ messages = "<script type=\"text/javascript\">"
5
+ if flash_message[:notice]
6
+ messages += "$.n.success(\"#{ flash_message[:notice] }\");"
7
+ end
8
+ if flash_message[:error]
9
+ messages += "$.n.error(\"#{ flash_message[:error] }\");"
10
+ end
11
+ if flash_message[:success]
12
+ messages += "$.n.success(\"#{ flash_message[:success]}\");"
13
+ end
14
+ if flash_message[:alert]
15
+ messages += "$.n.warning(\"#{ flash_message[:alert]}\");"
16
+ end
17
+ messages += "</script>"
18
+ messages.html_safe
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: notification-cis
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mohan Salvi
9
+ - CISROR Team
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-10-31 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: jquery-rails
17
+ requirement: &11249820 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *11249820
26
+ - !ruby/object:Gem::Dependency
27
+ name: railties
28
+ requirement: &11249100 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *11249100
37
+ description: This gem is inspired by the notifications introduced in Windows 8.
38
+ email:
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - lib/notification_cis/view_helpers.rb
44
+ - lib/notification_cis/rails.rb
45
+ - lib/notification_cis/rails/railtie.rb
46
+ - lib/notification_cis/rails/engine.rb
47
+ - lib/notification-cis.rb
48
+ - lib/generators/notification_cis/install/install_generator.rb
49
+ - app/assets/stylesheets/jquery.notifications.css
50
+ - app/assets/images/notification_top_error.png
51
+ - app/assets/images/notification_top_ok.png
52
+ - app/assets/images/notification_top_alert.png
53
+ - app/assets/javascripts/jquery.notifications.min.js
54
+ - Rakefile
55
+ - Gemfile.lock
56
+ - Gemfile
57
+ - README.md
58
+ homepage: http://rubygems.org/gems/notification-cis
59
+ licenses:
60
+ - MIT
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.3.6
77
+ requirements: []
78
+ rubyforge_project: jquery-rails
79
+ rubygems_version: 1.8.11
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: This gem is inspired by the notifications introduced in Windows 8. Notifications
83
+ slide in and out from the upper right corner of the page. Configurable life span
84
+ of the notification.Option to display a heading. Theme options (see CSS for built
85
+ in themes).Ability to make the notification sticky
86
+ test_files: []