refinerycms-6hoursdaily-photo-gallery 0.0.4.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/Gemfile +27 -0
  2. data/LICENSE.md +8 -0
  3. data/README.md +224 -0
  4. data/app/assets/images/refinery/photo_gallery/admin/chosen-sprite.png +0 -0
  5. data/app/assets/images/refinery/photo_gallery/admin/icons/album.png +0 -0
  6. data/app/assets/images/refinery/photo_gallery/admin/icons/album_add.png +0 -0
  7. data/app/assets/images/refinery/photo_gallery/admin/icons/album_edit.png +0 -0
  8. data/app/assets/images/refinery/photo_gallery/admin/icons/cog.png +0 -0
  9. data/app/assets/images/refinery/photo_gallery/admin/icons/down.gif +0 -0
  10. data/app/assets/images/refinery/photo_gallery/admin/icons/folder.png +0 -0
  11. data/app/assets/images/refinery/photo_gallery/admin/icons/folder_add.png +0 -0
  12. data/app/assets/images/refinery/photo_gallery/admin/icons/folder_edit.png +0 -0
  13. data/app/assets/images/refinery/photo_gallery/admin/icons/loading.gif +0 -0
  14. data/app/assets/images/refinery/photo_gallery/admin/icons/page_copy.png +0 -0
  15. data/app/assets/images/refinery/photo_gallery/admin/icons/photo.png +0 -0
  16. data/app/assets/images/refinery/photo_gallery/admin/icons/photo_add.png +0 -0
  17. data/app/assets/images/refinery/photo_gallery/admin/icons/photo_edit.png +0 -0
  18. data/app/assets/images/refinery/photo_gallery/admin/icons/up.gif +0 -0
  19. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/backgrounds.gif +0 -0
  20. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/buttons-disabled.png +0 -0
  21. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/buttons.png +0 -0
  22. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/delete.gif +0 -0
  23. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/done.gif +0 -0
  24. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/error.gif +0 -0
  25. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/throbber.gif +0 -0
  26. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.plupload.queue/transp50.png +0 -0
  27. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.ui.plupload/plupload-bw.png +0 -0
  28. data/app/assets/images/refinery/photo_gallery/admin/plupload/jquery.ui.plupload/plupload.png +0 -0
  29. data/app/assets/images/refinery/photo_gallery/admin/rss-feed.png +0 -0
  30. data/app/assets/images/refinery/photo_gallery/fancybox/blank.gif +0 -0
  31. data/app/assets/images/refinery/photo_gallery/fancybox/fancybox_loading.gif +0 -0
  32. data/app/assets/images/refinery/photo_gallery/fancybox/fancybox_sprite.png +0 -0
  33. data/app/assets/images/refinery/photo_gallery/fancybox/helpers/fancybox_buttons.png +0 -0
  34. data/app/assets/javascripts/refinery/photo_gallery/admin/jquery.chosen.min.js +10 -0
  35. data/app/assets/javascripts/refinery/photo_gallery/admin/photo_gallery.js +28 -0
  36. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/changelog.txt +218 -0
  37. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/cs.js +14 -0
  38. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/da.js +12 -0
  39. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/de.js +24 -0
  40. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/el.js +14 -0
  41. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/es.js +25 -0
  42. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/et.js +33 -0
  43. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fi.js +33 -0
  44. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fr-ca.js +35 -0
  45. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/fr.js +25 -0
  46. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/hr.js +25 -0
  47. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/hu.js +33 -0
  48. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/it.js +24 -0
  49. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ja.js +37 -0
  50. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ko.js +36 -0
  51. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/lv.js +33 -0
  52. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/nl.js +21 -0
  53. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/pl.js +24 -0
  54. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/pt-br.js +35 -0
  55. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ro.js +24 -0
  56. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ru.js +21 -0
  57. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sk.js +37 -0
  58. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sr.js +14 -0
  59. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/sv.js +12 -0
  60. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/jquery.plupload.queue.js +195 -0
  61. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/jquery.ui.plupload.js +383 -0
  62. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/license.txt +339 -0
  63. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.browserplus.js +1 -0
  64. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.flash.js +226 -0
  65. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.flash.swf +0 -0
  66. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.full.js +2525 -0
  67. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.full.js.default +2525 -0
  68. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.gears.js +1 -0
  69. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html4.js +1 -0
  70. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html5.js +765 -0
  71. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.html5.js.default +765 -0
  72. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.js +618 -0
  73. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.silverlight.js +1 -0
  74. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/plupload.silverlight.xap +0 -0
  75. data/app/assets/javascripts/refinery/photo_gallery/admin/plupload/readme.md +46 -0
  76. data/app/assets/javascripts/refinery/photo_gallery/fancybox/CHANGELOG.md +68 -0
  77. data/app/assets/javascripts/refinery/photo_gallery/fancybox/README.md +212 -0
  78. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-buttons.js +115 -0
  79. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-media.js +85 -0
  80. data/app/assets/javascripts/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-thumbs.js +157 -0
  81. data/app/assets/javascripts/refinery/photo_gallery/fancybox/jquery.fancybox.js +1463 -0
  82. data/app/assets/javascripts/refinery/photo_gallery/fancybox/jquery.fancybox.pack.js +35 -0
  83. data/app/assets/javascripts/refinery/photo_gallery/fancybox/lib/jquery.mousewheel-3.0.6.pack.js +13 -0
  84. data/app/assets/stylesheets/refinery/photo_gallery/admin/chosen.css.scss +396 -0
  85. data/app/assets/stylesheets/refinery/photo_gallery/admin/photo_gallery.css.scss +109 -0
  86. data/app/assets/stylesheets/refinery/photo_gallery/admin/plupload/jquery.plupload.queue.css.scss +177 -0
  87. data/app/assets/stylesheets/refinery/photo_gallery/admin/plupload/jquery.ui.plupload.css.scss +147 -0
  88. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-buttons.css.scss +85 -0
  89. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/helpers/jquery.fancybox-thumbs.css +54 -0
  90. data/app/assets/stylesheets/refinery/photo_gallery/fancybox/jquery.fancybox.css.scss +234 -0
  91. data/app/controllers/refinery/photo_gallery/admin/albums_controller.rb +23 -0
  92. data/app/controllers/refinery/photo_gallery/admin/collections_controller.rb +10 -0
  93. data/app/controllers/refinery/photo_gallery/admin/photos_controller.rb +67 -0
  94. data/app/controllers/refinery/photo_gallery/albums_controller.rb +23 -0
  95. data/app/controllers/refinery/photo_gallery/collections_controller.rb +28 -0
  96. data/app/helpers/refinery/photo_gallery/admin/photos_helper.rb +10 -0
  97. data/app/helpers/refinery/photo_gallery/albums_helper.rb +11 -0
  98. data/app/helpers/refinery/photo_gallery/photo_gallery_helper.rb +113 -0
  99. data/app/middleware/refinery/photo_gallery/admin/flash_session_cookie_middleware.rb +27 -0
  100. data/app/models/refinery/photo_gallery/album.rb +63 -0
  101. data/app/models/refinery/photo_gallery/collection.rb +29 -0
  102. data/app/models/refinery/photo_gallery/collection_album.rb +8 -0
  103. data/app/models/refinery/photo_gallery/photo.rb +63 -0
  104. data/app/uploaders/refinery/photo_gallery/admin/file_uploader.rb +122 -0
  105. data/app/views/refinery/photo_gallery/admin/_submenu.html.erb +44 -0
  106. data/app/views/refinery/photo_gallery/admin/albums/_album.html.erb +31 -0
  107. data/app/views/refinery/photo_gallery/admin/albums/_form.html.erb +78 -0
  108. data/app/views/refinery/photo_gallery/admin/albums/_sortable_list.html.erb +7 -0
  109. data/app/views/refinery/photo_gallery/admin/albums/edit.html.erb +2 -0
  110. data/app/views/refinery/photo_gallery/admin/albums/index.html.erb +28 -0
  111. data/app/views/refinery/photo_gallery/admin/albums/new.html.erb +2 -0
  112. data/app/views/refinery/photo_gallery/admin/collections/_collection.html.erb +23 -0
  113. data/app/views/refinery/photo_gallery/admin/collections/_form.html.erb +32 -0
  114. data/app/views/refinery/photo_gallery/admin/collections/_sortable_list.html.erb +7 -0
  115. data/app/views/refinery/photo_gallery/admin/collections/edit.html.erb +2 -0
  116. data/app/views/refinery/photo_gallery/admin/collections/index.html.erb +28 -0
  117. data/app/views/refinery/photo_gallery/admin/collections/new.html.erb +2 -0
  118. data/app/views/refinery/photo_gallery/admin/collections/test.html.erb +39 -0
  119. data/app/views/refinery/photo_gallery/admin/photos/_destroy.js.erb +15 -0
  120. data/app/views/refinery/photo_gallery/admin/photos/_form.html.erb +7 -0
  121. data/app/views/refinery/photo_gallery/admin/photos/_form_actions.html.erb +6 -0
  122. data/app/views/refinery/photo_gallery/admin/photos/_form_fields.html.erb +31 -0
  123. data/app/views/refinery/photo_gallery/admin/photos/_form_fields_actions.html.erb +15 -0
  124. data/app/views/refinery/photo_gallery/admin/photos/edit_multiple.html.erb +9 -0
  125. data/app/views/refinery/photo_gallery/admin/photos/upload.html.erb +87 -0
  126. data/app/views/refinery/photo_gallery/albums/show.html.erb +49 -0
  127. data/app/views/refinery/photo_gallery/collections/index.html.erb +13 -0
  128. data/app/views/refinery/photo_gallery/collections/show.html.erb +33 -0
  129. data/app/views/refinery/photo_gallery/shared/_layout.html.erb +22 -0
  130. data/app/views/refinery/photo_gallery/shared/_submenu.html.erb +5 -0
  131. data/config/initializers/carrierwave.rb +5 -0
  132. data/config/initializers/form_builder.rb +26 -0
  133. data/config/initializers/refinery/core.rb +10 -0
  134. data/config/initializers/s3.rb +11 -0
  135. data/config/initializers/session_store.rb +10 -0
  136. data/config/locales/en.yml +95 -0
  137. data/config/locales/sk.yml +94 -0
  138. data/config/routes.rb +37 -0
  139. data/db/migrate/20120804063842_create_albums.rb +18 -0
  140. data/db/migrate/20120805131321_create_collections.rb +14 -0
  141. data/db/migrate/20120805131547_create_collection_albums.rb +12 -0
  142. data/db/migrate/20120805165238_create_photos.rb +19 -0
  143. data/db/migrate/20120805222125_add_indexes.rb +24 -0
  144. data/db/seeds.rb +21 -0
  145. data/lib/generators/refinery/photo_gallery_generator.rb +25 -0
  146. data/lib/generators/refinery/templates/config/initializers/refinery/photo_gallery.rb.erb +40 -0
  147. data/lib/refinery/photo_gallery/configuration.rb +33 -0
  148. data/lib/refinery/photo_gallery/engine.rb +33 -0
  149. data/lib/refinery/photo_gallery/version.rb +17 -0
  150. data/lib/refinery/photo_gallery.rb +30 -0
  151. data/lib/refinerycms-photo-gallery.rb +1 -0
  152. data/refinerycms-6hoursdaily-photo-gallery.gemspec +38 -0
  153. data/screenshots/01_collections#index.png +0 -0
  154. data/screenshots/02_albums#create.png +0 -0
  155. data/screenshots/03_photos#upload.png +0 -0
  156. data/screenshots/04_photos#upload- chooser.png +0 -0
  157. data/screenshots/05_photo#upoad-queue.png +0 -0
  158. data/screenshots/06_photos#upload-uploading.png +0 -0
  159. data/screenshots/07_photos#upload-uploading_2.png +0 -0
  160. data/screenshots/08_photos#edit_multiple.png +0 -0
  161. data/screenshots/09_albums#index.png +0 -0
  162. data/screenshots/10_albums_EXIF_reading.png +0 -0
  163. data/screenshots/11_frontend_show.png +0 -0
  164. data/screenshots/12_show_photo_using_fancybox.png +0 -0
  165. metadata +353 -0
data/Gemfile ADDED
@@ -0,0 +1,27 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # gem 'refinerycms', '~> 2.0.3'
6
+
7
+ #loading from gemspec
8
+
9
+ # -- Cloud storage
10
+ # AWS S3 support. Can be disabled if using local file system instead of cloud storage.
11
+ # gem 'carrierwave'
12
+ # gem 'fog'
13
+
14
+ # -- Photo resizing
15
+ # MiniMagick
16
+ #gem "mini_magick"
17
+
18
+ # RMagick:
19
+ #gem "rmagick", :require => 'RMagick'
20
+
21
+ # FreeImage:
22
+ #gem "RubyInline"
23
+ #gem "image_science", :git => 'git://github.com/perezd/image_science.git'
24
+
25
+ # -- EXIF
26
+ # Mini exif tool. Can be disabled. Remove exif_read and exif_write filters in photo model
27
+ #gem "mini_exiftool"
data/LICENSE.md ADDED
@@ -0,0 +1,8 @@
1
+ MIT License
2
+ Copyright (c) 2012 Espen Antonsen, Martin Markech
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,224 @@
1
+ # Refinery CMS Photo Gallery
2
+
3
+ __Photo gallery engine for Refinery CMS.__
4
+
5
+ ## Requirements
6
+
7
+ This version of refinerycms-photo-gallery supports Rails 3.2.x and Refinery CMS ~> 2.0.3.
8
+
9
+ Client side image resizing with Plupload is possible on Firefox 3.5+ (with fixed quality) and Chrome.
10
+ Safari doesn't support direct data access to the selected files. Opera 12.00 + supports drag&drop and also client side image resizing.
11
+
12
+
13
+ ## Features
14
+
15
+ * Multiple photo uploading with [Plupload](http://www.plupload.com/) 1.5.4
16
+ * Support for multiple runtimes (because of bug now works only HTML5): HTML5, Flash, Gears, Silverlight, HTML4
17
+ * Client side photo resizing to do faster uploading on slow connections
18
+ * Server side resizing with Carrierwave
19
+ * Grouping albums to collections. Album can be placed in one or more collections.
20
+ * Ajax photo edit during uploading
21
+ * Reading EXIF records from file - GPS latitude/longitude, photo title, photo description (In Linux you can put EXIF data using [digiKam](www.digikam.org/) )
22
+ * Multiple photo editing at once
23
+ * Fully configurable, fully translatable, searchable
24
+ * Using [Fancybox](http://fancyapps.com/fancybox/) 2.0.6 for frontend image slideshow. Read Fancybox license before you
25
+ use it on profit websites.
26
+
27
+ ## Screenshots
28
+
29
+ All screenshots are in folder screenshots
30
+
31
+ ![Photo uploading](https://raw.github.com/Matho/refinerycms-photo-gallery/master/screenshots/07_photos%23upload-uploading_2.png)
32
+ ![Frontend album](https://raw.github.com/Matho/refinerycms-photo-gallery/master/screenshots/11_frontend_show.png)
33
+ ![Frontend album](https://raw.github.com/Matho/refinerycms-photo-gallery/master/screenshots/12_show_photo_using_fancybox.png)
34
+
35
+
36
+ ## Demo
37
+
38
+ TODO
39
+
40
+ ## Options
41
+
42
+ * choose runtimes
43
+ * set max file size
44
+ * on/off client side resizing
45
+ * set plupload locale
46
+ * file extensions white list
47
+ * delete original files after resizing to save disk space
48
+ * set dimmensions of photo versions without need to override uploader
49
+
50
+
51
+ ## Language
52
+
53
+ Gem is fully translated to slovak and english. Plupload is translated to 24 languages. You can add your own to
54
+ photo_gallery/app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n and enable it in config.plupload_locale
55
+
56
+
57
+ ## Working status
58
+
59
+ This is development snapshot. It is not suitable to production now, I'm going to fix bug list and todo list and then I will create stable branch/version.
60
+ But gem works, so if you want, feel free to try it and contribute :).
61
+
62
+ ## Installation
63
+
64
+ Make sure, you [have installed ImageMagick](http://www.imagemagick.org/script/install-source.php#unix) and ImageMagick dev.
65
+ On Ubuntu 12.04 you can install dev suite with commands:
66
+
67
+ ```ruby
68
+ sudo apt-get install libmagickcore-dev libmagickwand-dev
69
+ ```
70
+
71
+ Then you need to install command-line Exiftool application.
72
+ Instructions for installation you can find under [www.sno.phy.queensu.ca/~phil/exiftool/install.html](www.sno.phy.queensu.ca/~phil/exiftool/install.html).
73
+
74
+
75
+ Open up your ``Gemfile`` and add at the bottom this line:
76
+
77
+ ```ruby
78
+ gem 'refinerycms-photo-gallery', '~> 0.0.3.dev', :git => 'git://github.com/Matho/refinerycms-photo-gallery.git'
79
+ ```
80
+
81
+ Now, run
82
+
83
+ ```ruby
84
+ bundle install
85
+ ```
86
+
87
+ Next, to install the photo gallery plugin run:
88
+
89
+ ```ruby
90
+ rails g refinery:photo_gallery
91
+ ```
92
+
93
+ Run database migrations:
94
+
95
+ ```ruby
96
+ rake db:migrate
97
+ ```
98
+
99
+ Seed your database:
100
+
101
+ ```ruby
102
+ rake db:seed
103
+ ```
104
+
105
+ You can configure gem in ``your_app_name/config/initializers/refinery/photo_gallery.rb``
106
+
107
+ Check, if you have ``jquery.js`` included in your backend.
108
+
109
+ If you want to use Fancybox in frontend, copy ``photo_gallery/app/assets/images/refinery/photo_gallery/fancybox``, ``photo_gallery/app/assets/javascripts/refinery/photo_gallery/fancybox``, ``photo_gallery/app/assets/refinery/photo_gallery/stylesheets/fancybox`` to your
110
+ refinery cms assets directory.
111
+
112
+ Then you need to add fancybox js files to your js manifest file in ``your_app_name/app/javascripts/application.js``:
113
+
114
+ ```ruby
115
+ //= require fancybox/jquery.fancybox.pack
116
+ //= require fancybox/lib/jquery.mousewheel-3.0.6.pack
117
+ //= require fancybox/helpers/jquery.fancybox-buttons
118
+ ```
119
+
120
+ And fancybox css files in ``your_app_name/app/stylesheets/application.css``:
121
+
122
+ ```ruby
123
+ *= require jquery-ui-1.8.21.custom
124
+ *= require fancybox/jquery.fancybox
125
+ *= require fancybox/helpers/jquery.fancybox-buttons
126
+ ```
127
+
128
+ And initialize Fancybox in your_app_name/app/views/refinery/_javascripts.html.erb. If you don't have this file
129
+ in your app, override it using rake refinery:override command and add this line to it:
130
+
131
+ ```javascript
132
+ <script type="text/javascript">
133
+ $(document).ready(function() {
134
+ $(".fancybox").fancybox({
135
+ prevEffect : 'none',
136
+ nextEffect : 'none',
137
+ beforeShow : function(){
138
+ this.title = $(this.element).attr('data-title');
139
+ },
140
+ helpers : {
141
+ title : { type : 'outside' },
142
+ buttons : {},
143
+ overlay : {
144
+ opacity: 0.8,
145
+ css : {
146
+ 'background-color' : '#000'
147
+ }
148
+ }
149
+ }
150
+ }
151
+
152
+ );
153
+ });
154
+ </script>
155
+ ```
156
+
157
+ Before production, don't forget to precompile assets by:
158
+
159
+ ```ruby
160
+ rake assets:precompile
161
+ ```
162
+ ## Uninstall
163
+
164
+ ```ruby
165
+ rails destroy refinery:photo_gallery
166
+ ```
167
+ From your app db/migrate dir, remove migrations from
168
+
169
+ ``20120805130459_create_collections.refinery_photo_gallery.rb``
170
+
171
+ to
172
+
173
+ ``20120805130463_add_indexes.refinery_photo_gallery.rb``
174
+
175
+ Remove database tables. Run multiple times to remove all photo gallery tables:
176
+
177
+ ```ruby
178
+ rake db:rollback
179
+ ```
180
+ Remove fancybox assets folders, which you copied to you app assets and also remove them from your js/css manifests.
181
+
182
+ Remove fancybox init javascript from _javascripts.html.erb file
183
+
184
+ Remove gem from Gemfile
185
+
186
+ ## Todo list
187
+
188
+ * fix support for refinerycms-search gem in backend/frontend
189
+ * add support for amazon S3 storage
190
+ * create app tests
191
+ * repair problems with Flash runtime and test gears, silverlight and HTML4 runtime
192
+ * show live links in admin
193
+ * allow to check which photo is photo album preview
194
+ * set albums public/not public.
195
+ * add checkboxes to delete multiple/all photos in album
196
+ * stop uploading
197
+ * travis, codeclimate
198
+ * push to rubygem
199
+
200
+
201
+ ## Known bugs
202
+
203
+ * Only html5 runtime is now supported
204
+ * Files with spaces in file names are rejected if you upload them using drag&drop
205
+ * After collection is created, you are redirected to albums#index instead of collection#index
206
+ * Due to Opera bug I turn off Plupload client side mime type validation. It is able to choose files with non valid
207
+ file extensions to upload queue. ( But server side validation reject these files.).
208
+
209
+ ## Road map ?
210
+
211
+ * album/photo tags using acts_as_taggable
212
+ * show photo location on google maps
213
+ * caching ?
214
+ * GPS editing in degrees,minute,seconds format
215
+ * album grouping by year (configurable)
216
+
217
+ ## Testing
218
+
219
+ TODO
220
+
221
+ ## License
222
+
223
+ Refinery CMS Photo Gallery engine is released under the MIT license. Created by Martin Markech, inspired by
224
+ Espen Antonsen's [Balder photo gallery](http://balderapp.com/)
@@ -0,0 +1,10 @@
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.8
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ ((function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a})).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.set_default_text(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||Infinity},a.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?this.each(function(d){var e;e=a(this);if(!e.hasClass("chzn-done"))return e.data("chosen",new b(this,c))}):this}}),b=function(b){function e(){e.__super__.constructor.apply(this,arguments)}return f(e,b),e.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},e.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},e.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},e.prototype.register_observers=function(){var a=this;return this.container.mousedown(function(b){return a.container_mousedown(b)}),this.container.mouseup(function(b){return a.container_mouseup(b)}),this.container.mouseenter(function(b){return a.mouse_enter(b)}),this.container.mouseleave(function(b){return a.mouse_leave(b)}),this.search_results.mouseup(function(b){return a.search_results_mouseup(b)}),this.search_results.mouseover(function(b){return a.search_results_mouseover(b)}),this.search_results.mouseout(function(b){return a.search_results_mouseout(b)}),this.form_field_jq.bind("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.blur(function(b){return a.input_blur(b)}),this.search_field.keyup(function(b){return a.keyup_checker(b)}),this.search_field.keydown(function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.click(function(b){return a.choices_click(b)}),this.search_field.focus(function(b){return a.input_focus(b)})):this.container.click(function(a){return a.preventDefault()})},e.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},e.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&!this.results_showing&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},e.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(a)},e.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},e.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},e.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},e.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},e.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},e.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},e.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},e.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},e.prototype.results_show=function(){var a;if(!this.is_multiple)this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected);else if(this.max_selected_options<=this.choices)return this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1;return a=this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},e.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},e.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},e.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},e.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},e.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},e.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},e.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},e.prototype.choice_build=function(b){var c,d,e=this;return this.is_multiple&&this.max_selected_options<=this.choices?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(function(a){return e.choice_destroy_link_click(a)}))},e.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},e.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},e.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},e.prototype.results_reset_cleanup=function(){return this.selected_item.find("abbr").remove()},e.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b,this.selected_item.removeClass("chzn-default")),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[d.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()},e.prototype.result_activate=function(a){return a.addClass("active-result")},e.prototype.result_deactivate=function(a){return a.removeClass("active-result")},e.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[d.options_index].value}),this.search_field_scale()},e.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},e.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;this.no_results_clear(),j=0,k=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),g=this.search_contains?"":"^",f=new RegExp(g+k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),n=new RegExp(k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),s=this.results_data;for(o=0,q=s.length;o<q;o++){c=s[o];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,i=c.dom_id,h=a("#"+i);if(f.test(c.html))b=!0,j+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(p=0,r=e.length;p<r;p++)d=e[p],f.test(d)&&(b=!0,j+=1)}b?(k.length?(l=c.html.search(n),m=c.html.substr(0,l+k.length)+"</em>"+c.html.substr(l+k.length),m=m.substr(0,l)+"<em>"+m.substr(l)):m=c.html,h.html(m),this.result_activate(h),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&i===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(h))}}return j<1&&k.length?this.no_results(k):this.winnow_results_set_highlight()},e.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),b.hasClass("group-result")?f.push(b.css("display","auto")):!this.is_multiple||!b.hasClass("result-selected")?f.push(this.result_activate(b)):f.push(void 0);return f},e.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},e.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},e.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},e.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},e.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},e.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus"))},e.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},e.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},e.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i<j;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return c=a("<div />",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},e.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},e}(AbstractChosen),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this);
@@ -0,0 +1,28 @@
1
+ $(function() {
2
+ $('form#form_edit_photos').on("click", ".form-photo-field .form-actions-right .confirm-delete", function() {
3
+ if ( confirm( $(this).attr('data-confirm') ) ) {
4
+ $.ajax({
5
+ type: "POST",
6
+ dataType: 'script',
7
+ data: { '_method': 'delete' },
8
+ url: this.href
9
+ });
10
+ }
11
+
12
+ //TODO if all fields are deleted, show info - 0 photos and dont show form actions
13
+
14
+ return false;
15
+ });
16
+
17
+ $('#more_photo_options_field #toggle_advanced_options').click(function(e){
18
+ e.preventDefault();
19
+ $('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);
20
+
21
+ $('html,body').animate({
22
+ scrollTop: $('#toggle_advanced_options').parent().offset().top
23
+ }, 250);
24
+ });
25
+
26
+ $(".chzn-select").chosen();
27
+
28
+ });