g_fancybox 1.0.0
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/.document +5 -0
- data/.gitignore +23 -0
- data/LICENSE +27 -0
- data/README.rdoc +88 -0
- data/Rakefile +47 -0
- data/VERSION +1 -0
- data/g_fancybox.gemspec +95 -0
- data/lib/g_fancybox.rb +9 -0
- data/lib/g_fancybox/view_helpers.rb +83 -0
- data/lib/generators/g_fancybox/install/install_generator.rb +49 -0
- data/lib/generators/templates/javascripts/guilded.fancybox.js +23 -0
- data/lib/generators/templates/javascripts/guilded.fancybox.min.js +1 -0
- data/lib/generators/templates/javascripts/jquery/jquery-easing-1.3.pack.js +1 -0
- data/lib/generators/templates/javascripts/jquery/jquery-fancybox-1.3.1.js +1077 -0
- data/lib/generators/templates/javascripts/jquery/jquery-fancybox-1.3.1.pack.js +28 -0
- data/lib/generators/templates/javascripts/jquery/jquery-mousewheel-3.0.2.pack.js +2 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default.css +363 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/blank.gif +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_close.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_loading.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_nav_left.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_nav_right.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_e.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_n.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_ne.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_nw.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_s.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_se.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_sw.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_w.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_left.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_main.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_over.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_right.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancybox-x.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancybox-y.png +0 -0
- data/lib/generators/templates/stylesheets/guilded/fancybox/default/fancybox.png +0 -0
- data/spec/g_fancybox_spec.rb +5 -0
- data/spec/generators/g_fancybox/install/install_generator_spec.rb +52 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +12 -0
- metadata +169 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
The Fancybox JavaScript library is Copyright (c) 2008 - 2010 Janis Skarnelis.
|
2
|
+
Please see http://fancybox.net/ for details.
|
3
|
+
|
4
|
+
The jQuery Easing Library is Copyright (c) 2008 George McGinley Smith.
|
5
|
+
|
6
|
+
---------------------------------------------------------------------------------------
|
7
|
+
|
8
|
+
Copyright (c) 2010 C. Jason Harrelson (midas)
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
11
|
+
a copy of this software and associated documentation files (the
|
12
|
+
"Software"), to deal in the Software without restriction, including
|
13
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
14
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
15
|
+
permit persons to whom the Software is furnished to do so, subject to
|
16
|
+
the following conditions:
|
17
|
+
|
18
|
+
The above copyright notice and this permission notice shall be
|
19
|
+
included in all copies or substantial portions of the Software.
|
20
|
+
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
22
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
24
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
25
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
26
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
27
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
= g_fancybox
|
2
|
+
|
3
|
+
https://github.com/midas/g_fancybox
|
4
|
+
|
5
|
+
|
6
|
+
== DESCRIPTION
|
7
|
+
|
8
|
+
A Guilded (http://github.com/midas/guilded/tree/master) Rails component that generates the code necessary to easily implement
|
9
|
+
the fancybox (http://http://fancybox.net/) lightbox effect.
|
10
|
+
|
11
|
+
|
12
|
+
== COMPATABILITY
|
13
|
+
|
14
|
+
* Ruby 1.9
|
15
|
+
* Ruby 1.8
|
16
|
+
* Rails 3
|
17
|
+
* Rails 2
|
18
|
+
|
19
|
+
|
20
|
+
== INSTALL
|
21
|
+
|
22
|
+
gem install g_fancybox
|
23
|
+
|
24
|
+
|
25
|
+
== INSTALL FOR RAILS
|
26
|
+
|
27
|
+
Configure the Gem for use:
|
28
|
+
|
29
|
+
gem 'g_fancybox' # Rails 3
|
30
|
+
config.gem 'g_fancybox' # Rails 2
|
31
|
+
|
32
|
+
Install the Gem:
|
33
|
+
|
34
|
+
bundle install # Rails 3
|
35
|
+
rake gems:install # Rails 2
|
36
|
+
|
37
|
+
Generate:
|
38
|
+
|
39
|
+
rails generate g_fancybox:install # Rails 3
|
40
|
+
script/generate g_fancybox_install # Rails 2 (WIP)
|
41
|
+
|
42
|
+
|
43
|
+
== USAGE:
|
44
|
+
|
45
|
+
Simplest case:
|
46
|
+
|
47
|
+
<%= link_to 'Test', 'http://google.com', :class => 'fancybox' %>
|
48
|
+
<%= g_fancybox :fancybox => { :type => 'iframe' } %>
|
49
|
+
|
50
|
+
or
|
51
|
+
|
52
|
+
<%= g_fancybox_link_to 'Test', 'http://google.com', :fancybox => { :type => 'iframe' } %>
|
53
|
+
|
54
|
+
A more complex case:
|
55
|
+
|
56
|
+
<%= g_fancybox_link_to 'Test', 'http://google.com', :fancybox => { :type => 'iframe',
|
57
|
+
:transitionIn => 'elastic',
|
58
|
+
:transitionOut => 'elastic',
|
59
|
+
:easingIn => 'easeOutBack',
|
60
|
+
:easingOut => 'easeInBack',
|
61
|
+
:speedIn => 450 } %>
|
62
|
+
|
63
|
+
g_fancybox will pass any of the API options listed at http://fancybox.net/api to the fancybox JavaScript code for you
|
64
|
+
when you use the :fancybox option. Notice that the options inside the :fancybox entry must be camel case, synonymous
|
65
|
+
with accepted JavaScript practices.
|
66
|
+
|
67
|
+
See http://gsgd.co.uk/sandbox/jquery/easing/ for easing options.
|
68
|
+
|
69
|
+
|
70
|
+
== Note on Patches/Pull Requests
|
71
|
+
|
72
|
+
* Fork the project.
|
73
|
+
* Make your feature addition or bug fix.
|
74
|
+
* Add tests for it. This is important so I don't break it in a
|
75
|
+
future version unintentionally.
|
76
|
+
* Commit, do not mess with rakefile, version, or history.
|
77
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
78
|
+
* Send me a pull request. Bonus points for topic branches.
|
79
|
+
|
80
|
+
|
81
|
+
== Copyrights
|
82
|
+
|
83
|
+
The Fancybox JavaScript library is Copyright (c) 2008 - 2010 Janis Skarnelis.
|
84
|
+
Please see http://fancybox.net/ for details.
|
85
|
+
|
86
|
+
The jQuery Easing Library is Copyright (c) 2008 George McGinley Smith.
|
87
|
+
|
88
|
+
Copyright (c) 2010 C. Jason Harrelson (midas). See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "g_fancybox"
|
8
|
+
gem.summary = %Q{A Guilded component for the Fancybox JavaScript library.}
|
9
|
+
gem.description = %Q{A Guilded component for the Fancybox JavaScript library that makes Rails development with Fancybox a breeze.}
|
10
|
+
gem.email = "jason@lookforwardenterprises.com"
|
11
|
+
gem.homepage = "http://github.com/midas/g_fancybox"
|
12
|
+
gem.authors = ["C. Jason Harrelson (midas)"]
|
13
|
+
gem.add_dependency "rails", ">= 2.3"
|
14
|
+
gem.add_dependency "guilded", ">= 1.0"
|
15
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
16
|
+
gem.add_development_dependency "yard", ">= 0"
|
17
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
end
|
19
|
+
Jeweler::GemcutterTasks.new
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'spec/rake/spectask'
|
25
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
27
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
+
end
|
29
|
+
|
30
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
31
|
+
spec.libs << 'lib' << 'spec'
|
32
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
33
|
+
spec.rcov = true
|
34
|
+
end
|
35
|
+
|
36
|
+
task :spec => :check_dependencies
|
37
|
+
|
38
|
+
task :default => :spec
|
39
|
+
|
40
|
+
begin
|
41
|
+
require 'yard'
|
42
|
+
YARD::Rake::YardocTask.new
|
43
|
+
rescue LoadError
|
44
|
+
task :yardoc do
|
45
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
46
|
+
end
|
47
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/g_fancybox.gemspec
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{g_fancybox}
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["C. Jason Harrelson (midas)"]
|
12
|
+
s.date = %q{2010-11-13}
|
13
|
+
s.description = %q{A Guilded component for the Fancybox JavaScript library that makes Rails development with Fancybox a breeze.}
|
14
|
+
s.email = %q{jason@lookforwardenterprises.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"g_fancybox.gemspec",
|
27
|
+
"lib/g_fancybox.rb",
|
28
|
+
"lib/g_fancybox/view_helpers.rb",
|
29
|
+
"lib/generators/g_fancybox/install/install_generator.rb",
|
30
|
+
"lib/generators/templates/javascripts/guilded.fancybox.js",
|
31
|
+
"lib/generators/templates/javascripts/guilded.fancybox.min.js",
|
32
|
+
"lib/generators/templates/javascripts/jquery/jquery-easing-1.3.pack.js",
|
33
|
+
"lib/generators/templates/javascripts/jquery/jquery-fancybox-1.3.1.js",
|
34
|
+
"lib/generators/templates/javascripts/jquery/jquery-fancybox-1.3.1.pack.js",
|
35
|
+
"lib/generators/templates/javascripts/jquery/jquery-mousewheel-3.0.2.pack.js",
|
36
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default.css",
|
37
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/blank.gif",
|
38
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_close.png",
|
39
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_loading.png",
|
40
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_nav_left.png",
|
41
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_nav_right.png",
|
42
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_e.png",
|
43
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_n.png",
|
44
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_ne.png",
|
45
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_nw.png",
|
46
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_s.png",
|
47
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_se.png",
|
48
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_sw.png",
|
49
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_shadow_w.png",
|
50
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_left.png",
|
51
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_main.png",
|
52
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_over.png",
|
53
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancy_title_right.png",
|
54
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancybox-x.png",
|
55
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancybox-y.png",
|
56
|
+
"lib/generators/templates/stylesheets/guilded/fancybox/default/fancybox.png",
|
57
|
+
"spec/g_fancybox_spec.rb",
|
58
|
+
"spec/generators/g_fancybox/install/install_generator_spec.rb",
|
59
|
+
"spec/spec.opts",
|
60
|
+
"spec/spec_helper.rb"
|
61
|
+
]
|
62
|
+
s.homepage = %q{http://github.com/midas/g_fancybox}
|
63
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
64
|
+
s.require_paths = ["lib"]
|
65
|
+
s.rubygems_version = %q{1.3.7}
|
66
|
+
s.summary = %q{A Guilded component for the Fancybox JavaScript library.}
|
67
|
+
s.test_files = [
|
68
|
+
"spec/g_fancybox_spec.rb",
|
69
|
+
"spec/generators/g_fancybox/install/install_generator_spec.rb",
|
70
|
+
"spec/spec_helper.rb"
|
71
|
+
]
|
72
|
+
|
73
|
+
if s.respond_to? :specification_version then
|
74
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
75
|
+
s.specification_version = 3
|
76
|
+
|
77
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
78
|
+
s.add_runtime_dependency(%q<rails>, [">= 2.3"])
|
79
|
+
s.add_runtime_dependency(%q<guilded>, [">= 1.0"])
|
80
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
81
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
82
|
+
else
|
83
|
+
s.add_dependency(%q<rails>, [">= 2.3"])
|
84
|
+
s.add_dependency(%q<guilded>, [">= 1.0"])
|
85
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
86
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
87
|
+
end
|
88
|
+
else
|
89
|
+
s.add_dependency(%q<rails>, [">= 2.3"])
|
90
|
+
s.add_dependency(%q<guilded>, [">= 1.0"])
|
91
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
92
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
data/lib/g_fancybox.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'g_fancybox/view_helpers'
|
2
|
+
|
3
|
+
module GFancybox
|
4
|
+
VERSION = File.read( "#{File.dirname __FILE__}/../VERSION" ).chomp
|
5
|
+
end
|
6
|
+
|
7
|
+
if defined? ActionView::Base
|
8
|
+
ActionView::Base.send( :include, GFancybox::ViewHelpers ) unless ActionView::Base.include?( GFancybox::ViewHelpers )
|
9
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module GFancybox
|
2
|
+
module ViewHelpers
|
3
|
+
# Adds the JavaScript and CSS to attach to jQuery DOM elements of given selector.
|
4
|
+
#
|
5
|
+
# *Options*
|
6
|
+
# +:selector+ - The jQuery selector used to select the elements to apply fancy box fuctionality to.
|
7
|
+
# +:padding+ - Space between FancyBox wrapper and content - Default value 10.
|
8
|
+
# +:margin+ - Space between viewport and FancyBox wrapper - Default value 20.
|
9
|
+
# +:opacity+ - When true, transparency of content is changed for elastic transitions - Default value false.
|
10
|
+
# +:modal+ - When true, 'overlayShow' is set to 'true' and 'hideOnOverlayClick', 'hideOnContentClick', 'enableEscapeButton', 'showCloseButton' are set to 'false'. - Default value false.
|
11
|
+
# :+cyclic+ - When true, galleries will be cyclic, allowing you to keep pressing next/back. - Default value false.
|
12
|
+
# +:scrolling+ - Set the overflow CSS property to create or hide scrollbars. Can be set to 'auto', 'yes', or 'no'. - Defaults value 'auto'.
|
13
|
+
# +:width+ - Width for content types 'iframe' and 'swf'. Also set for inline content if 'autoDimensions' is set to 'false'. - Default value 560.
|
14
|
+
# +:height+ - Height for content types 'iframe' and 'swf'. Also set for inline content if 'autoDimensions' is set to 'false'. - Default value 340.
|
15
|
+
# +:autoScale+ - If true, FancyBox is scaled to fit in viewport - Default value true.
|
16
|
+
# +:autoDimensions+ - For inline and ajax views, resizes the view to the element recieves. Make sure it has dimensions otherwise this will give unexpected results. - Default value true.
|
17
|
+
# +:centerOnScroll+ - When true, FancyBox is centered while scrolling page. - Default value false.
|
18
|
+
# +:ajax+ - Ajax options. Note: 'error' and 'success' will be overwritten by FancyBox. - Default value {}.
|
19
|
+
# +:swf+ - Flashvars to put on the swf object. - Default value {wmode: 'transparent'}.
|
20
|
+
# +:hideOnOverlayClick+ - Toggle if clicking the overlay should close FancyBox. - Default value true.
|
21
|
+
# +:hideOnContentClick+ - Toggle if clicking the content should close FancyBox. - Default value flase.
|
22
|
+
# +:overlayShow+ - Toggle overlay. - Default value true.
|
23
|
+
# +:overlayOpacity+ - Opacity of the overlay (from 0 to 1). - Default value 0.7.
|
24
|
+
# +:overlayColor+ - Color of the overlay - Default value '#111'.
|
25
|
+
# +:titleShow+ - Toggle title. - Default value true.
|
26
|
+
# +:titlePosition+ - The position of title. Can be set to 'outside', 'inside' or 'over'. - Default value 'outside'.
|
27
|
+
# +:titleFormat+ - Callback to customize title area. You can set any html - custom image counter or even custom navigation. - Dfault value null.
|
28
|
+
# +:transitionIn+ - The show transition type. Can be set to 'elastic', 'fade' or 'none'. - Default value 'fade'.
|
29
|
+
# +:transitionOut+ - The hide transition type. Can be set to 'elastic', 'fade' or 'none'. - Default value 'fade'.
|
30
|
+
# +:speedIn+ - Speed of the fade and elastic show transition, in milliseconds. - Default value 300.
|
31
|
+
# +:speedOut+ - Speed of the fade and elastic hide transition, in milliseconds. - Default value 300.
|
32
|
+
# +:changeSpeed+ - Speed of resizing when changing gallery items, in milliseconds. - Default 300.
|
33
|
+
# +:changeFade+ - Speed of the content fading while changing gallery items. - Default value 'fast'.
|
34
|
+
# +:easingIn+ - Easing used for show elastic animations. Default value 'swing'.
|
35
|
+
# +:easingOut+ - Easing used for hide elastic animations. Default value 'swing'.
|
36
|
+
# +:showCloseButton+ - Toggle close button. - Default value true.
|
37
|
+
# +:showNavArrows+ - Toggle navigation arrows. - Default value true.
|
38
|
+
# +:enableEscapeButton+ - Toggle if pressing Esc button closes FancyBox. - Default value true
|
39
|
+
#
|
40
|
+
# *Advanced Options*
|
41
|
+
# +:type+ - Forces content type. Can be set to 'image', 'ajax', 'iframe', 'swf' or 'inline'.
|
42
|
+
# +:href+ - Forces content source.
|
43
|
+
# +:Forces content source+ - Forces content source.
|
44
|
+
# +:content+ - Forces content (can be any html data).
|
45
|
+
# +:orig - Sets object whos position and dimensions will be used by 'elastic' transition.
|
46
|
+
# +:index+ - Custom start index of manually created gallery.
|
47
|
+
#
|
48
|
+
def g_fancybox( options={} )
|
49
|
+
options[:id] ||= 'fancy-box'
|
50
|
+
options[:selector] ||= '.fancybox'
|
51
|
+
options[:fancybox] ||= {}
|
52
|
+
options[:fancybox][:overlayOpacity] ||= '0.7'
|
53
|
+
options[:fancybox][:overlayColor] ||= '#111'
|
54
|
+
|
55
|
+
js_includes = %w(jquery/jquery-fancybox-1.3.1.pack.js)
|
56
|
+
if (!options[:fancybox][:easingIn].blank? && options[:fancybox][:easingIn] != 'swing') ||
|
57
|
+
(!options[:fancybox][:easingOut].blank? && options[:fancybox][:easingOut] != 'swing')
|
58
|
+
js_includes.unshift 'jquery/jquery-easing-1.3.pack.js'
|
59
|
+
end
|
60
|
+
|
61
|
+
Guilded::Guilder.instance.add( :fancybox, options, js_includes )
|
62
|
+
''
|
63
|
+
end
|
64
|
+
|
65
|
+
# Outputs a HTML anchor tag with the given opions as well as the JavaScript and CSS to attach to
|
66
|
+
# jQuery DOM elements of given selector. Utilizes Rails link_to helper method for outputting the
|
67
|
+
# anchor tag.
|
68
|
+
#
|
69
|
+
# *Options*
|
70
|
+
# +:html_options+ - The HTML options to pass to the link_to
|
71
|
+
# Same as g_fancybox
|
72
|
+
#
|
73
|
+
def g_fancybox_link_to( name, path, options={} )
|
74
|
+
html_options = options.delete( :html ) || {}
|
75
|
+
html_class = html_options[:class]
|
76
|
+
html_options[:class] = "#{html_class} fancybox"
|
77
|
+
|
78
|
+
g_fancybox( options )
|
79
|
+
|
80
|
+
link_to( name, path, html_options )
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module GFancybox
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
desc "Copies g_fancybox assets to public/stylesheets/ and public/javascripts/."
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
File.join( File.dirname(__FILE__), '..', '..', 'templates' )
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.banner
|
11
|
+
"rails generate g_fancybox:install [options]"
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_files
|
15
|
+
{
|
16
|
+
"javascripts/guilded.fancybox.js" => "public/javascripts/guilded.fancybox.js",
|
17
|
+
"javascripts/guilded.fancybox.min.js" => "public/javascripts/guilded.fancybox.min.js",
|
18
|
+
"javascripts/jquery/jquery-easing-1.3.pack.js" => "public/javascripts/jquery/jquery-easing-1.3.pack.js",
|
19
|
+
"javascripts/jquery/jquery-fancybox-1.3.1.js" => "public/javascripts/jquery/jquery-fancybox-1.3.1.js",
|
20
|
+
"javascripts/jquery/jquery-fancybox-1.3.1.pack.js" => "public/javascripts/jquery/jquery-fancybox-1.3.1.pack.js",
|
21
|
+
"javascripts/jquery/jquery-mousewheel-3.0.2.pack.js" => "public/javascripts/jquery/jquery-mousewheel-3.0.2.pack.js",
|
22
|
+
"stylesheets/guilded/fancybox/default.css" => "public/stylesheets/guilded/fancybox/default.css",
|
23
|
+
"stylesheets/guilded/fancybox/default/blank.gif" => "public/stylesheets/guilded/fancybox/default/blank.gif",
|
24
|
+
"stylesheets/guilded/fancybox/default/fancy_close.png" => "public/stylesheets/guilded/fancybox/default/fancy_close.png",
|
25
|
+
"stylesheets/guilded/fancybox/default/fancy_loading.png" => "public/stylesheets/guilded/fancybox/default/fancy_loading.png",
|
26
|
+
"stylesheets/guilded/fancybox/default/fancy_nav_left.png" => "public/stylesheets/guilded/fancybox/default/fancy_nav_left.png",
|
27
|
+
"stylesheets/guilded/fancybox/default/fancy_nav_right.png" => "public/stylesheets/guilded/fancybox/default/fancy_nav_right.png",
|
28
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_e.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_e.png",
|
29
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_n.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_n.png",
|
30
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_ne.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_ne.png",
|
31
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_nw.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_nw.png",
|
32
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_s.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_s.png",
|
33
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_se.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_se.png",
|
34
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_sw.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_sw.png",
|
35
|
+
"stylesheets/guilded/fancybox/default/fancy_shadow_w.png" => "public/stylesheets/guilded/fancybox/default/fancy_shadow_w.png",
|
36
|
+
"stylesheets/guilded/fancybox/default/fancy_title_left.png" => "public/stylesheets/guilded/fancybox/default/fancy_title_left.png",
|
37
|
+
"stylesheets/guilded/fancybox/default/fancy_title_main.png" => "public/stylesheets/guilded/fancybox/default/fancy_title_main.png",
|
38
|
+
"stylesheets/guilded/fancybox/default/fancy_title_over.png" => "public/stylesheets/guilded/fancybox/default/fancy_title_over.png",
|
39
|
+
"stylesheets/guilded/fancybox/default/fancy_title_right.png" => "public/stylesheets/guilded/fancybox/default/fancy_title_right.png",
|
40
|
+
"stylesheets/guilded/fancybox/default/fancybox-x.png" => "public/stylesheets/guilded/fancybox/default/fancybox-x.png",
|
41
|
+
"stylesheets/guilded/fancybox/default/fancybox-y.png" => "public/stylesheets/guilded/fancybox/default/fancybox-y.png",
|
42
|
+
"stylesheets/guilded/fancybox/default/fancybox.png" => "public/stylesheets/guilded/fancybox/default/fancybox.png"
|
43
|
+
}.each do |src, dest|
|
44
|
+
template src, dest
|
45
|
+
end
|
46
|
+
# empty_directory 'config/initializers'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/* Guilded Fancy Box To 1.0.0
|
2
|
+
* Copyright Fancy Box is licensed under the terms of the MIT License */
|
3
|
+
|
4
|
+
g.fancyboxInit = function( options )
|
5
|
+
{
|
6
|
+
if( g.beforeFancyboxInit )
|
7
|
+
g.beforeFancyboxInit( options );
|
8
|
+
|
9
|
+
var elements = jQuery( options.selector );
|
10
|
+
|
11
|
+
if( options.fancybox.type == 'iframe' )
|
12
|
+
{
|
13
|
+
if( g.fancyboxAddParamsToUrl )
|
14
|
+
{
|
15
|
+
g.fancyboxAddParamsToUrl( options );
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
elements.fancybox( options.fancybox );
|
20
|
+
|
21
|
+
if( g.afterFancyboxInit )
|
22
|
+
g.afterFancyboxInit( options );
|
23
|
+
};
|