hermitage 0.0.2.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### 0.0.3 ###
2
+
3
+ * *Attention*! In this version some options were renamed: attribute_full_size -> original, attribute_thumbnail -> thumbnail.
4
+ * Added more viewer customization options
5
+ * Ability to set any custom CSS for any viewer element
6
+ * Ability to enable or disable looped navigation
7
+ * More neat navigation buttons
8
+ * Adjust viewer on window resize
9
+ * Bottom panel added. Now you can set image descriptions by passing `title` option to `render_gallery_for` method or config.
10
+
1
11
  ### 0.0.2.1 ###
2
12
 
3
13
  * Fixed conflict with Twitter Bootstrap in Firefox and Opera.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/ImmaculatePine/hermitage.png?branch=master)](https://travis-ci.org/ImmaculatePine/hermitage)
4
4
 
5
- Ruby library for generation of image galleries (thumbnails and full size images viewer).
5
+ Ruby library for generation of image galleries (thumbnails and original images viewer).
6
6
 
7
7
  ## Requirements
8
8
 
@@ -60,13 +60,13 @@ You can pass options hash to `render_gallery_for` method if you want to customiz
60
60
  E.g. your `Photo` model has methods `image_full` and `image_thumb` that return path to full image and its thumbnail, respectively.
61
61
  Then you can write in your view file:
62
62
 
63
- render_gallery_for @photos, attribute_full_size: 'image_full', attribute_thumbnail: 'image_thumb'
63
+ render_gallery_for @photos, original: 'image_full', thumbnail: 'image_thumb'
64
64
 
65
65
  Then Hermitage will use the specified methods to get paths to your images and thumbnails.
66
66
 
67
67
  If the only method returns both paths according to passed parameters you can specify it like this:
68
68
 
69
- render_gallery_for @posts, attribute_full_size: 'attachment(:full)', attribute_thumbnail: 'attachment(:thumbnail)'
69
+ render_gallery_for @posts, original: 'attachment(:full)', thumbnail: 'attachment(:thumbnail)'
70
70
 
71
71
  #### Markup
72
72
 
@@ -80,7 +80,7 @@ Hermitage renders markup that will look nice with Twitter Bootstrap by default:
80
80
  </li>
81
81
  </ul>
82
82
 
83
- You can configure any element of this markup by overwriting `list_tag`, `item_tag`, `list_class`, `item_class`, `link_class` and `image_class` properties.
83
+ You can configure any element of this markup by overwriting `list_tag`, `item_tag`, `list_class`, `item_class`, `link_class`, `image_class` and `title` properties.
84
84
 
85
85
  For example this line of code:
86
86
 
@@ -96,6 +96,21 @@ will render the following markup:
96
96
  </p>
97
97
  </div>
98
98
 
99
+ #### Specify Image Title
100
+
101
+ You can add `title` attribute to generated links by passing `title` option to `render_gallery_for` method:
102
+
103
+ render_gallery_for @images, title: 'description' # assuming that image.description returns some text
104
+
105
+ It will render something like that:
106
+
107
+ <div class="thumbnails">
108
+ ...
109
+ <a href="/path/to/full/image" class="thumbnail" rel="hermitage" title="This is photo of my cat.">
110
+ ...
111
+
112
+ If the link has title attribute there will be bottom panel with this text when you open the gallery.
113
+
99
114
  #### Slicing
100
115
 
101
116
  If you are using Twitter Bootstrap framework and your gallery is inside `.row-fluid` block the markup above will not look awesome.
@@ -124,8 +139,8 @@ You can overwrite :default config. These changes will be applied to all the gall
124
139
  Uncoment the following lines in config/initializers/hermitage.rb file and make some changes here:
125
140
 
126
141
  Hermitage.configs[:default].merge!({
127
- attribute_full_size: 'image.url(:medium)',
128
- attribute_thumbnail: 'image.url(:small)'
142
+ original: 'image.url(:medium)',
143
+ thumbnail: 'image.url(:small)'
129
144
  })
130
145
 
131
146
  Now Hermitage will use `image.url` method with :medium or :small argument to get images for the gallery.
@@ -155,13 +170,13 @@ Then your config/initializers/hermitage.rb could looks like this:
155
170
  # Some rules for :default config if needed...
156
171
 
157
172
  Hermitage.configs[:pictures] = {
158
- attribute_full_size: 'image_path',
159
- attribute_thumbnail: 'image_path(:small)'
173
+ original: 'image_path',
174
+ thumbnail: 'image_path(:small)'
160
175
  }
161
176
 
162
177
  Hermitage.configs[:posts] = {
163
- attribute_full_size: 'attachment',
164
- attribute_thumbnail: 'attachment(:tiny)',
178
+ original: 'attachment',
179
+ thumbnail: 'attachment(:tiny)',
165
180
  list_tag: :div,
166
181
  item_tag: div,
167
182
  list_class: 'posts',
@@ -184,30 +199,32 @@ So, Hermitage looks for parameters with the following priority:
184
199
  You can customize appearance of Hermitage image viewer. All you need is to add to any of your .js or .coffee files lines like this:
185
200
 
186
201
  hermitage.darkening.opacity = 0
187
- hermitage.navigationButton.color = '#faeedd'
202
+ hermitage.navigationButtons.styles = { color: '#faeedd' }
188
203
 
189
- In the example above the darkening will be disabled and navigation buttons will change their color.
204
+ In the example above the darkening will be disabled and both navigation buttons will change their color.
190
205
 
191
206
  You can customize the following parameters:
192
207
 
193
- * `zIndex` - image viewer's z-index property
208
+ * `looped` - set it to false if after the last image the first should not be shown
194
209
  * `darkening.opacity` - opacity of darkening layer (0 if it should be disabled)
195
- * `darkening.color` - color of darkening layer
196
- * `navigationButton.enabled` - are there navigation buttons
197
- * `navigationButton.color` - color of navigation buttons
198
- * `navigationButton.width` - width of navigation buttons, px
199
- * `navigationButton.borderRadius` - border radius of outer corners of navigation buttons, px
200
- * `navigationButton.margin` - distance between navigation buttons and the image, px
210
+ * `darkening.styles` - any custom CSS for darkening layer
211
+ * `navigationButtons.enabled` - are there navigation buttons
212
+ * `navigationButtons.styles` - any custom CSS for both navigation buttons
213
+ * `navigationButtons.next.styles` - any custom CSS for next navigation button
214
+ * `navigationButtons.previous.styles` - any custom CSS for previous navigation button
215
+ * `navigationButtons.next.text` - text for next navigation button
216
+ * `navigationButtons.previous.text` - text for previous navigation button
201
217
  * `closeButton.enabled` - is there close button
202
218
  * `closeButton.text` - close button's text
203
- * `closeButton.color` - close button's color
204
- * `closeButton.fontSize` - close button's font size
205
- * `windowPadding.x` - minimum distance between window borders and the image by x axis, px
206
- * `windowPadding.y` - minimum distance between window borders and the image by y axis, px
219
+ * `closeButton.styles` - any custom CSS for close button
220
+ * `image.styles` - any custom CSS for current image
221
+ * `bottomPanel.styles` - any custom CSS for bottom panel
222
+ * `bottomPanel.text.styles` - any custom CSS for text block of bottom panel
207
223
  * `minimumSize.width` - minimum width of scaled image, px
208
224
  * `minimumSize.height` - minimum height of scaled image, px
209
225
  * `animationDuration` - duration of UI animations, ms
210
-
226
+ * `resizeTimeout` - timeout before moving elements to the proper places after resizing, ms
227
+
211
228
  ## Contributing
212
229
 
213
230
  1. Fork it