Permalink
Browse files

first version

  • Loading branch information...
1 parent 0b78f99 commit 3a406ce89853cea3c19201edb87fd8b15c41116c @kristianmandrup committed Aug 21, 2012
Showing with 8,339 additions and 34 deletions.
  1. +1 −1 .gitignore
  2. +5 −10 Gemfile
  3. +37 −0 Gemfile.lock
  4. +126 −0 README.md
  5. +0 −19 README.rdoc
  6. +1 −1 VERSION
  7. +4 −0 app/views/gallery/_galleria.html.haml
  8. +30 −0 app/views/gallery/_responsive.html.haml
  9. +26 −0 app/views/gallery/_slideshow.html.haml
  10. +1 −0 lib/rails-gallery.rb
  11. +8 −0 lib/rails-gallery/engine.rb
  12. +14 −0 lib/rails-gallery/photo_config.rb
  13. +139 −0 lib/rails-gallery/photos.rb
  14. +23 −0 lib/rails-gallery/view_helper.rb
  15. +7 −0 lib/rails-gallery/view_helper/responsive.rb
  16. +7 −0 lib/rails-gallery/view_helper/slideshow.rb
  17. +54 −0 spec/galleria_snippet.html
  18. +9 −0 spec/galleria_snippet.html.haml
  19. +1 −0 spec/images/photo_gallery/icons/IconsByGentleface.txt
  20. BIN spec/images/photo_gallery/icons/grid.png
  21. BIN spec/images/photo_gallery/icons/loading.gif
  22. BIN spec/images/photo_gallery/icons/next.png
  23. BIN spec/images/photo_gallery/icons/next_thumb.png
  24. BIN spec/images/photo_gallery/icons/pause.png
  25. BIN spec/images/photo_gallery/icons/play.png
  26. BIN spec/images/photo_gallery/icons/prev.png
  27. BIN spec/images/photo_gallery/icons/prev_thumb.png
  28. BIN spec/images/photo_gallery/icons/up.png
  29. BIN spec/images/photo_gallery/images/1.jpg
  30. BIN spec/images/photo_gallery/images/10.jpg
  31. BIN spec/images/photo_gallery/images/11.jpg
  32. BIN spec/images/photo_gallery/images/12.jpg
  33. BIN spec/images/photo_gallery/images/2.jpg
  34. BIN spec/images/photo_gallery/images/3.jpg
  35. BIN spec/images/photo_gallery/images/4.jpg
  36. BIN spec/images/photo_gallery/images/5.jpg
  37. BIN spec/images/photo_gallery/images/6.jpg
  38. BIN spec/images/photo_gallery/images/7.jpg
  39. BIN spec/images/photo_gallery/images/8.jpg
  40. BIN spec/images/photo_gallery/images/9.jpg
  41. +3 −0 spec/images/photo_gallery/images/ImagesByTibchris.txt
  42. BIN spec/images/photo_gallery/images/thumbs/1.jpg
  43. BIN spec/images/photo_gallery/images/thumbs/10.jpg
  44. BIN spec/images/photo_gallery/images/thumbs/11.jpg
  45. BIN spec/images/photo_gallery/images/thumbs/12.jpg
  46. BIN spec/images/photo_gallery/images/thumbs/2.jpg
  47. BIN spec/images/photo_gallery/images/thumbs/3.jpg
  48. BIN spec/images/photo_gallery/images/thumbs/4.jpg
  49. BIN spec/images/photo_gallery/images/thumbs/5.jpg
  50. BIN spec/images/photo_gallery/images/thumbs/6.jpg
  51. BIN spec/images/photo_gallery/images/thumbs/7.jpg
  52. BIN spec/images/photo_gallery/images/thumbs/8.jpg
  53. BIN spec/images/photo_gallery/images/thumbs/9.jpg
  54. BIN spec/images/property/1.jpg
  55. BIN spec/images/property/2.jpg
  56. BIN spec/images/property/3.jpg
  57. BIN spec/images/property/4.jpg
  58. BIN spec/images/property/5.jpg
  59. BIN spec/images/property/6.jpg
  60. BIN spec/images/property/7.jpg
  61. BIN spec/images/property/ads/ad1.jpg
  62. BIN spec/images/property/ads/ad2.jpg
  63. BIN spec/images/property/ads/ad3.jpg
  64. BIN spec/images/property/thumbs/1.jpg
  65. BIN spec/images/property/thumbs/2.jpg
  66. BIN spec/images/property/thumbs/3.jpg
  67. BIN spec/images/property/thumbs/4.jpg
  68. BIN spec/images/property/thumbs/5.jpg
  69. BIN spec/images/property/thumbs/6.jpg
  70. BIN spec/images/property/thumbs/7.jpg
  71. BIN spec/images/responsive-gallery/icons/ajax-loader.gif
  72. BIN spec/images/responsive-gallery/icons/black.png
  73. BIN spec/images/responsive-gallery/icons/nav.png
  74. BIN spec/images/responsive-gallery/icons/nav_thumbs.png
  75. BIN spec/images/responsive-gallery/icons/pattern.png
  76. BIN spec/images/responsive-gallery/icons/views.png
  77. BIN spec/images/responsive-gallery/images/1.jpg
  78. BIN spec/images/responsive-gallery/images/10.jpg
  79. BIN spec/images/responsive-gallery/images/11.jpg
  80. BIN spec/images/responsive-gallery/images/12.jpg
  81. BIN spec/images/responsive-gallery/images/13.jpg
  82. BIN spec/images/responsive-gallery/images/14.jpg
  83. BIN spec/images/responsive-gallery/images/15.jpg
  84. BIN spec/images/responsive-gallery/images/16.jpg
  85. BIN spec/images/responsive-gallery/images/17.jpg
  86. BIN spec/images/responsive-gallery/images/18.jpg
  87. BIN spec/images/responsive-gallery/images/19.jpg
  88. BIN spec/images/responsive-gallery/images/2.jpg
  89. BIN spec/images/responsive-gallery/images/20.jpg
  90. BIN spec/images/responsive-gallery/images/21.jpg
  91. BIN spec/images/responsive-gallery/images/22.jpg
  92. BIN spec/images/responsive-gallery/images/23.jpg
  93. BIN spec/images/responsive-gallery/images/24.jpg
  94. BIN spec/images/responsive-gallery/images/3.jpg
  95. BIN spec/images/responsive-gallery/images/4.jpg
  96. BIN spec/images/responsive-gallery/images/5.jpg
  97. BIN spec/images/responsive-gallery/images/6.jpg
  98. BIN spec/images/responsive-gallery/images/7.jpg
  99. BIN spec/images/responsive-gallery/images/8.jpg
  100. BIN spec/images/responsive-gallery/images/9.jpg
  101. BIN spec/images/responsive-gallery/images/thumbs/1.jpg
  102. BIN spec/images/responsive-gallery/images/thumbs/10.jpg
  103. BIN spec/images/responsive-gallery/images/thumbs/11.jpg
  104. BIN spec/images/responsive-gallery/images/thumbs/12.jpg
  105. BIN spec/images/responsive-gallery/images/thumbs/13.jpg
  106. BIN spec/images/responsive-gallery/images/thumbs/14.jpg
  107. BIN spec/images/responsive-gallery/images/thumbs/15.jpg
  108. BIN spec/images/responsive-gallery/images/thumbs/16.jpg
  109. BIN spec/images/responsive-gallery/images/thumbs/17.jpg
  110. BIN spec/images/responsive-gallery/images/thumbs/18.jpg
  111. BIN spec/images/responsive-gallery/images/thumbs/19.jpg
  112. BIN spec/images/responsive-gallery/images/thumbs/2.jpg
  113. BIN spec/images/responsive-gallery/images/thumbs/20.jpg
  114. BIN spec/images/responsive-gallery/images/thumbs/21.jpg
  115. BIN spec/images/responsive-gallery/images/thumbs/22.jpg
  116. BIN spec/images/responsive-gallery/images/thumbs/23.jpg
  117. BIN spec/images/responsive-gallery/images/thumbs/24.jpg
  118. BIN spec/images/responsive-gallery/images/thumbs/3.jpg
  119. BIN spec/images/responsive-gallery/images/thumbs/4.jpg
  120. BIN spec/images/responsive-gallery/images/thumbs/5.jpg
  121. BIN spec/images/responsive-gallery/images/thumbs/6.jpg
  122. BIN spec/images/responsive-gallery/images/thumbs/7.jpg
  123. BIN spec/images/responsive-gallery/images/thumbs/8.jpg
  124. BIN spec/images/responsive-gallery/images/thumbs/9.jpg
  125. +1 −1 spec/rails-gallery_spec.rb
  126. +0 −2 spec/spec_helper.rb
  127. BIN vendor/assets/images/gallery/galleria/classic/loader.gif
  128. BIN vendor/assets/images/gallery/galleria/classic/map.png
  129. BIN vendor/assets/images/gallery/responsive/icons/ajax-loader.gif
  130. BIN vendor/assets/images/gallery/responsive/icons/black.png
  131. BIN vendor/assets/images/gallery/responsive/icons/nav.png
  132. BIN vendor/assets/images/gallery/responsive/icons/nav_thumbs.png
  133. BIN vendor/assets/images/gallery/responsive/icons/pattern.png
  134. BIN vendor/assets/images/gallery/responsive/icons/views.png
  135. BIN vendor/assets/images/gallery/slideshow/icons/grid.png
  136. BIN vendor/assets/images/gallery/slideshow/icons/loading.gif
  137. BIN vendor/assets/images/gallery/slideshow/icons/next.png
  138. BIN vendor/assets/images/gallery/slideshow/icons/next_thumb.png
  139. BIN vendor/assets/images/gallery/slideshow/icons/pause.png
  140. BIN vendor/assets/images/gallery/slideshow/icons/play.png
  141. BIN vendor/assets/images/gallery/slideshow/icons/prev.png
  142. BIN vendor/assets/images/gallery/slideshow/icons/prev_thumb.png
  143. BIN vendor/assets/images/gallery/slideshow/icons/up.png
  144. +5,926 −0 vendor/assets/javascripts/gallery/galleria-1.2.8.js
  145. +9 −0 vendor/assets/javascripts/gallery/galleria-1.2.8.min.js
  146. +95 −0 vendor/assets/javascripts/gallery/galleria/classic.js
  147. +8 −0 vendor/assets/javascripts/gallery/galleria/classic.min.js
  148. +261 −0 vendor/assets/javascripts/gallery/responsive.js
  149. +308 −0 vendor/assets/javascripts/gallery/slideshow.js
  150. +205 −0 vendor/assets/javascripts/jquery/jquery.easing-1.3.js
  151. +467 −0 vendor/assets/javascripts/jquery/jquery.elastislide.js
  152. +1 −0 vendor/assets/javascripts/jquery/jquery.tmpl.min.js
  153. +217 −0 vendor/assets/stylesheets/gallery/galleria/classic.css
  154. +105 −0 vendor/assets/stylesheets/gallery/responsive.css
  155. +69 −0 vendor/assets/stylesheets/gallery/responsive/elastislide.css
  156. +171 −0 vendor/assets/stylesheets/gallery/slideshow.css
View
@@ -28,7 +28,7 @@ pkg
#
# For MacOS:
#
-#.DS_Store
+.DS_Store
# For TextMate
#*.tmproj
View
15 Gemfile
@@ -1,14 +1,9 @@
source "http://rubygems.org"
-# Add dependencies required to use your gem here.
-# Example:
-# gem "activesupport", ">= 2.3.5"
-# Add dependencies to develop your gem here.
-# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "rspec", "~> 2.8.0"
- gem "rdoc", "~> 3.12"
- gem "bundler", "~> 1.0.0"
- gem "jeweler", "~> 1.8.4"
- gem "rcov", ">= 0"
+ gem "rspec", ">= 2.8.0"
+ gem "rdoc", ">= 3.12"
+ gem "bundler", ">= 1.0.0"
+ gem "jeweler", ">= 1.8.4"
+ gem "simplecov",">= 0.5"
end
View
@@ -0,0 +1,37 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.3)
+ git (1.2.5)
+ jeweler (1.8.4)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ rdoc
+ json (1.7.5)
+ multi_json (1.3.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.11.0)
+ rspec-core (~> 2.11.0)
+ rspec-expectations (~> 2.11.0)
+ rspec-mocks (~> 2.11.0)
+ rspec-core (2.11.1)
+ rspec-expectations (2.11.2)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.11.2)
+ simplecov (0.6.4)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.5.3)
+ simplecov-html (0.5.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (>= 1.0.0)
+ jeweler (>= 1.8.4)
+ rdoc (>= 3.12)
+ rspec (>= 2.8.0)
+ simplecov (>= 0.5)
View
126 README.md
@@ -0,0 +1,126 @@
+# 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:
+
+```css
+/*
+ * 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:
+
+```javascript
+//= 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](http://tympanus.net/codrops/2010/07/05/minimalistic-slideshow-gallery/) for more info.
+
+
+### Customization
+
+Pls Fill in here ;)
+
+## Responsive gallery
+
+See [responsive-image-gallery](http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/) for more info.
+
+### Customization
+
+*Remove thumbnails*
+
+Change `mode = 'carousel'` to `'fullview'`
+
+*Remove 'mode' bar*
+
+```css
+.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](http://galleria.io) for more info.
+
+## 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.
+
View
@@ -1,19 +0,0 @@
-= rails-gallery
-
-Description goes here.
-
-== 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.
-
View
@@ -1 +1 @@
-0.0.0
+0.1.0
@@ -0,0 +1,4 @@
+#galleria
+ - photos.all.each do |photo|
+ %a{href:"/assets/#{photo.path}"}
+ = image_tag photo.path, :"data-title" => photo.title, :"data-description" => photo.description
@@ -0,0 +1,30 @@
+#rg-gallery.rg-gallery
+ .rg-thumbs
+ // Elastislide Carousel Thumbnail Viewer
+ .es-carousel-wrapper
+ .es-nav
+ %span.es-nav-prev
+ Previous
+ %span.es-nav-next
+ Next
+ .es-carousel
+ %ul
+ - photos.all.each do |photo|
+ %li
+ %a{href:"#"}
+ = image_tag photo.thumb, :"data-large" => "/assets/#{photo.path}", :alt => photo.alt, :"data-description" => photo.title
+
+%script#img-wrapper-tmpl{style: "display:none;"}
+ .rg-image-wrapper
+ = "{{if itemsCount > 1}}"
+ .rg-image-nav
+ %a.rg-image-nav-prev{href: "#"}
+ Previous
+ %a.rg-image-nav-next{href: "#"}
+ Next
+ = "{{/if}}"
+ .rg-image
+ .rg-loading
+ .rg-caption-wrapper
+ .rg-caption{style: "display:none;"}
+ %p
@@ -0,0 +1,26 @@
+// http://tympanus.net/codrops/2010/07/05/minimalistic-slideshow-gallery/
+#msg_slideshow.msg_slideshow
+ #msg_wrapper.msg_wrapper
+ #msg_controls.msg_controls
+ // right has to animate to 15px, default -110px
+ %a#msg_grid.msg_grid{href: "#"}
+ %a#msg_prev.msg_prev{href: "#"}
+ %a#msg_pause_play.msg_pause{href: "#"}
+ // has to change to msg_play if paused
+ %a#msg_next.msg_next{href: "#"}
+ #msg_thumbs.msg_thumbs
+ // top has to animate to 0px, default -230px
+ .msg_thumb_wrapper
+ - photos.page(:first).photos.each do |photo|
+ %a{href: "#"}
+ = image_tag photo.thumb, alt: "/assets/#{photo.path}"
+ - photos.pages.remainder.each do |page|
+ .msg_thumb_wrapper{style: 'display:none'}
+ - page.photos.each do |photo|
+ %a{href: "#"}
+ = image_tag photo.thumb, alt: "/assets/#{photo.path}"
+ %a#msg_thumb_next.msg_thumb_next{href: '#'}
+ %a#msg_thumb_prev.msg_thumb_prev{href: '#'}
+ %a#msg_thumb_close.msg_thumb_close{href: '#'}
+ %span.msg_loading
+ Loading images...
View
@@ -0,0 +1 @@
+require 'rails-gallery/photos'
@@ -0,0 +1,8 @@
+module RailsGallery
+ module Rails
+ class Engine < ::Rails::Engine
+ initializer 'rails gallery' do
+ end
+ end
+ end
+end
@@ -0,0 +1,14 @@
+class PhotoConfig
+ attr_writer :photo_class
+ attr_reader :options
+
+ def initialize options = {}
+ options ||= {}
+ @options = options
+ @photo_class = options[:photo_class] if options[:photo_class]
+ end
+
+ def photo_class
+ @photo_class ||= Photos::Photo
+ end
+end
Oops, something went wrong.

0 comments on commit 3a406ce

Please sign in to comment.