refinerycms-jquery_gallery 1.0
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/app/assets/images/gallery_view/btnCarouselNext.gif +0 -0
- data/app/assets/images/gallery_view/btnCarouselPrev.gif +0 -0
- data/app/assets/images/gallery_view/loader.gif +0 -0
- data/app/assets/images/gallery_view/themes/dark/next.gif +0 -0
- data/app/assets/images/gallery_view/themes/dark/panel-nav-next.gif +0 -0
- data/app/assets/images/gallery_view/themes/dark/panel-nav-prev.gif +0 -0
- data/app/assets/images/gallery_view/themes/dark/prev.gif +0 -0
- data/app/assets/images/gallery_view/themes/light/next.gif +0 -0
- data/app/assets/images/gallery_view/themes/light/panel-nav-next.gif +0 -0
- data/app/assets/images/gallery_view/themes/light/panel-nav-prev.gif +0 -0
- data/app/assets/images/gallery_view/themes/light/prev.gif +0 -0
- data/app/assets/javascripts/enable_galleries.js +9 -0
- data/app/assets/javascripts/gallery_view/jquery.galleryview-2.1.1.js +1042 -0
- data/app/assets/javascripts/gallery_view/jquery.timers-1.2.js +138 -0
- data/app/assets/javascripts/refinerycms_jquery_gallery.js +2 -0
- data/app/assets/stylesheets/refinerycms_jquery_gallery.css.scss +38 -0
- data/app/views/refinery/jquery_gallery/_gallery.html.haml +18 -0
- data/lib/refinery/jquery_gallery.rb +15 -0
- data/lib/refinery/jquery_gallery/engine.rb +12 -0
- data/lib/refinerycms-jquery_gallery.rb +1 -0
- data/readme.md +41 -0
- metadata +88 -0
@@ -0,0 +1,138 @@
|
|
1
|
+
/**
|
2
|
+
* jQuery.timers - Timer abstractions for jQuery
|
3
|
+
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
|
4
|
+
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
|
5
|
+
* Date: 2009/10/16
|
6
|
+
*
|
7
|
+
* @author Blair Mitchelmore
|
8
|
+
* @version 1.2
|
9
|
+
*
|
10
|
+
**/
|
11
|
+
|
12
|
+
jQuery.fn.extend({
|
13
|
+
everyTime: function(interval, label, fn, times) {
|
14
|
+
return this.each(function() {
|
15
|
+
jQuery.timer.add(this, interval, label, fn, times);
|
16
|
+
});
|
17
|
+
},
|
18
|
+
oneTime: function(interval, label, fn) {
|
19
|
+
return this.each(function() {
|
20
|
+
jQuery.timer.add(this, interval, label, fn, 1);
|
21
|
+
});
|
22
|
+
},
|
23
|
+
stopTime: function(label, fn) {
|
24
|
+
return this.each(function() {
|
25
|
+
jQuery.timer.remove(this, label, fn);
|
26
|
+
});
|
27
|
+
}
|
28
|
+
});
|
29
|
+
|
30
|
+
jQuery.extend({
|
31
|
+
timer: {
|
32
|
+
global: [],
|
33
|
+
guid: 1,
|
34
|
+
dataKey: "jQuery.timer",
|
35
|
+
regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
|
36
|
+
powers: {
|
37
|
+
// Yeah this is major overkill...
|
38
|
+
'ms': 1,
|
39
|
+
'cs': 10,
|
40
|
+
'ds': 100,
|
41
|
+
's': 1000,
|
42
|
+
'das': 10000,
|
43
|
+
'hs': 100000,
|
44
|
+
'ks': 1000000
|
45
|
+
},
|
46
|
+
timeParse: function(value) {
|
47
|
+
if (value == undefined || value == null)
|
48
|
+
return null;
|
49
|
+
var result = this.regex.exec(jQuery.trim(value.toString()));
|
50
|
+
if (result[2]) {
|
51
|
+
var num = parseFloat(result[1]);
|
52
|
+
var mult = this.powers[result[2]] || 1;
|
53
|
+
return num * mult;
|
54
|
+
} else {
|
55
|
+
return value;
|
56
|
+
}
|
57
|
+
},
|
58
|
+
add: function(element, interval, label, fn, times) {
|
59
|
+
var counter = 0;
|
60
|
+
|
61
|
+
if (jQuery.isFunction(label)) {
|
62
|
+
if (!times)
|
63
|
+
times = fn;
|
64
|
+
fn = label;
|
65
|
+
label = interval;
|
66
|
+
}
|
67
|
+
|
68
|
+
interval = jQuery.timer.timeParse(interval);
|
69
|
+
|
70
|
+
if (typeof interval != 'number' || isNaN(interval) || interval < 0)
|
71
|
+
return;
|
72
|
+
|
73
|
+
if (typeof times != 'number' || isNaN(times) || times < 0)
|
74
|
+
times = 0;
|
75
|
+
|
76
|
+
times = times || 0;
|
77
|
+
|
78
|
+
var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
|
79
|
+
|
80
|
+
if (!timers[label])
|
81
|
+
timers[label] = {};
|
82
|
+
|
83
|
+
fn.timerID = fn.timerID || this.guid++;
|
84
|
+
|
85
|
+
var handler = function() {
|
86
|
+
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
|
87
|
+
jQuery.timer.remove(element, label, fn);
|
88
|
+
};
|
89
|
+
|
90
|
+
handler.timerID = fn.timerID;
|
91
|
+
|
92
|
+
if (!timers[label][fn.timerID])
|
93
|
+
timers[label][fn.timerID] = window.setInterval(handler,interval);
|
94
|
+
|
95
|
+
this.global.push( element );
|
96
|
+
|
97
|
+
},
|
98
|
+
remove: function(element, label, fn) {
|
99
|
+
var timers = jQuery.data(element, this.dataKey), ret;
|
100
|
+
|
101
|
+
if ( timers ) {
|
102
|
+
|
103
|
+
if (!label) {
|
104
|
+
for ( label in timers )
|
105
|
+
this.remove(element, label, fn);
|
106
|
+
} else if ( timers[label] ) {
|
107
|
+
if ( fn ) {
|
108
|
+
if ( fn.timerID ) {
|
109
|
+
window.clearInterval(timers[label][fn.timerID]);
|
110
|
+
delete timers[label][fn.timerID];
|
111
|
+
}
|
112
|
+
} else {
|
113
|
+
for ( var fn in timers[label] ) {
|
114
|
+
window.clearInterval(timers[label][fn]);
|
115
|
+
delete timers[label][fn];
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
for ( ret in timers[label] ) break;
|
120
|
+
if ( !ret ) {
|
121
|
+
ret = null;
|
122
|
+
delete timers[label];
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
for ( ret in timers ) break;
|
127
|
+
if ( !ret )
|
128
|
+
jQuery.removeData(element, this.dataKey);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
});
|
133
|
+
|
134
|
+
jQuery(window).bind("unload", function() {
|
135
|
+
jQuery.each(jQuery.timer.global, function(index, item) {
|
136
|
+
jQuery.timer.remove(item);
|
137
|
+
});
|
138
|
+
});
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#body_content #page_images, #page_images {
|
2
|
+
background-color: black;
|
3
|
+
padding: 10px 5px;
|
4
|
+
|
5
|
+
#gallery {
|
6
|
+
margin: 0 auto;
|
7
|
+
|
8
|
+
.pointer {
|
9
|
+
border-bottom-color: #AAA;
|
10
|
+
}
|
11
|
+
|
12
|
+
img {
|
13
|
+
border: 0;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
.refinerycms-properties {
|
20
|
+
#body_content {
|
21
|
+
#page_images {
|
22
|
+
background-color: black;
|
23
|
+
padding: 10px 5px;
|
24
|
+
|
25
|
+
#gallery {
|
26
|
+
margin: 0 auto;
|
27
|
+
|
28
|
+
.pointer {
|
29
|
+
border-bottom-color: #AAA;
|
30
|
+
}
|
31
|
+
|
32
|
+
img {
|
33
|
+
border: 0;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
- unless page.images.empty?
|
2
|
+
#page_images
|
3
|
+
%ul#gallery
|
4
|
+
- page.images.each do |image|
|
5
|
+
%li
|
6
|
+
= image_tag(image.thumbnail("570x270#c").url)
|
7
|
+
|
8
|
+
= content_for :javascripts do
|
9
|
+
:javascript
|
10
|
+
$(document).ready(function(){
|
11
|
+
$('#gallery').galleryView({
|
12
|
+
panel_width: 640,
|
13
|
+
panel_height: 300,
|
14
|
+
frame_width: 75,
|
15
|
+
frame_height: 75,
|
16
|
+
theme_path: '/assets/gallery_view/themes/dark'
|
17
|
+
});
|
18
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
module Refinery
|
3
|
+
module JqueryGallery
|
4
|
+
# Our host application root path
|
5
|
+
# We set this when the engine is initialized
|
6
|
+
mattr_accessor :app_root
|
7
|
+
|
8
|
+
# Yield self on setup for nice config blocks
|
9
|
+
def self.setup
|
10
|
+
yield self
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'refinery/jquery_gallery/engine'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'refinery/jquery_gallery'
|
data/readme.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Jquery Gallery extension for Refinery CMS.
|
2
|
+
|
3
|
+
This extension uses the jquery Gallery View plugin to render a set of images in refinerycms.
|
4
|
+
|
5
|
+
This gallery works well with the refinerycms-page-images extension, but it does not automatically display
|
6
|
+
a gallery of page images. Installing this extension basically does nothing at all unless you
|
7
|
+
load the _gallery.html.haml template.
|
8
|
+
|
9
|
+
This template must be given a local "page" object, but actually this doesn't have to be a
|
10
|
+
Refinery::Page, it could be anything that supports a method called "images" that returns
|
11
|
+
an array of image objects which in turn can supply a url via "image.thumbnail("570x270#c").url".
|
12
|
+
|
13
|
+
If you wish to do this with all pages, simply add a call to this _gallery partial in your
|
14
|
+
_content_page partial:
|
15
|
+
|
16
|
+
```erb
|
17
|
+
<%= render 'refinery/jquery_gallery/gallery', :page => @page %>
|
18
|
+
```
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Simply install the gem. There is no generator or migrations.
|
23
|
+
|
24
|
+
You probably want to add a reference to the stylesheet "refinerycms_jquery_gallery" in your application.css.
|
25
|
+
|
26
|
+
## How to build this extension as a gem
|
27
|
+
|
28
|
+
gem build refinerycms-jquery_gallery.gemspec
|
29
|
+
gem install refinerycms-jquery_gallery.gem
|
30
|
+
|
31
|
+
# Sign up for a http://rubygems.org/ account and publish the gem
|
32
|
+
gem push refinerycms-jquery_gallery.gem
|
33
|
+
|
34
|
+
## Licence
|
35
|
+
|
36
|
+
This code us available under the MIT licence. See attached licence file for full details.
|
37
|
+
|
38
|
+
## Credits
|
39
|
+
|
40
|
+
Craig Ambrose
|
41
|
+
http://github.com/craigambrose
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refinerycms-jquery_gallery
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Craig Ambrose
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: refinerycms-core
|
16
|
+
requirement: &70107380546340 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.0.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70107380546340
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: refinerycms-testing
|
27
|
+
requirement: &70107380544860 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.5
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70107380544860
|
36
|
+
description: Ruby on Rails Jquery Gallery extension for Refinery CMS
|
37
|
+
email:
|
38
|
+
- craig@craigambrose.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- app/assets/images/gallery_view/btnCarouselNext.gif
|
44
|
+
- app/assets/images/gallery_view/btnCarouselPrev.gif
|
45
|
+
- app/assets/images/gallery_view/loader.gif
|
46
|
+
- app/assets/images/gallery_view/themes/dark/next.gif
|
47
|
+
- app/assets/images/gallery_view/themes/dark/panel-nav-next.gif
|
48
|
+
- app/assets/images/gallery_view/themes/dark/panel-nav-prev.gif
|
49
|
+
- app/assets/images/gallery_view/themes/dark/prev.gif
|
50
|
+
- app/assets/images/gallery_view/themes/light/next.gif
|
51
|
+
- app/assets/images/gallery_view/themes/light/panel-nav-next.gif
|
52
|
+
- app/assets/images/gallery_view/themes/light/panel-nav-prev.gif
|
53
|
+
- app/assets/images/gallery_view/themes/light/prev.gif
|
54
|
+
- app/assets/javascripts/enable_galleries.js
|
55
|
+
- app/assets/javascripts/gallery_view/jquery.galleryview-2.1.1.js
|
56
|
+
- app/assets/javascripts/gallery_view/jquery.timers-1.2.js
|
57
|
+
- app/assets/javascripts/refinerycms_jquery_gallery.js
|
58
|
+
- app/assets/stylesheets/refinerycms_jquery_gallery.css.scss
|
59
|
+
- app/views/refinery/jquery_gallery/_gallery.html.haml
|
60
|
+
- lib/refinery/jquery_gallery/engine.rb
|
61
|
+
- lib/refinery/jquery_gallery.rb
|
62
|
+
- lib/refinerycms-jquery_gallery.rb
|
63
|
+
- readme.md
|
64
|
+
homepage: https://github.com/craigambrose/refinerycms-jquery_gallery
|
65
|
+
licenses: []
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.8.17
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Jquery Gallery extension for Refinery CMS
|
88
|
+
test_files: []
|