Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Popular javascript photo gallery and carousel components ready for use with Rails 3 and above :)
tree: adc1caf3be

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app/views/gallery
lib
spec
vendor/assets
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
VERSION
rails-gallery.gemspec

README.md

Photo Gallery components for Rails

Popular Javascript Photo galleries/carousels ready to use with Rails 3+.

Usage

`gem 'rails-gallery'

Galleries included

  • slideshow
  • responsive
  • galleria

Please add more ;)

Configuration

In application.css manifest file:

/*
 * require responsive-gallery
 * require gallery/responsive/elastislide
 * require gallery/responsive/style
 * require gallery/slideshow
 * require gallery/galleria
*/

Using Compass, f.ex in application.css.scss.erb

@import 'gallery/responsive/elastislide';
@import 'gallery/responsive/style';
@import 'gallery/slideshow';
@import 'gallery/galleria';

In application.js manifest file:

//= require gallery/responsive
//= require gallery/slideshow
//= require gallery/galleria

//= require jquery.easing-1.3
//= require jquery.elastislide
//= require jquery.tmpl.min

Minimalistic Slideshow gallery

See minimalistic-slideshow-gallery for more info.

Customization

Pls Fill in here ;)

Responsive gallery

See responsive-image-gallery for more info.

Customization

Remove thumbnails

Change mode = 'carousel' to 'fullview'

Remove 'mode' bar

.rg-view{
  display: none;
}

.rg-thumbs {
  padding-top: 10px;
}

placement of thumbnails

To adjust placement of thumbnails, use: prependTo or appendTo in gallery/responsive.js:

``javascript _addImageWrapper= function() {

// adds the structure for the large image and the navigation buttons (if total items > 1)
// also initializes the navigation events
$('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} ).prependTo( $rgGallery )

*Automatic slideshow*

I wanted the same thing and I find a way to do it.
In the file gallery.js, in the function _initCarousel add these lines after `$esCarousel.elastislide( ‘setCurrent’, current );` (~ line 103):

```javascript
window.setInterval(function(){
_navigate( ‘right’ );
}, 5000);

You just have to change 5000 to the value you want (milliseconds).

Galleria

See galleria.io for more info.

Extras

This gem is a Rails 3+ engine.

Some HAML views (partials) are included in app/views/gallery

Rails views usage

class PropertiesController < ApplicationController
  def show
    @property = property
  end

  protected

  def property
    Hashie::Mash.new  title: 'A beautiful property', 
                      description: decription,
                      photos: photos
  end

  def description
    %q{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent mauris arcu, auctor ac rhoncus non,  libero. Nulla dolor velit, volutpat a bibendum ut, hendrerit id mi. Pellentesque convallis erat in mi interdum rutrum. Phasellus interdum velit nulla.
    }
  end  

  def photos
    @photos ||= Photos.new nil, photo_class: Property::Photo
    5.times do
      @photos.pages << 6.times.map {|n| (Kernel.rand(7) + 1).to_s }
    end
    @photos
  end
end

Then in your properties/show.html.haml:

render partial: 'gallery/responsive', locals: { photos: @property.photos }

And so on...

View helpers

There are also some view helpers included in rails-gallery/view_helper.rb

gallery_image type, photo

Example:

- photos.each do |photo|
  = gallery_image :responsive, photo`

Enjoy!

Contributing to rails-gallery

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2012 Kristian Mandrup. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.