reveal_rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "shoulda", ">= 0"
5
+ gem "bundler"
6
+ gem "rdoc"
7
+ gem "jeweler", "~> 1.8.4"
8
+ gem "simplecov"
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.13)
5
+ i18n (= 0.6.1)
6
+ multi_json (~> 1.0)
7
+ git (1.2.5)
8
+ i18n (0.6.1)
9
+ jeweler (1.8.4)
10
+ bundler (~> 1.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ rdoc
14
+ json (1.7.7)
15
+ multi_json (1.7.3)
16
+ rake (10.0.4)
17
+ rdoc (4.0.1)
18
+ json (~> 1.4)
19
+ shoulda (3.5.0)
20
+ shoulda-context (~> 1.0, >= 1.0.1)
21
+ shoulda-matchers (>= 1.4.1, < 3.0)
22
+ shoulda-context (1.1.1)
23
+ shoulda-matchers (2.1.0)
24
+ activesupport (>= 3.0.0)
25
+ simplecov (0.7.1)
26
+ multi_json (~> 1.0)
27
+ simplecov-html (~> 0.7.1)
28
+ simplecov-html (0.7.1)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ bundler
35
+ jeweler (~> 1.8.4)
36
+ rdoc
37
+ shoulda
38
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2013 Paul Awesome Kruger and Moises Zaragoza
2
+
3
+ The Reveal plugin is licensed to use and abuse under the MIT license.
4
+ Ballin to the origional creators!
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,49 @@
1
+ # jquery-rails
2
+
3
+ jQuery! For Rails! So great.
4
+
5
+ This gem provides:
6
+
7
+ * reveal modal lib
8
+
9
+ ## Installation
10
+
11
+ Apps generated with Rails 3.1 or later include jquery-rails in the Gemfile by default. So just make a new app:
12
+
13
+ ```sh
14
+ rails new myapp
15
+ ```
16
+
17
+ If upgrading from an older version of rails, or for rails 3.0 apps,
18
+ add the jquery-rails gem to your Gemfile.
19
+
20
+ ```ruby
21
+ gem "jquery-rails"
22
+ gem "reveal_rails"
23
+ ```
24
+
25
+ And run `bundle install`. The rest of the installation depends on
26
+ whether the asset pipeline is being used.
27
+
28
+ ### Rails 3.1 or greater (with asset pipeline *enabled*)
29
+
30
+ The jquery and jquery-ujs files will be added to the asset pipeline and available for you to use. If they're not already in `app/assets/javascripts/application.js` by default, add these lines:
31
+
32
+ ```js
33
+ //= require jquery
34
+ //= require jquery_ujs
35
+ //= require jquery-ui
36
+ //= require reveal
37
+ ```
38
+
39
+ ## Contributing
40
+
41
+ Feel free to open an issue ticket if you find something that could be improved. A couple notes:
42
+
43
+ * If it's an issue pertaining to the reveal javascript, please report it to the [reveal project](http://github.com/zurb/reveal).
44
+
45
+
46
+ ## Acknowledgements
47
+
48
+ Copyright (c) 2013[Paul Kruger and Moises Zaragoza](http://miamiruby.org), released under the MIT License.
49
+ Also thanks to the [reveal project](http://github.com/zurb/reveal).
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "reveal_rails"
18
+ gem.homepage = "http://github.com/miamiruby/reveal_rails"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Reveal Modals in rails}
21
+ gem.description = %Q{Reveal Modals Gem Package}
22
+ gem.email = "paul_moises+miamiruby+mzararagoza@moiseszaragoza.com"
23
+ gem.authors = ["Paul Kruger and Moises Zaragoza"]
24
+ end
25
+ Jeweler::RubygemsDotOrgTasks.new
26
+
27
+ task :default => :test
28
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
File without changes
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'reveal_rails'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestRevealRails < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,127 @@
1
+ /*
2
+ * jQuery Reveal Plugin 1.0
3
+ * www.ZURB.com
4
+ * Copyright 2010, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+
10
+ (function ($) {
11
+ $('a[data-reveal-id]').live('click', function (event) {
12
+ event.preventDefault();
13
+ var modalLocation = $(this).attr('data-reveal-id');
14
+ $('#' + modalLocation).reveal($(this).data());
15
+ });
16
+
17
+ $.fn.reveal = function (options) {
18
+ var defaults = {
19
+ animation: 'fadeAndPop', // fade, fadeAndPop, none
20
+ animationSpeed: 300, // how fast animtions are
21
+ closeOnBackgroundClick: true, // if you click background will modal close?
22
+ dismissModalClass: 'close-reveal-modal' // the class of a button or element that will close an open modal
23
+ };
24
+ var options = $.extend({}, defaults, options);
25
+
26
+ return this.each(function () {
27
+ var modal = $(this),
28
+ topMeasure = parseInt(modal.css('top')),
29
+ topOffset = modal.height() + topMeasure,
30
+ locked = false,
31
+ modalBg = $('.reveal-modal-bg');
32
+
33
+ if (modalBg.length == 0) {
34
+ modalBg = $('<div class="reveal-modal-bg" />').insertAfter(modal);
35
+ modalBg.fadeTo('fast', 0.8);
36
+ }
37
+
38
+ function openAnimation() {
39
+ modalBg.unbind('click.modalEvent');
40
+ $('.' + options.dismissModalClass).unbind('click.modalEvent');
41
+ if (!locked) {
42
+ lockModal();
43
+ if (options.animation == "fadeAndPop") {
44
+ modal.css({'top': $(document).scrollTop() - topOffset, 'opacity': 0, 'visibility': 'visible'});
45
+ modalBg.fadeIn(options.animationSpeed / 2);
46
+ modal.delay(options.animationSpeed / 2).animate({
47
+ "top": $(document).scrollTop() + topMeasure + 'px',
48
+ "opacity": 1
49
+ }, options.animationSpeed, unlockModal);
50
+ }
51
+ if (options.animation == "fade") {
52
+ modal.css({'opacity': 0, 'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
53
+ modalBg.fadeIn(options.animationSpeed / 2);
54
+ modal.delay(options.animationSpeed / 2).animate({
55
+ "opacity": 1
56
+ }, options.animationSpeed, unlockModal);
57
+ }
58
+ if (options.animation == "none") {
59
+ modal.css({'visibility': 'visible', 'top': $(document).scrollTop() + topMeasure});
60
+ modalBg.css({"display": "block"});
61
+ unlockModal();
62
+ }
63
+ }
64
+ modal.unbind('reveal:open', openAnimation);
65
+ }
66
+ modal.bind('reveal:open', openAnimation);
67
+
68
+ function closeAnimation() {
69
+ if (!locked) {
70
+ lockModal();
71
+ if (options.animation == "fadeAndPop") {
72
+ modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
73
+ modal.animate({
74
+ "top": $(document).scrollTop() - topOffset + 'px',
75
+ "opacity": 0
76
+ }, options.animationSpeed / 2, function () {
77
+ modal.css({'top': topMeasure, 'opacity': 1, 'visibility': 'hidden'});
78
+ unlockModal();
79
+ });
80
+ }
81
+ if (options.animation == "fade") {
82
+ modalBg.delay(options.animationSpeed).fadeOut(options.animationSpeed);
83
+ modal.animate({
84
+ "opacity" : 0
85
+ }, options.animationSpeed, function () {
86
+ modal.css({'opacity': 1, 'visibility': 'hidden', 'top': topMeasure});
87
+ unlockModal();
88
+ });
89
+ }
90
+ if (options.animation == "none") {
91
+ modal.css({'visibility': 'hidden', 'top': topMeasure});
92
+ modalBg.css({'display': 'none'});
93
+ }
94
+ }
95
+ modal.unbind('reveal:close', closeAnimation);
96
+ }
97
+ modal.bind('reveal:close', closeAnimation);
98
+ modal.trigger('reveal:open');
99
+
100
+ var closeButton = $('.' + options.dismissModalClass).bind('click.modalEvent', function () {
101
+ modal.trigger('reveal:close');
102
+ });
103
+
104
+ if (options.closeOnBackgroundClick) {
105
+ modalBg.css({"cursor": "pointer"});
106
+ modalBg.bind('click.modalEvent', function () {
107
+ modal.trigger('reveal:close');
108
+ });
109
+ }
110
+
111
+ $('body').keyup(function (event) {
112
+ if (event.which === 27) { // 27 is the keycode for the Escape key
113
+ modal.trigger('reveal:close');
114
+ }
115
+ });
116
+
117
+ function unlockModal() {
118
+ locked = false;
119
+ }
120
+
121
+ function lockModal() {
122
+ locked = true;
123
+ }
124
+ });
125
+ };
126
+ })(jQuery);
127
+
@@ -0,0 +1,66 @@
1
+ /* --------------------------------------------------
2
+ Reveal Modals
3
+ -------------------------------------------------- */
4
+
5
+ .reveal-modal-bg {
6
+ position: fixed;
7
+ height: 100%;
8
+ width: 100%;
9
+ background: #000;
10
+ z-index: 100;
11
+ display: none;
12
+ top: 0;
13
+ left: 0;
14
+ }
15
+
16
+ .reveal-modal {
17
+ visibility: hidden;
18
+ top: 100px;
19
+ left: 50%;
20
+ margin-left: -300px;
21
+ width: 520px;
22
+ background: #eee url(/assets/modal-gloss.png) no-repeat -200px -80px;
23
+ position: absolute;
24
+ z-index: 101;
25
+ padding: 30px 40px 34px;
26
+ -moz-border-radius: 5px;
27
+ -webkit-border-radius: 5px;
28
+ border-radius: 5px;
29
+ -moz-box-shadow: 0 0 10px rgba(0,0,0,.4);
30
+ -webkit-box-shadow: 0 0 10px rgba(0,0,0,.4);
31
+ box-shadow: 0 0 10px rgba(0,0,0,.4);
32
+ }
33
+
34
+ .reveal-modal.small { width: 200px; margin-left: -140px;}
35
+ .reveal-modal.medium { width: 400px; margin-left: -240px;}
36
+ .reveal-modal.large { width: 600px; margin-left: -340px;}
37
+ .reveal-modal.xlarge { width: 800px; margin-left: -440px;}
38
+
39
+ .reveal-modal .close-reveal-modal {
40
+ font-size: 22px;
41
+ line-height: .5;
42
+ position: absolute;
43
+ top: 8px;
44
+ right: 11px;
45
+ color: #aaa;
46
+ text-shadow: 0 -1px 1px rbga(0,0,0,.6);
47
+ font-weight: bold;
48
+ cursor: pointer;
49
+ }
50
+ /*
51
+
52
+ NOTES
53
+
54
+ Close button entity is &#215;
55
+
56
+ Example markup
57
+
58
+ <div id="myModal" class="reveal-modal">
59
+ <h2>Awesome. I have it.</h2>
60
+ <p class="lead">Your couch. I it's mine.</p>
61
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ultrices aliquet placerat. Duis pulvinar orci et nisi euismod vitae tempus lorem consectetur. Duis at magna quis turpis mattis venenatis eget id diam. </p>
62
+ <a class="close-reveal-modal">&#215;</a>
63
+ </div>
64
+
65
+ */
66
+
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reveal_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Paul Kruger and Moises Zaragoza
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rdoc
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.4
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.4
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: Reveal Modals Gem Package
95
+ email: paul_moises+miamiruby+mzararagoza@moiseszaragoza.com
96
+ executables: []
97
+ extensions: []
98
+ extra_rdoc_files:
99
+ - LICENSE.txt
100
+ - README.md
101
+ files:
102
+ - .document
103
+ - Gemfile
104
+ - Gemfile.lock
105
+ - LICENSE.txt
106
+ - README.md
107
+ - Rakefile
108
+ - VERSION
109
+ - lib/reveal_rails.rb
110
+ - test/helper.rb
111
+ - test/test_reveal_rails.rb
112
+ - vendor/assets/images/modal-gloss.png
113
+ - vendor/assets/javascripts/reveal.js
114
+ - vendor/assets/stylesheets/reveal.css
115
+ homepage: http://github.com/miamiruby/reveal_rails
116
+ licenses:
117
+ - MIT
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ segments:
129
+ - 0
130
+ hash: -508150552742412006
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 1.8.25
140
+ signing_key:
141
+ specification_version: 3
142
+ summary: Reveal Modals in rails
143
+ test_files: []