apprise-rails 1.5

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/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in apprise-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1 @@
1
+ Apprise was created by Daniel Raftery. The project page is http://thrivingkings.com/apprise/. The site claims as of January 25, 2012 that the project is licensed under a Creative Commons Attribution-ShareAlike 2.5 Generic License. (http://creativecommons.org/licenses/by-sa/2.5/legalcode)
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # apprise-rails
2
+
3
+ This gem provides the apprise project found at https://github.com/ThrivingKings/Apprise for the Rails asset pipeline (available since Rails 3.1).
4
+
5
+ To make use of this project add the following line to 'app/assets/javascripts/application.js':
6
+
7
+ //= require apprise
8
+
9
+ and add the following line to 'app/assets/stylesheets/application.css'
10
+
11
+ *= require apprise
12
+
13
+ ### Installation
14
+
15
+ In your Gemfile, add this line:
16
+
17
+ gem "apprise-rails"
18
+
19
+ Then, run `bundle install`.
20
+
21
+ That's it!
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "apprise/rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "apprise-rails"
7
+ s.version = AppriseJS::Rails::VERSION
8
+ s.authors = ["John Colvin"]
9
+ s.email = ["colvin.john@gmail.com"]
10
+ s.homepage = "https://github.com/johncolvin/apprise-rails"
11
+ s.summary = %q{Use Apprise with Rails 3}
12
+ s.description = %q{This provides Apprise for your Rails 3 application}
13
+
14
+ s.rubyforge_project = "apprise-rails"
15
+
16
+ s.add_dependency "railties", "~> 3.1"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ end
@@ -0,0 +1 @@
1
+ require 'apprise/rails'
@@ -0,0 +1,2 @@
1
+ require 'apprise/rails/engine'
2
+ require 'apprise/rails/version'
@@ -0,0 +1,6 @@
1
+ module AppriseJS
2
+ module Rails
3
+ class Engine > ::Rails:Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module AppriseJS
2
+ module Rails
3
+ VERSION = '1.5'
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ function apprise(a,b,c){var d={confirm:false,verify:false,input:false,animate:false,textOk:"Ok",textCancel:"Cancel",textYes:"Yes",textNo:"No",position:"center"};if(b){for(var e in d){if(typeof b[e]=="undefined")b[e]=d[e]}}var f=$(document).height(),g=$(document).width(),h=$('<div class="appriseOuter"></div>'),i=$('<div class="appriseOverlay" id="aOverlay"></div>'),j=$('<div class="appriseInner"></div>'),k=$('<div class="aButtons"></div>'),l=100;i.css({height:f,width:g}).appendTo("body").fadeIn(100,function(){$(this).css("filter","alpha(opacity=70)")});h.appendTo("body");j.append(a).appendTo(h);if(b){if(b["input"]){if(typeof b["input"]=="string"){j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" value="'+b["input"]+'" /></div>')}else{j.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" /></div>')}$(".aTextbox").focus()}}j.append(k);if(b){if(b["confirm"]||b["input"]){k.append('<button value="ok">'+b["textOk"]+"</button>");k.append('<button value="cancel">'+b["textCancel"]+"</button>")}else if(b["verify"]){k.append('<button value="ok">'+b["textYes"]+"</button>");k.append('<button value="cancel">'+b["textNo"]+"</button>")}else{k.append('<button value="ok">'+b["textOk"]+"</button>")}}else{k.append('<button value="ok">Ok</button>')}h.css("left",($(window).width()-$(".appriseOuter").width())/2+$(window).scrollLeft()+"px");if(b){if(b["position"]&&b["position"]==="center"){l=(f-h.height())/2}if(b["animate"]){var m=b["animate"];if(isNaN(m)){m=400}h.css("top","-200px").show().animate({top:l},m)}else{h.css("top",l).fadeIn(200)}}else{h.css("top",l).fadeIn(200)}$(document).keydown(function(a){if(i.is(":visible")){if(a.keyCode==13){$('.aButtons > button[value="ok"]').click()}if(a.keyCode==27){$('.aButtons > button[value="cancel"]').click()}}});var n=$(".aTextbox").val();if(!n){n=false}$(".aTextbox").keyup(function(){n=$(this).val()});$(".aButtons > button").click(function(){i.remove();h.remove();if(c){$(this).text("");var a=$(this).attr("value");if(a=="ok"){if(b){if(b["input"]){c(n)}else{c(true)}}else{c(true)}}else if(a=="cancel"){c(false)}}})}
@@ -0,0 +1,125 @@
1
+ // Apprise 1.5 by Daniel Raftery
2
+ // http://thrivingkings.com/apprise
3
+ //
4
+ // Button text added by Adam Bezulski
5
+ //
6
+ // Cached jQuery variables, position center added by Josiah Ruddell
7
+
8
+ function apprise(string, args, callback) {
9
+ var default_args =
10
+ {
11
+ 'confirm': false, // Ok and Cancel buttons
12
+ 'verify': false, // Yes and No buttons
13
+ 'input': false, // Text input (can be true or string for default text)
14
+ 'animate': false, // Groovy animation (can true or number, default is 400)
15
+ 'textOk': 'Ok', // Ok button default text
16
+ 'textCancel': 'Cancel', // Cancel button default text
17
+ 'textYes': 'Yes', // Yes button default text
18
+ 'textNo': 'No', // No button default text
19
+ 'position': 'center'// position center (y-axis) any other option will default to 100 top
20
+ }
21
+
22
+ if (args) {
23
+ for (var index in default_args)
24
+ { if (typeof args[index] == "undefined") args[index] = default_args[index]; }
25
+ }
26
+
27
+ var aHeight = $(document).height(),
28
+ aWidth = $(document).width(),
29
+ apprise = $('<div class="appriseOuter"></div>'),
30
+ overlay = $('<div class="appriseOverlay" id="aOverlay"></div>'),
31
+ inner = $('<div class="appriseInner"></div>'),
32
+ buttons = $('<div class="aButtons"></div>'),
33
+ posTop = 100;
34
+
35
+ overlay.css({ height: aHeight, width: aWidth })
36
+ .appendTo('body')
37
+ .fadeIn(100,function(){$(this).css('filter','alpha(opacity=70)');});
38
+
39
+ apprise.appendTo('body');
40
+
41
+ inner.append(string)
42
+ .appendTo(apprise);
43
+
44
+
45
+
46
+ if (args) {
47
+ if (args['input']) {
48
+ if (typeof (args['input']) == 'string') {
49
+ inner.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" value="' + args['input'] + '" /></div>');
50
+ }
51
+ else {
52
+ inner.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" /></div>');
53
+ }
54
+ $('.aTextbox').focus();
55
+ }
56
+ }
57
+
58
+ inner.append(buttons);
59
+ if (args) {
60
+ if (args['confirm'] || args['input']) {
61
+ buttons.append('<button value="ok">' + args['textOk'] + '</button>');
62
+ buttons.append('<button value="cancel">' + args['textCancel'] + '</button>');
63
+ }
64
+ else if (args['verify']) {
65
+ buttons.append('<button value="ok">' + args['textYes'] + '</button>');
66
+ buttons.append('<button value="cancel">' + args['textNo'] + '</button>');
67
+ }
68
+ else { buttons.append('<button value="ok">' + args['textOk'] + '</button>'); }
69
+ }
70
+ else { buttons.append('<button value="ok">Ok</button>'); }
71
+
72
+ // position after adding buttons
73
+
74
+ apprise.css("left", ($(window).width() - $('.appriseOuter').width()) / 2 + $(window).scrollLeft() + "px");
75
+ // get center
76
+ if (args) {
77
+ if (args['position'] && args['position'] === 'center') {
78
+ posTop = (aHeight - apprise.height()) / 2;
79
+ }
80
+
81
+ if (args['animate']) {
82
+ var aniSpeed = args['animate'];
83
+ if (isNaN(aniSpeed)) { aniSpeed = 400; }
84
+ apprise.css('top', '-200px').show().animate({ top: posTop }, aniSpeed);
85
+ }
86
+ else { apprise.css('top', posTop).fadeIn(200); }
87
+ }
88
+ else { apprise.css('top', posTop).fadeIn(200); }
89
+
90
+
91
+ $(document).keydown(function (e) {
92
+ if (overlay.is(':visible')) {
93
+ if (e.keyCode == 13)
94
+ { $('.aButtons > button[value="ok"]').click(); }
95
+ if (e.keyCode == 27)
96
+ { $('.aButtons > button[value="cancel"]').click(); }
97
+ }
98
+ });
99
+
100
+ var aText = $('.aTextbox').val();
101
+ if (!aText) { aText = false; }
102
+ $('.aTextbox').keyup(function ()
103
+ { aText = $(this).val(); });
104
+
105
+ $('.aButtons > button').click(function () {
106
+ overlay.remove();
107
+ apprise.remove();
108
+ if (callback) {
109
+ $(this).text("");
110
+ var wButton = $(this).attr("value");
111
+ if (wButton == 'ok') {
112
+ if (args) {
113
+ if (args['input']) { callback(aText); }
114
+ else { callback(true); }
115
+ }
116
+ else {
117
+ callback(true);
118
+ }
119
+ }
120
+ else if (wButton == 'cancel') {
121
+ callback(false);
122
+ }
123
+ }
124
+ });
125
+ }
@@ -0,0 +1,103 @@
1
+ .appriseOverlay
2
+ {
3
+ position:fixed;
4
+ top:0;
5
+ left:0;
6
+ background:rgba(0, 0, 0, 0.3);
7
+ display:none;
8
+ }
9
+ .appriseOuter
10
+ {
11
+ background:#eee;
12
+ border:1px solid #fff;
13
+ box-shadow:0px 3px 7px #333;
14
+ -moz-box-shadow:0px 3px 7px #333;
15
+ -webkit-box-shadow:0px 3px 7px #333;
16
+ -moz-border-radius:4px;
17
+ -webkit-border-radius:4px;
18
+ border-radius:4px;
19
+ -khtml-border-radius:4px;
20
+ position:absolute;
21
+ z-index:99999999;
22
+ min-width:200px;
23
+ min-height:50px;
24
+ max-width:75%;
25
+ position:fixed;
26
+ display:none;
27
+ }
28
+ .appriseInner
29
+ {
30
+ padding:20px;
31
+ color:#333;
32
+ text-shadow:0px 1px 0px #fff;
33
+ }
34
+ .appriseInner button
35
+ {
36
+ border:1px solid #bbb;
37
+ -moz-border-radius:3px;
38
+ -webkit-border-radius:3px;
39
+ border-radius:3px;
40
+ -khtml-border-radius:3px;
41
+ background: -moz-linear-gradient(100% 100% 90deg, #eee, #d5d5d5);
42
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#eee), to(#d5d5d5));
43
+ background: -webkit-linear-gradient(#eee, #d5d5d5);
44
+ background: -o-linear-gradient(#eee, #d5d5d5);
45
+ color:#232d3d;
46
+ font-size:12px;
47
+ font-weight:bold;
48
+ padding:4px 10px;
49
+ margin:0 3px;
50
+ text-shadow:0px 1px 0px #fff;
51
+ cursor:pointer;
52
+ box-shadow:0px 1px 2px #ccc;
53
+ -moz-box-shadow:0px 1px 2px #ccc;
54
+ -webkit-box-shadow:0px 1px 2px #ccc;
55
+ }
56
+ .appriseInner button:hover
57
+ {
58
+ color:#d85054;
59
+ }
60
+ .aButtons, .aInput
61
+ {
62
+ margin:20px 10px 0px 10px;
63
+ text-align:center;
64
+ }
65
+ .aTextbox
66
+ {
67
+ border:1px solid #aaa;
68
+ -moz-border-radius:4px;
69
+ -webkit-border-radius:4px;
70
+ border-radius:4px;
71
+ -khtml-border-radius:4px;
72
+ box-shadow:0px 1px 0px #fff;
73
+ -moz-box-shadow:0px 1px 0px #fff;
74
+ -webkit-box-shadow:0px 1px 0px #fff;
75
+ width:180px;
76
+ font-size:12px;
77
+ font-weight:bold;
78
+ padding:5px 10px;
79
+ }
80
+ .no-rgba .appriseOverlay{
81
+ opacity: .30;
82
+ filter: alpha(opacity = 30) !important;
83
+ background: #000;
84
+ zoom: 1;
85
+ }
86
+ .no-borderradius .appriseOuter{
87
+ border:1px solid #888;
88
+ }
89
+ .appriseOverlay {
90
+ background-color:#222222;
91
+ border:medium none;
92
+ cursor:wait;
93
+ height:100%;
94
+ left:0;
95
+ margin:0;
96
+ padding:0;
97
+ position:fixed;
98
+ top:0;
99
+ width:100%;
100
+ z-index:1000;
101
+ filter:alpha(opacity=70);
102
+ opacity:0.70;
103
+ }
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apprise-rails
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 5
9
+ version: "1.5"
10
+ platform: ruby
11
+ authors:
12
+ - John Colvin
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-01-25 00:00:00 Z
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: railties
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ hash: 5
28
+ segments:
29
+ - 3
30
+ - 1
31
+ version: "3.1"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: This provides Apprise for your Rails 3 application
35
+ email:
36
+ - colvin.john@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE
47
+ - README.md
48
+ - Rakefile
49
+ - apprise-rails.gemspec
50
+ - lib/apprise-rails.rb
51
+ - lib/apprise/rails.rb
52
+ - lib/apprise/rails/engine.rb
53
+ - lib/apprise/rails/version.rb
54
+ - vendor/assets/javascripts/apprise-min.js
55
+ - vendor/assets/javascripts/apprise.js
56
+ - vendor/assets/stylesheets/apprise.css
57
+ homepage: https://github.com/johncolvin/apprise-rails
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
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
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ requirements: []
84
+
85
+ rubyforge_project: apprise-rails
86
+ rubygems_version: 1.8.6
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Use Apprise with Rails 3
90
+ test_files: []
91
+