rails-gallery 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +37 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +298 -0
  7. data/Rakefile +49 -0
  8. data/VERSION +1 -0
  9. data/app/views/gallery/_galleria.html.haml +4 -0
  10. data/app/views/gallery/_responsive.html.haml +15 -0
  11. data/app/views/gallery/_slideshow.html.haml +26 -0
  12. data/app/views/gallery/template/_responsive.html.haml +14 -0
  13. data/config/locales/rails_gallery.yml +5 -0
  14. data/lib/rails-gallery.rb +3 -0
  15. data/lib/rails-gallery/engine.rb +9 -0
  16. data/lib/rails-gallery/rgallery.rb +7 -0
  17. data/lib/rails-gallery/rgallery/page.rb +24 -0
  18. data/lib/rails-gallery/rgallery/pages.rb +34 -0
  19. data/lib/rails-gallery/rgallery/photo.rb +50 -0
  20. data/lib/rails-gallery/rgallery/photo_config.rb +18 -0
  21. data/lib/rails-gallery/rgallery/photos.rb +45 -0
  22. data/lib/rails-gallery/view_helper.rb +27 -0
  23. data/lib/rails-gallery/view_helper/galleria.rb +11 -0
  24. data/lib/rails-gallery/view_helper/responsive.rb +9 -0
  25. data/lib/rails-gallery/view_helper/slideshow.rb +9 -0
  26. data/rails-gallery.gemspec +217 -0
  27. data/spec/galleria_snippet.html +54 -0
  28. data/spec/galleria_snippet.html.haml +9 -0
  29. data/spec/images/photo_gallery/icons/IconsByGentleface.txt +1 -0
  30. data/spec/images/photo_gallery/icons/grid.png +0 -0
  31. data/spec/images/photo_gallery/icons/loading.gif +0 -0
  32. data/spec/images/photo_gallery/icons/next.png +0 -0
  33. data/spec/images/photo_gallery/icons/next_thumb.png +0 -0
  34. data/spec/images/photo_gallery/icons/pause.png +0 -0
  35. data/spec/images/photo_gallery/icons/play.png +0 -0
  36. data/spec/images/photo_gallery/icons/prev.png +0 -0
  37. data/spec/images/photo_gallery/icons/prev_thumb.png +0 -0
  38. data/spec/images/photo_gallery/icons/up.png +0 -0
  39. data/spec/images/photo_gallery/images/1.jpg +0 -0
  40. data/spec/images/photo_gallery/images/10.jpg +0 -0
  41. data/spec/images/photo_gallery/images/11.jpg +0 -0
  42. data/spec/images/photo_gallery/images/12.jpg +0 -0
  43. data/spec/images/photo_gallery/images/2.jpg +0 -0
  44. data/spec/images/photo_gallery/images/3.jpg +0 -0
  45. data/spec/images/photo_gallery/images/4.jpg +0 -0
  46. data/spec/images/photo_gallery/images/5.jpg +0 -0
  47. data/spec/images/photo_gallery/images/6.jpg +0 -0
  48. data/spec/images/photo_gallery/images/7.jpg +0 -0
  49. data/spec/images/photo_gallery/images/8.jpg +0 -0
  50. data/spec/images/photo_gallery/images/9.jpg +0 -0
  51. data/spec/images/photo_gallery/images/ImagesByTibchris.txt +3 -0
  52. data/spec/images/photo_gallery/images/thumbs/1.jpg +0 -0
  53. data/spec/images/photo_gallery/images/thumbs/10.jpg +0 -0
  54. data/spec/images/photo_gallery/images/thumbs/11.jpg +0 -0
  55. data/spec/images/photo_gallery/images/thumbs/12.jpg +0 -0
  56. data/spec/images/photo_gallery/images/thumbs/2.jpg +0 -0
  57. data/spec/images/photo_gallery/images/thumbs/3.jpg +0 -0
  58. data/spec/images/photo_gallery/images/thumbs/4.jpg +0 -0
  59. data/spec/images/photo_gallery/images/thumbs/5.jpg +0 -0
  60. data/spec/images/photo_gallery/images/thumbs/6.jpg +0 -0
  61. data/spec/images/photo_gallery/images/thumbs/7.jpg +0 -0
  62. data/spec/images/photo_gallery/images/thumbs/8.jpg +0 -0
  63. data/spec/images/photo_gallery/images/thumbs/9.jpg +0 -0
  64. data/spec/images/property/1.jpg +0 -0
  65. data/spec/images/property/2.jpg +0 -0
  66. data/spec/images/property/3.jpg +0 -0
  67. data/spec/images/property/4.jpg +0 -0
  68. data/spec/images/property/5.jpg +0 -0
  69. data/spec/images/property/6.jpg +0 -0
  70. data/spec/images/property/7.jpg +0 -0
  71. data/spec/images/property/ads/ad1.jpg +0 -0
  72. data/spec/images/property/ads/ad2.jpg +0 -0
  73. data/spec/images/property/ads/ad3.jpg +0 -0
  74. data/spec/images/property/thumbs/1.jpg +0 -0
  75. data/spec/images/property/thumbs/2.jpg +0 -0
  76. data/spec/images/property/thumbs/3.jpg +0 -0
  77. data/spec/images/property/thumbs/4.jpg +0 -0
  78. data/spec/images/property/thumbs/5.jpg +0 -0
  79. data/spec/images/property/thumbs/6.jpg +0 -0
  80. data/spec/images/property/thumbs/7.jpg +0 -0
  81. data/spec/images/responsive-gallery/icons/ajax-loader.gif +0 -0
  82. data/spec/images/responsive-gallery/icons/black.png +0 -0
  83. data/spec/images/responsive-gallery/icons/nav.png +0 -0
  84. data/spec/images/responsive-gallery/icons/nav_thumbs.png +0 -0
  85. data/spec/images/responsive-gallery/icons/pattern.png +0 -0
  86. data/spec/images/responsive-gallery/icons/views.png +0 -0
  87. data/spec/images/responsive-gallery/images/1.jpg +0 -0
  88. data/spec/images/responsive-gallery/images/10.jpg +0 -0
  89. data/spec/images/responsive-gallery/images/11.jpg +0 -0
  90. data/spec/images/responsive-gallery/images/12.jpg +0 -0
  91. data/spec/images/responsive-gallery/images/13.jpg +0 -0
  92. data/spec/images/responsive-gallery/images/14.jpg +0 -0
  93. data/spec/images/responsive-gallery/images/15.jpg +0 -0
  94. data/spec/images/responsive-gallery/images/16.jpg +0 -0
  95. data/spec/images/responsive-gallery/images/17.jpg +0 -0
  96. data/spec/images/responsive-gallery/images/18.jpg +0 -0
  97. data/spec/images/responsive-gallery/images/19.jpg +0 -0
  98. data/spec/images/responsive-gallery/images/2.jpg +0 -0
  99. data/spec/images/responsive-gallery/images/20.jpg +0 -0
  100. data/spec/images/responsive-gallery/images/21.jpg +0 -0
  101. data/spec/images/responsive-gallery/images/22.jpg +0 -0
  102. data/spec/images/responsive-gallery/images/23.jpg +0 -0
  103. data/spec/images/responsive-gallery/images/24.jpg +0 -0
  104. data/spec/images/responsive-gallery/images/3.jpg +0 -0
  105. data/spec/images/responsive-gallery/images/4.jpg +0 -0
  106. data/spec/images/responsive-gallery/images/5.jpg +0 -0
  107. data/spec/images/responsive-gallery/images/6.jpg +0 -0
  108. data/spec/images/responsive-gallery/images/7.jpg +0 -0
  109. data/spec/images/responsive-gallery/images/8.jpg +0 -0
  110. data/spec/images/responsive-gallery/images/9.jpg +0 -0
  111. data/spec/images/responsive-gallery/images/thumbs/1.jpg +0 -0
  112. data/spec/images/responsive-gallery/images/thumbs/10.jpg +0 -0
  113. data/spec/images/responsive-gallery/images/thumbs/11.jpg +0 -0
  114. data/spec/images/responsive-gallery/images/thumbs/12.jpg +0 -0
  115. data/spec/images/responsive-gallery/images/thumbs/13.jpg +0 -0
  116. data/spec/images/responsive-gallery/images/thumbs/14.jpg +0 -0
  117. data/spec/images/responsive-gallery/images/thumbs/15.jpg +0 -0
  118. data/spec/images/responsive-gallery/images/thumbs/16.jpg +0 -0
  119. data/spec/images/responsive-gallery/images/thumbs/17.jpg +0 -0
  120. data/spec/images/responsive-gallery/images/thumbs/18.jpg +0 -0
  121. data/spec/images/responsive-gallery/images/thumbs/19.jpg +0 -0
  122. data/spec/images/responsive-gallery/images/thumbs/2.jpg +0 -0
  123. data/spec/images/responsive-gallery/images/thumbs/20.jpg +0 -0
  124. data/spec/images/responsive-gallery/images/thumbs/21.jpg +0 -0
  125. data/spec/images/responsive-gallery/images/thumbs/22.jpg +0 -0
  126. data/spec/images/responsive-gallery/images/thumbs/23.jpg +0 -0
  127. data/spec/images/responsive-gallery/images/thumbs/24.jpg +0 -0
  128. data/spec/images/responsive-gallery/images/thumbs/3.jpg +0 -0
  129. data/spec/images/responsive-gallery/images/thumbs/4.jpg +0 -0
  130. data/spec/images/responsive-gallery/images/thumbs/5.jpg +0 -0
  131. data/spec/images/responsive-gallery/images/thumbs/6.jpg +0 -0
  132. data/spec/images/responsive-gallery/images/thumbs/7.jpg +0 -0
  133. data/spec/images/responsive-gallery/images/thumbs/8.jpg +0 -0
  134. data/spec/images/responsive-gallery/images/thumbs/9.jpg +0 -0
  135. data/spec/rails-gallery_spec.rb +7 -0
  136. data/spec/spec_helper.rb +10 -0
  137. data/vendor/assets/images/gallery/galleria/classic/loader.gif +0 -0
  138. data/vendor/assets/images/gallery/galleria/classic/map.png +0 -0
  139. data/vendor/assets/images/gallery/responsive/icons/ajax-loader.gif +0 -0
  140. data/vendor/assets/images/gallery/responsive/icons/black.png +0 -0
  141. data/vendor/assets/images/gallery/responsive/icons/nav.png +0 -0
  142. data/vendor/assets/images/gallery/responsive/icons/nav_thumbs.png +0 -0
  143. data/vendor/assets/images/gallery/responsive/icons/pattern.png +0 -0
  144. data/vendor/assets/images/gallery/responsive/icons/views.png +0 -0
  145. data/vendor/assets/images/gallery/slideshow/icons/grid.png +0 -0
  146. data/vendor/assets/images/gallery/slideshow/icons/loading.gif +0 -0
  147. data/vendor/assets/images/gallery/slideshow/icons/next.png +0 -0
  148. data/vendor/assets/images/gallery/slideshow/icons/next_thumb.png +0 -0
  149. data/vendor/assets/images/gallery/slideshow/icons/pause.png +0 -0
  150. data/vendor/assets/images/gallery/slideshow/icons/play.png +0 -0
  151. data/vendor/assets/images/gallery/slideshow/icons/prev.png +0 -0
  152. data/vendor/assets/images/gallery/slideshow/icons/prev_thumb.png +0 -0
  153. data/vendor/assets/images/gallery/slideshow/icons/up.png +0 -0
  154. data/vendor/assets/javascripts/gallery/galleria-1.2.8.js +5926 -0
  155. data/vendor/assets/javascripts/gallery/galleria-1.2.8.min.js +9 -0
  156. data/vendor/assets/javascripts/gallery/galleria/classic.js +95 -0
  157. data/vendor/assets/javascripts/gallery/galleria/classic.min.js +8 -0
  158. data/vendor/assets/javascripts/gallery/responsive.js +261 -0
  159. data/vendor/assets/javascripts/gallery/slideshow.js +308 -0
  160. data/vendor/assets/javascripts/jquery/jquery.easing-1.3.js +205 -0
  161. data/vendor/assets/javascripts/jquery/jquery.elastislide.js +467 -0
  162. data/vendor/assets/javascripts/jquery/jquery.tmpl.min.js +1 -0
  163. data/vendor/assets/stylesheets/gallery/galleria/classic.css +217 -0
  164. data/vendor/assets/stylesheets/gallery/responsive.css +105 -0
  165. data/vendor/assets/stylesheets/gallery/responsive/elastislide.css +69 -0
  166. data/vendor/assets/stylesheets/gallery/slideshow.css +171 -0
  167. metadata +297 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "rspec", ">= 2.8.0"
5
+ gem "rdoc", ">= 3.12"
6
+ gem "bundler", ">= 1.0.0"
7
+ gem "jeweler", ">= 1.8.4"
8
+ gem "simplecov",">= 0.5"
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ jeweler (1.8.4)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rdoc
11
+ json (1.7.5)
12
+ multi_json (1.3.6)
13
+ rake (0.9.2.2)
14
+ rdoc (3.12)
15
+ json (~> 1.4)
16
+ rspec (2.11.0)
17
+ rspec-core (~> 2.11.0)
18
+ rspec-expectations (~> 2.11.0)
19
+ rspec-mocks (~> 2.11.0)
20
+ rspec-core (2.11.1)
21
+ rspec-expectations (2.11.2)
22
+ diff-lcs (~> 1.1.3)
23
+ rspec-mocks (2.11.2)
24
+ simplecov (0.6.4)
25
+ multi_json (~> 1.0)
26
+ simplecov-html (~> 0.5.3)
27
+ simplecov-html (0.5.3)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (>= 1.0.0)
34
+ jeweler (>= 1.8.4)
35
+ rdoc (>= 3.12)
36
+ rspec (>= 2.8.0)
37
+ simplecov (>= 0.5)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Kristian Mandrup
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,298 @@
1
+ # Photo Gallery components for Rails
2
+
3
+ Popular Javascript Photo galleries/carousels ready to use with Rails 3+.
4
+
5
+ ## Usage
6
+
7
+ `gem 'rails-gallery'
8
+
9
+ ## Galleries included
10
+
11
+ * slideshow
12
+ * responsive
13
+ * galleria
14
+
15
+ Please add more using a similar convention as is used for these galleries ;)
16
+
17
+ ## Configuration
18
+
19
+ In `application.css` manifest file:
20
+
21
+ ```css
22
+ /*
23
+ * require responsive-gallery
24
+ * require gallery/responsive/elastislide
25
+ * require gallery/responsive/style
26
+ * require gallery/slideshow
27
+ * require gallery/galleria
28
+ */
29
+ ```
30
+
31
+ Using Compass, f.ex in `application.css.scss.erb`
32
+
33
+ ```
34
+ @import 'gallery/responsive/elastislide';
35
+ @import 'gallery/responsive/style';
36
+ @import 'gallery/slideshow';
37
+ @import 'gallery/galleria';
38
+ ```
39
+
40
+ In `application.js` manifest file:
41
+
42
+ ```javascript
43
+ //= require gallery/responsive
44
+ //= require gallery/slideshow
45
+ //= require gallery/galleria
46
+
47
+ //= require jquery.easing-1.3
48
+ //= require jquery.elastislide
49
+ //= require jquery.tmpl.min
50
+ ```
51
+
52
+ ## Minimalistic Slideshow gallery
53
+
54
+ See [minimalistic-slideshow-gallery](http://tympanus.net/codrops/2010/07/05/minimalistic-slideshow-gallery/) for more info.
55
+
56
+
57
+ ### Customization
58
+
59
+ Pls Fill in here ;)
60
+
61
+ ## Responsive gallery
62
+
63
+ See [responsive-image-gallery](http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/) for more info.
64
+
65
+ ### Customization
66
+
67
+ *Remove thumbnails*
68
+
69
+ Change `mode = 'carousel'` to `'fullview'`
70
+
71
+ *Remove 'mode' bar*
72
+
73
+ ```css
74
+ .rg-view{
75
+ display: none;
76
+ }
77
+
78
+ .rg-thumbs {
79
+ padding-top: 10px;
80
+ }
81
+ ```
82
+
83
+ *placement of thumbnails*
84
+
85
+ To adjust placement of thumbnails, use: `prependTo` or `appendTo` in `gallery/responsive.js`:
86
+
87
+ ``javascript
88
+ _addImageWrapper= function() {
89
+
90
+ // adds the structure for the large image and the navigation buttons (if total items > 1)
91
+ // also initializes the navigation events
92
+ $('#img-wrapper-tmpl').tmpl( {itemsCount : itemsCount} ).prependTo( $rgGallery )
93
+ ```
94
+
95
+ *Automatic slideshow*
96
+
97
+ I wanted the same thing and I find a way to do it.
98
+ In the file gallery.js, in the function _initCarousel add these lines after `$esCarousel.elastislide( ‘setCurrent’, current );` (~ line 103):
99
+
100
+ ```javascript
101
+ window.setInterval(function(){
102
+ _navigate( ‘right’ );
103
+ }, 5000);
104
+ ```
105
+
106
+ You just have to change 5000 to the value you want (milliseconds).
107
+
108
+ ## Galleria
109
+
110
+ See [galleria.io](http://galleria.io) for more info.
111
+
112
+ ## Rails engine usage
113
+
114
+ This gem is a Rails 3+ engine :)
115
+
116
+ Some *HAML* views (partials) are included in `app/views/gallery`
117
+
118
+ ## Rails views usage
119
+
120
+ ```ruby
121
+ class PropertiesController < ApplicationController
122
+ def show
123
+ @property = property
124
+ end
125
+
126
+ protected
127
+
128
+ def property
129
+ Hashie::Mash.new title: 'A beautiful property',
130
+ description: decription,
131
+ photos: photos
132
+ end
133
+
134
+ def description
135
+ %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.
136
+ }
137
+ end
138
+
139
+ def photos
140
+ @photos ||= RGallery::Photos.new nil, photo_class: Property::Photo
141
+ 5.times do
142
+ @photos.pages << 6.times.map {|n| (Kernel.rand(7) + 1).to_s }
143
+ end
144
+ @photos
145
+ end
146
+ end
147
+ ```
148
+
149
+ This engine comes with a RGallery::Photos` model which can encapsulate your photos for display and allows you to group photos in multiple pages.
150
+ The `RGallery::Photo` class is a base class for describing a photo.
151
+
152
+ You should create your own Photo class that inherits from `RGallery::Photo` (or implements the API), which knows how to render and describe your photos.
153
+
154
+ Here a rough example:
155
+
156
+ ```ruby
157
+ class Property
158
+ class Photo < RGallery::Photo
159
+ def path
160
+ File.join folder, super
161
+ end
162
+
163
+ # mogrify -path fullpathto/temp2 -resize 60x60% -quality 60 -format jpg *.png
164
+
165
+ # this will take all png files in your current directory (temp),
166
+ # resize to 60% (of largest dimension and keep aspect ratio),
167
+ # set jpg quality to 60 and convert to jpg.
168
+ def thumb
169
+ File.join folder, 'thumbs', file_path
170
+ end
171
+
172
+ def folder
173
+ 'responsive-gallery/images'
174
+ end
175
+
176
+ def title
177
+ 'property title'
178
+ end
179
+
180
+ def alt
181
+ 'property alt'
182
+ end
183
+
184
+ def self.extension
185
+ :jpg
186
+ end
187
+ end
188
+ end
189
+ ```
190
+
191
+ See the `lib/rails-gallery/rgallery/photos.rb
192
+
193
+ Then in your `properties/show.html.haml`:
194
+
195
+ *Responsive Gallery*
196
+
197
+ ```haml
198
+ = render partial: 'gallery/template/responsive'
199
+ = render partial: 'gallery/responsive', locals: { photos: @property.photos }
200
+ ```
201
+
202
+ Note :Currently only the *responsive* gallery uses a template, and thus requires rendering an extra partial.
203
+
204
+ *Slideshow Gallery*
205
+
206
+ ```haml
207
+ = render partial: 'gallery/slideshow', locals: { photos: @property.photos }
208
+ ```
209
+
210
+ *Galleria*
211
+
212
+ ```haml
213
+ = render partial: 'gallery/galleria', locals: { photos: @property.photos }
214
+ ```
215
+
216
+ All galleries should follow this convention (or as close as possible)
217
+
218
+ ## Labels
219
+
220
+ Note that all gallery labels are rendered using Rails I18n `I18n.t`.
221
+ You should include appropriate translations for the following keys under 'rgallery':
222
+
223
+ * previous
224
+ * next
225
+ * photos_loading
226
+
227
+ The engine includes a `config/locales/rails_gallery.yml` file, currently only with english translation mappings. Include a `config/locales/rails_gallery.yml` file in your Rails app and override or supply you additional translation mappings ;)
228
+
229
+ ## View helpers
230
+
231
+ There are also some view helpers included in `rails-gallery/view_helper.rb`
232
+
233
+ `= gallery_image type, photo`
234
+
235
+ Simple example:
236
+
237
+ Iterate all photos as a "single page".
238
+
239
+ ```haml
240
+ - photos.all.each do |photo|
241
+ = gallery_image :responsive, photo`
242
+ ```
243
+
244
+ Pages example:
245
+
246
+ Iterate photos, one page at a time.
247
+
248
+ ```haml
249
+ - photos.pages.each do |photo|
250
+ = gallery_image :responsive, photo`
251
+ ```
252
+
253
+ Advanced example:
254
+
255
+ Iterate photos, first page visible, then remaining pages invisible.
256
+
257
+ ```haml
258
+ .page.visible
259
+ - photos.page(:first).photos.each do |photo|
260
+ = gallery_image :responsive, photo`
261
+
262
+ - photos.pages.remainder.each do |page|
263
+ .page.hidden
264
+ - page.photos.each do |photo|
265
+ = gallery_image :responsive, photo`
266
+ ```
267
+
268
+ Enjoy!
269
+
270
+ ## Adding more galleries
271
+
272
+ Simply follow the existing conventions (see the code).
273
+
274
+ *ViewHelpers*
275
+
276
+ Add the gallery name to the `#galleries` class method of the `ViewHelper` and create a module for that gallery with a `[name]_gallery_image(photo)` method.
277
+
278
+ Then add gallery client-side pieces to the assets folder following conventions and make sure that your css files (and possible js files) references the icons used (and any other asset) correctly using `/assets/` in the path ;)
279
+
280
+ ## TODO
281
+
282
+ Would perhaps be nice to allow pages/albums to have info assigned, such as title and/or description, tags etc. ?
283
+
284
+ ## Contributing to rails-gallery
285
+
286
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
287
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
288
+ * Fork the project.
289
+ * Start a feature/bugfix branch.
290
+ * Commit and push until you are happy with your contribution.
291
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
292
+ * 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.
293
+
294
+ ## Copyright
295
+
296
+ Copyright (c) 2012 Kristian Mandrup. See LICENSE.txt for
297
+ further details.
298
+
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "rails-gallery"
18
+ gem.homepage = "http://github.com/kristianmandrup/rails-gallery"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Javascript galleries & carousels for instant use with Rails 3+ :)}
21
+ gem.description = %Q{Adds popular javascript galleries to asset pipeline and includes a few Rails Gallery utils and helpers}
22
+ gem.email = "kmandrup@gmail.com"
23
+ gem.authors = ["Kristian Mandrup"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "rails-gallery #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -0,0 +1,4 @@
1
+ #galleria
2
+ - photos.all.each do |photo|
3
+ %a{href:"/assets/#{photo.path}"}
4
+ = image_tag photo.path, :"data-title" => photo.title, :"data-description" => photo.description
@@ -0,0 +1,15 @@
1
+ #rg-gallery.rg-gallery
2
+ .rg-thumbs
3
+ // Elastislide Carousel Thumbnail Viewer
4
+ .es-carousel-wrapper
5
+ .es-nav
6
+ %span.es-nav-prev
7
+ = t('rgallery.previous')
8
+ %span.es-nav-next
9
+ = t('rgallery.next')
10
+ .es-carousel
11
+ %ul
12
+ - photos.all.each do |photo|
13
+ %li
14
+ %a{href:"#"}
15
+ = image_tag photo.thumb, :"data-large" => "/assets/#{photo.path}", :alt => photo.alt, :"data-description" => photo.title