lazybox 0.0.6

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.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in lazybox.gemspec
4
+ gemspec
@@ -0,0 +1,77 @@
1
+ # LazyBox
2
+
3
+ Lazybox is a jQuery-based, lightbox which can display entire remote pages.
4
+ Use lazybox with rails 3.1 asset pipeline.
5
+
6
+ LazyBox implemented using only with css and jquery without images.
7
+ This is hight perfomance modal dialogs. All unpacked files take only 2.5 kb.
8
+ You never find simplest solution for popup windows.
9
+
10
+ # Installation
11
+
12
+ Add it to your Gemfile:
13
+
14
+ gem 'lazybox'
15
+
16
+ Then run `bundle install` to update your application's bundle.
17
+
18
+ Include in your `app/assets/stylesheets/application.css`:
19
+
20
+ /*
21
+ * ...
22
+ *= require lazybox
23
+ * ...
24
+ */
25
+
26
+ And in `app/assets/javascripts/application.js`:
27
+
28
+ //= require lazybox
29
+
30
+ # Usage
31
+
32
+ Include in your `app/assets/javascripts/application.js`:
33
+
34
+ $(document).ready(function() {
35
+ $('a[rel*=lazybox]').lazybox();
36
+ });
37
+
38
+ In your view:
39
+
40
+ link_to 'Lazybox', new_model_path, :rel => :lazybox
41
+
42
+ In your controller:
43
+
44
+ def new
45
+ @model = Model.new
46
+ respond_to do |format|
47
+ format.js { render :layout => false }
48
+ end
49
+ end
50
+
51
+ def create
52
+ @model = Model.create(params[:model])
53
+ end
54
+
55
+ or you can set before_filter that will disable layout for ajax requests:
56
+
57
+ before_filter proc { |controller| (controller.action_has_layout = false) if controller.request.xhr? }
58
+
59
+ def new
60
+ @model = Model.new
61
+ end
62
+
63
+ def create
64
+ @model = Model.create(params[:model])
65
+ end
66
+
67
+ `create.js.haml`
68
+
69
+ - if @model.errors.any?
70
+ $('#lazybox_body').html("#{escape_javascript(render :partial => 'form')}");
71
+ - else
72
+ $('a#lazybox_close').click();
73
+ window.location.reload();
74
+
75
+ #
76
+
77
+ Copyright© Alex Galushka
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/lazybox/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "lazybox"
6
+ s.version = Lazybox::VERSION
7
+ s.authors = ["Alex Galushka"]
8
+ s.email = ["sexmcs@gmail.com"]
9
+ s.homepage = "https://github.com/alex-galushka/lazybox"
10
+ s.summary = "Use LazyBox for popup windows with Rails"
11
+ s.description = "This is hight perfomance modal dialogs for your Rails application."
12
+ s.platform = Gem::Platform::RUBY
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.require_path = "lib"
16
+
17
+ s.add_development_dependency "rails", "~> 3.1"
18
+ end
19
+
@@ -0,0 +1,4 @@
1
+ module Lazybox
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Lazybox
2
+ VERSION = "0.0.6"
3
+ end
@@ -0,0 +1,35 @@
1
+ (function($){
2
+ $.fn.extend({
3
+ lazybox: function(options) {
4
+ this.live('click', function(e){
5
+ e.preventDefault();
6
+ c = ($.browser.msie) ? ' class="ie" ' : '';
7
+ $('body:not(:has(#lazybox_overlay))').append("<div id='lazybox_overlay' style='display:none'></div>");
8
+ $('#lazybox_overlay').fadeIn(500);
9
+ $.ajax({
10
+ url: $(this).attr('href'),
11
+ success: function(data){
12
+ $('body:not(:has(#lazybox))').append("<div id='lazybox' style=''><a id='lazybox_close'"+c+" title='close'>×</a><div id='lazybox_body'></div></div>");
13
+ $('#lazybox_body').html(data);
14
+ $('#lazybox').fadeIn(300, function(){
15
+ var x = (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop();
16
+ $(this).css({
17
+ top: ((x < 0) ? 20 : x),
18
+ left:(($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()
19
+ });
20
+ });
21
+ },
22
+ error: function(){
23
+ $('#lazybox_overlay').fadeOut(500);
24
+ }
25
+ });
26
+ });
27
+ }
28
+ });
29
+ })(jQuery);
30
+
31
+ $('#lazybox_close').live('click', function(){
32
+ $('#lazybox').fadeOut(300);
33
+ $('#lazybox_overlay').fadeOut(500);
34
+ });
35
+
@@ -0,0 +1,59 @@
1
+ #lazybox_overlay{
2
+ background: black;
3
+ position: fixed;
4
+ top: 0px;
5
+ bottom: 0px;
6
+ left: 0px;
7
+ right: 0px;
8
+ opacity: 0.3;
9
+ z-index: 100;
10
+ }
11
+
12
+ #lazybox{
13
+ position: absolute;
14
+ top: 10%;
15
+ left: 30%;
16
+ background-color: #fff;
17
+ color: #7F7F7F;
18
+ padding: 20px;
19
+ border: 1px solid #ccc;
20
+ -moz-border-radius: 10px;
21
+ -webkit-border-radius: 10px;
22
+ -khtml-border-radius: 10px;
23
+ min-width: 200px;
24
+ min-height: 100px;
25
+ border-radius: 10px;
26
+ -moz-box-shadow: 0 1px 5px #333;
27
+ -webkit-box-shadow: 0 1px 5px #333;
28
+ box-shadow: 0 1px 5px #333;
29
+ z-index: 101;
30
+ }
31
+
32
+ a#lazybox_close {
33
+ color: white;
34
+ font: bold 24px/100% Arial, Helvetica, sans-serif;
35
+ float: right;
36
+ margin-top: -35px;
37
+ margin-right: -35px;
38
+ cursor: pointer;
39
+ text-align: center;
40
+ border: 2px solid white;
41
+ width: 24px;
42
+ height: 24px;
43
+ background: black;
44
+ border-radius: 20px;
45
+ -moz-box-shadow: 0 1px 5px #333;
46
+ -webkit-box-shadow: 0 1px 5px #333;
47
+ box-shadow: 0 1px 5px #333;
48
+ }
49
+
50
+ a#lazybox_close:hover { color: black; border-color: black; background: white; }
51
+
52
+ a#lazybox_close.ie {
53
+ border: none;
54
+ margin-top: -21px;
55
+ margin-right: -21px;
56
+ background: white;
57
+ color: gray;
58
+ }
59
+ a#lazybox_close.ie:hover {color: black;}
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lazybox
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 6
10
+ version: 0.0.6
11
+ platform: ruby
12
+ authors:
13
+ - Alex Galushka
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-12-04 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 5
29
+ segments:
30
+ - 3
31
+ - 1
32
+ version: "3.1"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: This is hight perfomance modal dialogs for your Rails application.
36
+ email:
37
+ - sexmcs@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - README.md
48
+ - Rakefile
49
+ - lazybox.gemspec
50
+ - lib/lazybox.rb
51
+ - lib/lazybox/version.rb
52
+ - vendor/assets/javascripts/lazybox.js
53
+ - vendor/assets/stylesheets/lazybox.css
54
+ homepage: https://github.com/alex-galushka/lazybox
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project:
83
+ rubygems_version: 1.8.10
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Use LazyBox for popup windows with Rails
87
+ test_files: []
88
+