chrismytton / fancybox-rails Goto Github PK
View Code? Open in Web Editor NEWUse FancyBox with the Rails asset pipeline
License: MIT License
Use FancyBox with the Rails asset pipeline
License: MIT License
can you explain a little more about your gem like how to do unobtrusive ajax call to display a partial in a fancybox?
Getting an error when I have add lines into application.js file
couldn't find file 'fancybox'
(in /var/www/tumara/app/assets/javascripts/application.js:15)
can anyone help me out please
Hi, I just wanted to let you know that I'll be moving the fancybox2 version into it's own repository and gem. I'll name it fancybox2-rails
and the git repo will be at https://github.com/kyparn/fancybox2-rails.
This doesn't seem to work if you add 'fancybox.css' and 'fancybox.js' to config.assets.precompile if you wish to not have them included in the main application.css / js. When linking to the javascript file with "javascript_include_tag 'fancybox'" you get a reference tp /assets/jquery.fancybox.
I'm getting a 404 error for the following when I use the plugin
http://myapp:3000/images/fancy_box/fancybox.png
http://myapp:3000/images/fancy_box/blank.png
Should I be copying these assets manually?
Please, let me know how to use the Extended functionality like button and thumb.
Hello,
I was trying to integrate your gem into my toy rails app but I encountered this error.
TypeError: content.get(0).style.removeAttribute is not a function. (In 'content.get(0).style.removeAttribute('filter')', 'content.get(0).style.removeAttribute' is undefined)
and the specific code causing the error:
if (!$.support.opacity) {
content.get(0).style.removeAttribute('filter');
wrap.get(0).style.removeAttribute('filter');
}
Apparently, removeAttribute
is defined for an element and not for CSSStyleDeclaration
object outputted by style
. When I change it to style.removeProperty
or .removeAttribute
called directly on the element, it works just as expected.
I hope it proves useful. Have a good one.
And add more usage instructions in README, such as how to use ajax with dynamic page loading...
Hey hecticjeff,
Thanks for supplying this gem!
There's a new version of fancybox here:
http://fancyapps.com/fancybox/
I tried to fork the repository, include the new assets and submit a pull request, but there were a couple of failing tests and I didn't know how to fix them.
jQuery 1.9 removed $.browser so now this gem does not work if you upgrade your jquery-rails.
Hi hecticjeff,
I've used fancybox before but it wasn't with rails and this would be my first time to use it with rails. Now I don't know if this is cause of this or cause of fancybox.
I'm loading a big image from a thumbnail to a fancybox. But on first click, the image loads but the computations are off. Like the width of fancybox is 0 and it's not displayed. But when I just click on the background and click the thumbnail again, it works perfectly.
Have this happened to you as well?
Cheers!
Running into a couple of issues with rc5, there seems to have been some changes to the way assets are handled.
Hi,
I'm using @sverigemeny-s fork (https://github.com/sverigemeny/fancybox-rails) and I'm trying to update source js files. Current master branch has jquery.fancybox.js 2.0.4 with an error (http://stackoverflow.com/questions/8701467/passing-an-array-of-image-objects-to-fancybox-lightbox-doesnt-seem-to-work) I cannot solve without moving forawrd to the latest jquery.fancybox.js version (2.0.6) which can be found here: https://github.com/fancyapps/fancyBox/zipball/master
So my question is: how can I use @sverigemeny-s fork with the latest jquery.fancybox.js?
Thanks in advance,
adrian
0.2.1 is solving my problems in dev, but I can't get it to bundle in production.
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
Some gems seem to be missing from your vendor/cache directory.
Could not find fancybox-rails-0.2.1 in any of the sources
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
When the library is loaded outside rails a waning should be displayed, at the moment the following error message is displayed.
NameError: uninitialized constant Rails
This gem depends on jQuery, so it would make sense to make it a dependency. However the user may wish to load jquery using another mechanism, so this might not be such a great idea?
Get an error, while trying to complie assets
gem versions:
rails 3.1.3
sass-rails 3.1.5
fancybox-rails 0.1.4
backtrace:
bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/max/.rvm/rubies/ruby-1.9.3-p0/bin/ruby /Users/max/.rvm/gems/ruby-1.9.3-p0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Invalid CSS after " */": expected selector or at-rule, was "#fancybox-loadi..."
(in /Users/max/Documents/Projects/fs/tch/repos/allabout-classifieds/app/assets/stylesheets/application.css)
(sass):26
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sass-3.1.15/lib/sass/scss/parser.rb:928:in `expected'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sass-3.1.15/lib/sass/scss/parser.rb:874:in `expected'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sass-3.1.15/lib/sass/scss/parser.rb:28:in `parse'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sass-3.1.15/lib/sass/engine.rb:326:in `_to_tree'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sass-3.1.15/lib/sass/engine.rb:299:in `_render'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sass-3.1.15/lib/sass/engine.rb:246:in `render'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sass-rails-3.1.1/lib/sass/rails/compressor.rb:7:in `compress'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/compressors.rb:18:in `compress'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/processing.rb:243:in `block in css_compressor='
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/processor.rb:29:in `call'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/processor.rb:29:in `evaluate'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/context.rb:175:in `block in evaluate'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/context.rb:172:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/context.rb:172:in `evaluate'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:242:in `block in build_source'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/caching.rb:30:in `cache_hash'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:235:in `build_source'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:71:in `digest'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/asset.rb:95:in `digest_path'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/static_compiler.rb:58:in `path_for'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/static_compiler.rb:35:in `write_asset'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/static_compiler.rb:21:in `block in compile'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:151:in `block in each_logical_path'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:139:in `block (2 levels) in each_file'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:129:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:129:in `each_entry'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:137:in `block in each_file'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:136:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:136:in `each_file'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/sprockets-2.0.3/lib/sprockets/base.rb:149:in `each_logical_path'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/static_compiler.rb:18:in `compile'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/assets.rake:52:in `internal_precompile'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/assets.rake:66:in `block (3 levels) in <top (required)>'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/max/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/assets.rake:56:in `block (3 levels) in <top (required)>'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/max/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/max/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `load'
/Users/max/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/Users/max/.rvm/rubies/ruby-1.9.3-p0/bin/r...]
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.3/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/max/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/max/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/max/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `load'
/Users/max/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile
Lots of people seem to be forking the repository to customize the look and feel of fancybox. Instead they can just put their custom fancybox assets version in lib/assets
, which is higher on the asset PATH than vendor/assets
, and they won't need to fork.
A section in the README with these details would be good. We could also add a rake task for copying the assets into lib/assets
.
Update bundle and test against the release candidates. 3.1 should be released around the 23rd June, so will need to check compat with that also.
Running the rake precompile:assets
task gives the following error.
% rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
fancybox.png isn't precompiled
(in /Users/chris/.rvm/gems/ruby-1.9.2-p290/gems/fancybox-rails-0.1.4/vendor/assets/stylesheets/jquery.fancybox.css.erb)
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.