gallery 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/gallery/admin/admin.js +2 -0
- data/app/assets/javascripts/gallery/admin/albums.js +2 -0
- data/app/assets/javascripts/gallery/albums.js +2 -0
- data/app/assets/javascripts/gallery/application.js +13 -0
- data/app/assets/javascripts/gallery/gallery.js.coffee +229 -0
- data/app/assets/javascripts/gallery/images_loaded.js +6 -0
- data/app/assets/javascripts/gallery/omniauth_callbacks.js +2 -0
- data/app/assets/javascripts/gallery/photos.js +2 -0
- data/app/assets/javascripts/gallery/spinner.js +1 -0
- data/app/assets/stylesheets/gallery/admin/admin.css +4 -0
- data/app/assets/stylesheets/gallery/admin/albums.css +4 -0
- data/app/assets/stylesheets/gallery/albums.css +4 -0
- data/app/assets/stylesheets/gallery/application.css +13 -0
- data/app/assets/stylesheets/gallery/omniauth_callbacks.css +4 -0
- data/app/assets/stylesheets/gallery/photos.css +4 -0
- data/app/assets/stylesheets/gallery/style.css.scss +193 -0
- data/app/controllers/gallery/admin/admin_controller.rb +14 -0
- data/app/controllers/gallery/admin/albums_controller.rb +36 -0
- data/app/controllers/gallery/albums_controller.rb +9 -0
- data/app/controllers/gallery/application_controller.rb +4 -0
- data/app/controllers/gallery/omniauth_callbacks_controller.rb +27 -0
- data/app/controllers/gallery/photos_controller.rb +23 -0
- data/app/helpers/gallery/admin/admin_helper.rb +4 -0
- data/app/helpers/gallery/admin/albums_helper.rb +4 -0
- data/app/helpers/gallery/albums_helper.rb +4 -0
- data/app/helpers/gallery/application_helper.rb +4 -0
- data/app/helpers/gallery/omniauth_callbacks_helper.rb +4 -0
- data/app/helpers/gallery/photos_helper.rb +4 -0
- data/app/models/gallery/album.rb +66 -0
- data/app/models/gallery/identity.rb +43 -0
- data/app/models/gallery/photo.rb +14 -0
- data/app/views/gallery/admin/admin/index.html.erb +46 -0
- data/app/views/gallery/admin/albums/show.html.erb +14 -0
- data/app/views/gallery/albums/_admin_album_element.html.erb +18 -0
- data/app/views/gallery/albums/_album_element.html.erb +15 -0
- data/app/views/gallery/albums/index.html.erb +9 -0
- data/config/initializers/omniauth.rb +18 -0
- data/config/routes.rb +22 -0
- data/db/migrate/20130806170912_create_gallery_identities.rb +14 -0
- data/db/migrate/20130806212451_add_token_to_identity.rb +5 -0
- data/db/migrate/20130806213308_create_gallery_albums.rb +19 -0
- data/db/migrate/20130806214102_create_gallery_photos.rb +18 -0
- data/db/migrate/20130806221405_add_public_to_album.rb +5 -0
- data/db/migrate/20130806221438_add_public_to_photo.rb +5 -0
- data/db/migrate/20130807113616_add_thumbnail_to_photo.rb +6 -0
- data/lib/gallery.rb +4 -0
- data/lib/gallery/engine.rb +9 -0
- data/lib/gallery/version.rb +3 -0
- data/lib/tasks/gallery_tasks.rake +4 -0
- data/test/controllers/gallery/admin/admin_controller_test.rb +9 -0
- data/test/controllers/gallery/admin/albums_controller_test.rb +9 -0
- data/test/controllers/gallery/albums_controller_test.rb +9 -0
- data/test/controllers/gallery/omniauth_callbacks_controller_test.rb +9 -0
- data/test/controllers/gallery/photos_controller_test.rb +9 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/gallery/albums.yml +23 -0
- data/test/fixtures/gallery/identities.yml +13 -0
- data/test/fixtures/gallery/photos.yml +21 -0
- data/test/gallery_test.rb +7 -0
- data/test/helpers/gallery/admin/admin_helper_test.rb +6 -0
- data/test/helpers/gallery/admin/albums_helper_test.rb +6 -0
- data/test/helpers/gallery/albums_helper_test.rb +6 -0
- data/test/helpers/gallery/omniauth_callbacks_helper_test.rb +6 -0
- data/test/helpers/gallery/photos_helper_test.rb +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/models/gallery/album_test.rb +9 -0
- data/test/models/gallery/identity_test.rb +9 -0
- data/test/models/gallery/photo_test.rb +9 -0
- data/test/test_helper.rb +15 -0
- metadata +324 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2013 YOURNAME
|
|
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/Rakefile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
8
|
+
|
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
+
rdoc.title = 'Gallery'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
18
|
+
load 'rails/tasks/engine.rake'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Bundler::GemHelper.install_tasks
|
|
23
|
+
|
|
24
|
+
require 'rake/testtask'
|
|
25
|
+
|
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
|
27
|
+
t.libs << 'lib'
|
|
28
|
+
t.libs << 'test'
|
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
|
30
|
+
t.verbose = false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
task default: :test
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# = require jquery
|
|
2
|
+
# = require jquery_ujs
|
|
3
|
+
# = require gallery/images_loaded
|
|
4
|
+
# = require gallery/spinner
|
|
5
|
+
|
|
6
|
+
$.fn.extend
|
|
7
|
+
gallery: (options) ->
|
|
8
|
+
# Default settings
|
|
9
|
+
settings =
|
|
10
|
+
foo: 'bar'
|
|
11
|
+
|
|
12
|
+
# Merge default settings with options.
|
|
13
|
+
settings = $.extend settings, options
|
|
14
|
+
|
|
15
|
+
# _Insert magic here._
|
|
16
|
+
return @each ()->
|
|
17
|
+
|
|
18
|
+
$.extend this,
|
|
19
|
+
currentPhoto: 0
|
|
20
|
+
loading: false
|
|
21
|
+
gallery: $(this).find('.gallery-album-photos')
|
|
22
|
+
canvas: $(this).find('.gallery-album-photos-canvas')
|
|
23
|
+
init: ->
|
|
24
|
+
# load initial set
|
|
25
|
+
@loadNextPhotos()
|
|
26
|
+
|
|
27
|
+
# set up arrows
|
|
28
|
+
@gallery.append('<span class="gallery-arrow-left"></span>')
|
|
29
|
+
@gallery.append('<span class="gallery-arrow-right"></span>')
|
|
30
|
+
@gallery.on 'click', '.gallery-arrow-left', $.proxy(@previous, this)
|
|
31
|
+
@gallery.on 'click', '.gallery-arrow-right', $.proxy(@next, this)
|
|
32
|
+
|
|
33
|
+
# set up full screen
|
|
34
|
+
@gallery.append('<span class="gallery-fullscreen"></span>')
|
|
35
|
+
@gallery.on 'click', '.gallery-fullscreen', $.proxy(@requestFullScreen, this)
|
|
36
|
+
@gallery.on 'webkitfullscreenchange mozfullscreenchange fullscreenchange', =>
|
|
37
|
+
@gallery.toggleClass 'fullscreen'
|
|
38
|
+
if !@gallery.hasClass 'fullscreen'
|
|
39
|
+
@gallery.height @pre_fullscreen_height
|
|
40
|
+
@canvas.find('img').width 300
|
|
41
|
+
@canvas.find('img').width 'auto'
|
|
42
|
+
|
|
43
|
+
@canvas.keydown (e) =>
|
|
44
|
+
switch e.which
|
|
45
|
+
when 37 then @previous()
|
|
46
|
+
when 39 then @next()
|
|
47
|
+
e.preventDefault()
|
|
48
|
+
# load more on scroll
|
|
49
|
+
@canvas.scroll () =>
|
|
50
|
+
scrollLeft = @canvas.scrollLeft()
|
|
51
|
+
if scrollLeft == 0
|
|
52
|
+
@currentPhoto = 0
|
|
53
|
+
else
|
|
54
|
+
for child, index in @canvas.children()
|
|
55
|
+
if child.offsetLeft > scrollLeft
|
|
56
|
+
@currentPhoto = index-1
|
|
57
|
+
break
|
|
58
|
+
if (@canvas[0].offsetWidth + scrollLeft) * 100 / @canvas[0].scrollWidth > 60
|
|
59
|
+
@loadNextPhotos(2)
|
|
60
|
+
|
|
61
|
+
loadNextPhotos: (count = 4) ->
|
|
62
|
+
if @loading or @gallery.find('img[loaded=false]').length == 0
|
|
63
|
+
return
|
|
64
|
+
@loading = true
|
|
65
|
+
|
|
66
|
+
# show spinner
|
|
67
|
+
@spinner_container = $('<div class="gallery-spinner"></div>')
|
|
68
|
+
@spinner_container.width (if @gallery.find('img[loaded=true]').length == 0 then '100%' else '5%')
|
|
69
|
+
@gallery.append @spinner_container
|
|
70
|
+
|
|
71
|
+
opts =
|
|
72
|
+
lines: 10
|
|
73
|
+
length: 5
|
|
74
|
+
width: 3
|
|
75
|
+
radius: 6
|
|
76
|
+
corners: 1
|
|
77
|
+
rotate: 0
|
|
78
|
+
direction: 1
|
|
79
|
+
color: '#000'
|
|
80
|
+
speed: 1
|
|
81
|
+
trail: 60
|
|
82
|
+
shadow: false
|
|
83
|
+
hwaccel: false
|
|
84
|
+
class: 'spinner'
|
|
85
|
+
zIndex: 2e9
|
|
86
|
+
|
|
87
|
+
@spinner = new Spinner(opts).spin(@spinner_container[0]);
|
|
88
|
+
|
|
89
|
+
images = @gallery.find('img[loaded=false]').slice(0, count)
|
|
90
|
+
$(images).imagesLoaded =>
|
|
91
|
+
setTimeout ( =>
|
|
92
|
+
$(images).attr('loaded', true).addClass 'loaded'
|
|
93
|
+
@loading = false
|
|
94
|
+
@spinner.stop()
|
|
95
|
+
@spinner_container.remove()
|
|
96
|
+
), 20
|
|
97
|
+
|
|
98
|
+
fullscreenEnabled = @gallery.hasClass 'fullscreen'
|
|
99
|
+
|
|
100
|
+
for image in images
|
|
101
|
+
if fullscreenEnabled then image.src = $(image).data('big-src') else image.src = $(image).data('src')
|
|
102
|
+
|
|
103
|
+
next: (evt) ->
|
|
104
|
+
# get current photo position
|
|
105
|
+
scrollLeft = @canvas.scrollLeft()
|
|
106
|
+
|
|
107
|
+
if scrollLeft == 0
|
|
108
|
+
@goToImage(1)
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
evt.stopPropagation() if evt.stopPropagation?
|
|
112
|
+
|
|
113
|
+
index = 0
|
|
114
|
+
for child, index in @canvas.children()
|
|
115
|
+
if child.offsetLeft > scrollLeft
|
|
116
|
+
@goToImage(index)
|
|
117
|
+
break
|
|
118
|
+
|
|
119
|
+
previous: (evt) ->
|
|
120
|
+
scrollLeft = @canvas.scrollLeft()
|
|
121
|
+
|
|
122
|
+
if scrollLeft == 0
|
|
123
|
+
@goToImage(1)
|
|
124
|
+
return
|
|
125
|
+
|
|
126
|
+
index = 0
|
|
127
|
+
for child, index in @canvas.children()
|
|
128
|
+
if child.offsetLeft >= scrollLeft
|
|
129
|
+
@goToImage(index-1)
|
|
130
|
+
break
|
|
131
|
+
|
|
132
|
+
evt.stopPropagation() if evt.stopPropagation?
|
|
133
|
+
|
|
134
|
+
requestFullScreen: ->
|
|
135
|
+
|
|
136
|
+
fullscreenEnabled = @gallery.hasClass 'fullscreen'
|
|
137
|
+
|
|
138
|
+
if fullscreenEnabled
|
|
139
|
+
|
|
140
|
+
if document.cancelFullScreen
|
|
141
|
+
document.cancelFullScreen()
|
|
142
|
+
else if document.mozCancelFullScreen
|
|
143
|
+
document.mozCancelFullScreen()
|
|
144
|
+
else if document.webkitCancelFullScreen
|
|
145
|
+
document.webkitCancelFullScreen()
|
|
146
|
+
else @cancelFallbackFullscreen()
|
|
147
|
+
|
|
148
|
+
@gallery.height @pre_fullscreen_height
|
|
149
|
+
|
|
150
|
+
# weird bug requires us to set width to auto or something
|
|
151
|
+
@canvas.find('img').width 300
|
|
152
|
+
@canvas.find('img').width 'auto'
|
|
153
|
+
|
|
154
|
+
else
|
|
155
|
+
|
|
156
|
+
# save height
|
|
157
|
+
@pre_fullscreen_height = @gallery.height()
|
|
158
|
+
|
|
159
|
+
if @gallery[0].requestFullScreen
|
|
160
|
+
@gallery[0].requestFullScreen()
|
|
161
|
+
else if @gallery[0].mozRequestFullScreen
|
|
162
|
+
@gallery[0].mozRequestFullScreen()
|
|
163
|
+
else if @gallery[0].webkitRequestFullScreen
|
|
164
|
+
@gallery[0].webkitRequestFullScreen()
|
|
165
|
+
else @requestFallbackFullscreen()
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@gallery.height "100%"
|
|
169
|
+
|
|
170
|
+
# convert all the images to their big-src
|
|
171
|
+
images = @canvas.find('img.loaded')
|
|
172
|
+
for image in images
|
|
173
|
+
if image.src != $(image).data('big-src')
|
|
174
|
+
do (image) ->
|
|
175
|
+
loading_image = new Image()
|
|
176
|
+
$(loading_image).load =>
|
|
177
|
+
image.src = loading_image.src
|
|
178
|
+
loading_image.src = $(image).data 'big-src'
|
|
179
|
+
|
|
180
|
+
setTimeout ( =>
|
|
181
|
+
@goToImage(@currentPhoto)), 400
|
|
182
|
+
|
|
183
|
+
requestFallbackFullscreen: ->
|
|
184
|
+
@parent = @gallery.parent()
|
|
185
|
+
fullscreen = $ '<div id="gallery-fallback-fullscreen"></div>'
|
|
186
|
+
$('body').append fullscreen
|
|
187
|
+
@gallery.detach()
|
|
188
|
+
fullscreen.append @gallery
|
|
189
|
+
@canvas = @gallery.find('.gallery-album-photos-canvas')
|
|
190
|
+
@gallery.addClass 'fullscreen'
|
|
191
|
+
|
|
192
|
+
cancelFallbackFullscreen: ->
|
|
193
|
+
@gallery.detach()
|
|
194
|
+
$('#gallery-fallback-fullscreen').remove()
|
|
195
|
+
@parent.append @gallery
|
|
196
|
+
@canvas.find('.gallery-album-photos-canvas')
|
|
197
|
+
@gallery.removeClass 'fullscreen'
|
|
198
|
+
goToImage: (index) ->
|
|
199
|
+
@currentPhoto = index
|
|
200
|
+
@canvas.animate({scrollLeft: @canvas.children()[index].offsetLeft}, 300)
|
|
201
|
+
|
|
202
|
+
this.init()
|
|
203
|
+
return this
|
|
204
|
+
decorate_gallery: (options) ->
|
|
205
|
+
|
|
206
|
+
settings =
|
|
207
|
+
foo: 'bar'
|
|
208
|
+
|
|
209
|
+
# Merge default settings with options.
|
|
210
|
+
settings = $.extend settings, options
|
|
211
|
+
|
|
212
|
+
# _Insert magic here._
|
|
213
|
+
return @each ()->
|
|
214
|
+
|
|
215
|
+
# for personal use, record height
|
|
216
|
+
|
|
217
|
+
height = $(this).height()
|
|
218
|
+
|
|
219
|
+
# TODO: set prefix in a config
|
|
220
|
+
$.getJSON "/gallery/albums/#{$(this).data('gallery-id')}/photos", (resp) =>
|
|
221
|
+
return if resp.length == 0
|
|
222
|
+
replacement = $("<div class='gallery-album'><div class='gallery-album-photos small'><div class='gallery-album-photos-canvas'></div></div></div>")
|
|
223
|
+
replacement.find('.gallery-album-photos').css 'height', height
|
|
224
|
+
canvas = replacement.find ".gallery-album-photos-canvas"
|
|
225
|
+
for image in resp
|
|
226
|
+
canvas.append "<img src='' alt='' data-src='#{image.thumbnail}' data-big-src='#{image.source}' loaded=false>"
|
|
227
|
+
$(this).replaceWith replacement
|
|
228
|
+
# set new element as new context
|
|
229
|
+
replacement.gallery()
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* imagesLoaded PACKAGED v3.0.4
|
|
3
|
+
* JavaScript is all like "You images are done yet or what?"
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function(){"use strict";function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}var n=e.prototype;n.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},n.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},n.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},n.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},n.on=n.addListener,n.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},n.once=n.addOnceListener,n.defineEvent=function(e){return this.getListeners(e),this},n.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},n.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},n.off=n.removeListener,n.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},n.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},n.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},n.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},n.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],o=n.listener.apply(this,t||[]),(o===this._getOnceReturnValue()||n.once===!0)&&this.removeListener(e,s[r][i].listener);return this},n.trigger=n.emitEvent,n.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},n.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},n._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},n._getEvents=function(){return this._events||(this._events={})},"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){"use strict";var t=document.documentElement,n=function(){};t.addEventListener?n=function(e,t,n){e.addEventListener(t,n,!1)}:t.attachEvent&&(n=function(t,n,i){t[n+i]=i.handleEvent?function(){var t=e.event;t.target=t.target||t.srcElement,i.handleEvent.call(i,t)}:function(){var n=e.event;n.target=n.target||n.srcElement,i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var i=function(){};t.removeEventListener?i=function(e,t,n){e.removeEventListener(t,n,!1)}:t.detachEvent&&(i=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var r={bind:n,unbind:i};"function"==typeof define&&define.amd?define(r):e.eventie=r}(this),function(e){"use strict";function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){return"[object Array]"===c.call(e)}function i(e){var t=[];if(n(e))t=e;else if("number"==typeof e.length)for(var i=0,r=e.length;r>i;i++)t.push(e[i]);else t.push(e);return t}function r(e,n){function r(e,n,s){if(!(this instanceof r))return new r(e,n);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=i(e),this.options=t({},this.options),"function"==typeof n?s=n:t(this.options,n),s&&this.on("always",s),this.getImages(),o&&(this.jqDeferred=new o.Deferred);var a=this;setTimeout(function(){a.check()})}function c(e){this.img=e}r.prototype=new e,r.prototype.options={},r.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},r.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},r.prototype.check=function(){function e(e,r){return t.options.debug&&a&&s.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},r.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify(t,e)})},r.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},o&&(o.fn.imagesLoaded=function(e,t){var n=new r(this,e,t);return n.jqDeferred.promise(o(this))});var f={};return c.prototype=new e,c.prototype.check=function(){var e=f[this.img.src];if(e)return this.useCached(e),void 0;if(f[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this.proxyImage=new Image;n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.img.src},c.prototype.useCached=function(e){if(e.isConfirmed)this.confirm(e.isLoaded,"cached was confirmed");else{var t=this;e.on("confirm",function(e){return t.confirm(e.isLoaded,"cache emitted confirmed"),!0})}},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},c.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},c.prototype.unbindProxyEvents=function(){n.unbind(this.proxyImage,"load",this),n.unbind(this.proxyImage,"error",this)},r}var o=e.jQuery,s=e.console,a=s!==void 0,c=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],r):e.imagesLoaded=r(e.EventEmitter,e.eventie)}(window);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),d=i.substring(0,i.indexOf("Animation")).toLowerCase(),u=d&&"-"+d+"-"||"";if(!e[a]){r.insertRule("@"+u+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;if(o[i]!==undefined)return i;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function d(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}var u={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function p(t){if(typeof this=="undefined")return new p(t);this.opts=l(t||{},p.defaults,u)}p.defaults={};l(p.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=d(t);a=d(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var u=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){u++;for(var t=0;t<n.lines;t++){c=Math.max(1-(u+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function d(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(d("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,d(e.color,"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function c(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");p.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),d;function u(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:i.color,opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(d=1;d<=i.lines;d++)u(d,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(d=1;d<=i.lines;d++)u(d);return n(e,l)};p.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var h=f(o("group"),{behavior:"url(#default#VML)"});if(!a(h,"transform")&&h.adj)c();else i=a(h,"animation");return p});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
@import "bourbon";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.gallery-album-admin {
|
|
5
|
+
width: 300px;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
margin: 10px;
|
|
8
|
+
border: 1px solid #d8d8d8;
|
|
9
|
+
-webkit-border-radius: 3px;
|
|
10
|
+
border-radius: 3px;
|
|
11
|
+
background-color: #fff;
|
|
12
|
+
border-bottom-width: 2px;
|
|
13
|
+
vertical-align: top;
|
|
14
|
+
|
|
15
|
+
p {
|
|
16
|
+
padding: 0px 5%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h3 {
|
|
20
|
+
padding: 0px 5%;
|
|
21
|
+
font-weight: 200;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
.gallery-album {
|
|
29
|
+
outline: none;
|
|
30
|
+
h3 {
|
|
31
|
+
font-weight: 200;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.gallery-album-photos {
|
|
38
|
+
outline: none;
|
|
39
|
+
position: relative;
|
|
40
|
+
height: 400px;
|
|
41
|
+
width: 100%;
|
|
42
|
+
background-color: #FFF;
|
|
43
|
+
|
|
44
|
+
&:-webkit-full-screen {
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.gallery-fullscreen {
|
|
49
|
+
@include transition(all 0.1s ease-in-out);
|
|
50
|
+
position: absolute;
|
|
51
|
+
width: 30px;
|
|
52
|
+
height: 20px;
|
|
53
|
+
bottom: 10px;
|
|
54
|
+
right: 10px;
|
|
55
|
+
border-radius: 5px;
|
|
56
|
+
background-color: rgba(255,255,255,0.5);
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
@include transform(scale(1.2));
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
background-color: rgba(255,255,255,1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:hover .gallery-fullscreen {
|
|
67
|
+
background-color: rgba(255,255,255,0.7);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.fullscreen .gallery-fullscreen:hover {
|
|
71
|
+
@include transform(scale(0.8));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.gallery-arrow-left, .gallery-arrow-right {
|
|
75
|
+
position: absolute;
|
|
76
|
+
width: 40px;
|
|
77
|
+
height: 40px;
|
|
78
|
+
top: 45%;
|
|
79
|
+
z-index: 10;
|
|
80
|
+
&:after, &:before {
|
|
81
|
+
background: rgba(255,255,255,0.3);
|
|
82
|
+
-moz-border-radius: 0.2em;
|
|
83
|
+
-webkit-border-radius: 0.2em;
|
|
84
|
+
border-radius: 0.2em;
|
|
85
|
+
content: "";
|
|
86
|
+
display: block;
|
|
87
|
+
height: 0.5em;
|
|
88
|
+
position: absolute;
|
|
89
|
+
right: 0;
|
|
90
|
+
width: 2em;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&:hover .gallery-arrow-left, &:hover .gallery-arrow-right {
|
|
95
|
+
&:after, &:before {
|
|
96
|
+
background: rgba(255,255,255,0.7);
|
|
97
|
+
// width: 3em;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.gallery-arrow-left:hover, .gallery-arrow-right:hover {
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
&:after, &:before {
|
|
104
|
+
background: rgba(255,255,255,1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.gallery-arrow-right {
|
|
109
|
+
right: 10px;
|
|
110
|
+
|
|
111
|
+
&:after {
|
|
112
|
+
bottom: 2em;
|
|
113
|
+
@include transform(rotate(45deg));
|
|
114
|
+
}
|
|
115
|
+
&:before {
|
|
116
|
+
bottom: 1em;
|
|
117
|
+
@include transform(rotate(-45deg));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.gallery-arrow-left {
|
|
122
|
+
left: 10px;
|
|
123
|
+
|
|
124
|
+
&:after {
|
|
125
|
+
bottom: 1em;
|
|
126
|
+
@include transform(rotate(45deg));
|
|
127
|
+
}
|
|
128
|
+
&:before {
|
|
129
|
+
bottom: 2em;
|
|
130
|
+
@include transform(rotate(-45deg));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.small {
|
|
135
|
+
.gallery-arrow-left {
|
|
136
|
+
left: 0px;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&:after {
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
position: absolute;
|
|
143
|
+
content: '';
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: 100%;
|
|
146
|
+
top: 0px;
|
|
147
|
+
box-shadow: inset 2px 2px 10px #aaa, inset -2px -2px 10px #aaa;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.gallery-spinner {
|
|
151
|
+
position: absolute;
|
|
152
|
+
height: 100%;
|
|
153
|
+
background-color: rgba(255,255,255,0.9);
|
|
154
|
+
top: 0px;
|
|
155
|
+
right: 0px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.gallery-album-photos-canvas {
|
|
160
|
+
outline: none;
|
|
161
|
+
width: 100%;
|
|
162
|
+
height: 100%;
|
|
163
|
+
overflow-x: scroll;
|
|
164
|
+
overflow-y: hidden;
|
|
165
|
+
white-space: nowrap;
|
|
166
|
+
|
|
167
|
+
img {
|
|
168
|
+
@include transition(all 1s ease-in-out);
|
|
169
|
+
display: inline-block;
|
|
170
|
+
height: 92.5%;
|
|
171
|
+
margin-top: 0.675%;
|
|
172
|
+
|
|
173
|
+
max-width: 1000000px;
|
|
174
|
+
vertical-align: top;
|
|
175
|
+
border-radius: 12px;
|
|
176
|
+
opacity: 0;
|
|
177
|
+
|
|
178
|
+
&.loaded {
|
|
179
|
+
opacity: 1;
|
|
180
|
+
margin-left: 2px;
|
|
181
|
+
margin-right: 2px;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#gallery-fallback-fullscreen {
|
|
187
|
+
position: fixed;
|
|
188
|
+
height: 100%;
|
|
189
|
+
width: 100%;
|
|
190
|
+
top: 0px;
|
|
191
|
+
left: 0px;
|
|
192
|
+
z-index: 10;
|
|
193
|
+
}
|