bcms_content_rotator 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYRIGHT.txt +23 -0
- data/GPL.txt +674 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +165 -0
- data/README.markdown +51 -0
- data/app/models/slide.rb +26 -1
- data/app/views/cms/slides/_form.html.erb +5 -3
- data/app/views/cms/slides/render.html.erb +3 -2
- data/app/views/layouts/templates/default.html.erb +1 -1
- data/app/views/portlets/content_rotator/_form.html.erb +14 -8
- data/app/views/portlets/content_rotator/render.html.erb +14 -56
- data/db/bcms_content_rotator.seeds.rb +4 -0
- data/db/migrate/{20101111030324_create_slides.rb → 20101111030324_bcms_content_rotator120.rb} +7 -5
- data/lib/bcms_content_rotator/engine.rb +9 -0
- data/lib/bcms_content_rotator/routes.rb +2 -2
- data/lib/bcms_content_rotator/version.rb +3 -0
- data/lib/bcms_content_rotator.rb +1 -0
- data/lib/generators/bcms_content_rotator/install/USAGE +10 -0
- data/lib/generators/bcms_content_rotator/install/install_generator.rb +13 -0
- data/lib/tasks/install.rake +8 -0
- data/public/bcms/content_rotator/content_rotator.js +39 -0
- metadata +52 -47
- data/app/controllers/application_controller.rb +0 -10
- data/app/helpers/application_helper.rb +0 -3
- data/rails/init.rb +0 -4
data/LICENSE.txt
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.markdown
CHANGED
@@ -1 +1,52 @@
|
|
1
1
|
# Content Rotator Module for BrowserCMS
|
2
|
+
|
3
|
+
This module allows editors to create a rotating jquery based slideshow. Each rotator can have up to five slides, which can feature an image, title and text that can auto rotate, or allow users to click on a specific slide to view it. It is commonly used on home pages to feature lots of content within a small area, with some visual interest due to the rotation.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
* _Rotator_ - Allows up to five slides in rotation. Staff can choose to enable autorotation, as well as how long between each slide.
|
8
|
+
* _Slides_ - Each slide represents a single frame within the rotation.
|
9
|
+
* _Preloading Slides_ - Editors can create as many slides as they like, and choose which slides should appear in the rotation and in what order.
|
10
|
+
|
11
|
+
### Slide Content Type
|
12
|
+
|
13
|
+
Each slide can consists of the following attributes:
|
14
|
+
|
15
|
+
* Title (String)
|
16
|
+
* Alt Text (String)
|
17
|
+
* Image (File) - An uploaded image which will be shown as the background of the slide.
|
18
|
+
* Description (Html)
|
19
|
+
* Link Url (URL) - Determines where the user goes when they click the slide.
|
20
|
+
* Nav Title (String) - The name for the clickable link to changes slides (If left blank, it will show the name of the slide).
|
21
|
+
|
22
|
+
|
23
|
+
## Installation
|
24
|
+
|
25
|
+
Follow the standard bcms module installation found here: http://guides.browsercms.org/installing_modules.html. If you are adding this to an existing project, you will also need to manually seed the database after running the migrations, like so:
|
26
|
+
|
27
|
+
$ rake db:migrate
|
28
|
+
$ rake db:seed:bcms_content_rotator
|
29
|
+
|
30
|
+
Since this module relies on jquery, manually the javascript_include_tag to your page templates for any page that the slide show will appear on, like so:
|
31
|
+
|
32
|
+
<head>
|
33
|
+
...
|
34
|
+
<%= javascript_include_tag 'jquery', :bcms_content_rotator %>
|
35
|
+
<%= yield :html_head %>
|
36
|
+
</head>
|
37
|
+
|
38
|
+
Once this is complete, you can add a new "Content Rotator Portlet" to any page. Create several slides, and edit the content rotator to choose the order.
|
39
|
+
|
40
|
+
|
41
|
+
### Customization Notes
|
42
|
+
|
43
|
+
* Each rotator's template is editable through the UI
|
44
|
+
* By default, each slide has a 'Read More >>' link that will link to the Link URL (if the URL is specified).
|
45
|
+
|
46
|
+
## Upgrading Notes
|
47
|
+
|
48
|
+
Upgrading this module from versions < 1.2.0 will require manual updates to the database.
|
49
|
+
|
50
|
+
* There is now one migration named bcms_content_rotator120.rb, with some new fields for attachments.
|
51
|
+
* The image_url column has been replaced with attachment ids.
|
52
|
+
* The portlet views have no javascript in them anymore (its now a separate js file), so it may be worth creating a new portlet and comparing the HTML view code.
|
data/app/models/slide.rb
CHANGED
@@ -1,3 +1,28 @@
|
|
1
1
|
class Slide < ActiveRecord::Base
|
2
|
-
acts_as_content_block
|
2
|
+
acts_as_content_block :belongs_to_attachment => true
|
3
|
+
|
4
|
+
def set_attachment_file_path
|
5
|
+
if !attachment_file.blank?
|
6
|
+
attachment.file_path = "/slides/attachment/#{Time.now.to_s(:year_month_day)}/#{name.to_slug}.#{attachment_file.original_filename.split('.').last.to_s.downcase}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_attachment_section
|
11
|
+
if !attachment_file.blank?
|
12
|
+
attachment.section = Section.first(:conditions => {:name => 'Slide'})
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def image_url
|
17
|
+
attachment.file_path
|
18
|
+
end
|
19
|
+
|
20
|
+
# The title of the link users click on the change slides.
|
21
|
+
def nav_title_or_name
|
22
|
+
navigation_title.blank? ? name : navigation_title
|
23
|
+
end
|
24
|
+
|
25
|
+
def has_link?
|
26
|
+
!link_url.blank?
|
27
|
+
end
|
3
28
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<%= f.cms_text_field :name %>
|
2
|
-
<%= f.
|
3
|
-
<%= f.cms_text_field :alt_text %>
|
1
|
+
<%= f.cms_text_field :name, :instructions=>"(Required) Title for this slide." %>
|
2
|
+
<%= f.cms_file_field :attachment_file, :label => "Image", :instructions => "(Required) Upload an image for the background of this slide." %>
|
3
|
+
<%= f.cms_text_field :alt_text, :instructions => "(Optional) Alt tag for each image. Displayed as tool tip when user mouse over." %>
|
4
|
+
<%= f.cms_text_field :link_url, :label=>"Link URL", :instructions=>"(Optional) Set a URL (i.e. http://...) to make the slide clickable. (If blank, images won't be be links.)" %>
|
5
|
+
<%= f.cms_text_field :navigation_title, :label=>"Nav Title", :instructions=>"(Optional) Title that users will click on to select a slide (If blank, 'name' will be used.)" %>
|
4
6
|
<%= f.cms_text_editor :description %>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<p><b>Name:</b> <%= h @content_block.name %></p>
|
2
|
-
<p><b>Image
|
2
|
+
<p><b>Image:</b> <%= image_tag @content_block.attachment.file_path %></p>
|
3
3
|
<p><b>Alt Text:</b> <%= h @content_block.alt_text %></p>
|
4
|
-
<p><b>Description:</b> <%= @content_block.description %></p>
|
4
|
+
<p><b>Description:</b> <%= @content_block.description.html_safe %></p>
|
5
|
+
<p><b>Link Url:</b> <%= @content_block.link_url %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
3
|
<head>
|
4
4
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
5
|
-
|
5
|
+
<%= javascript_include_tag 'jquery', :bcms_content_rotator %>
|
6
6
|
<title><%= page_title %></title>
|
7
7
|
<%= yield :html_head %>
|
8
8
|
</head>
|
@@ -1,10 +1,16 @@
|
|
1
|
-
<%
|
1
|
+
<%
|
2
|
+
@slides = Slide.all
|
3
|
+
@slide_map = @slides.map{|c| [c.name, c.id.to_s]}
|
4
|
+
%>
|
2
5
|
<%= f.cms_text_field :name %>
|
3
|
-
<%= f.cms_drop_down :slide_1_id, @
|
4
|
-
<%= f.cms_drop_down :slide_2_id, @
|
5
|
-
<%= f.cms_drop_down :slide_3_id, @
|
6
|
-
<%= f.cms_drop_down :slide_4_id, @
|
7
|
-
<%= f.cms_drop_down :slide_5_id, @
|
8
|
-
<%= f.cms_check_box :autorotate, :
|
9
|
-
<%= f.cms_text_field :rotate_interval, :label => "Rotation delay", :instructions => "in seconds
|
6
|
+
<%= f.cms_drop_down :slide_1_id, @slide_map, :label=>"Slide 1", :include_blank=>"[No slide selected]" %>
|
7
|
+
<%= f.cms_drop_down :slide_2_id, @slide_map, :label=>"Slide 2", :include_blank=>"[No slide selected]" %>
|
8
|
+
<%= f.cms_drop_down :slide_3_id, @slide_map, :label=>"Slide 3", :include_blank=>"[No slide selected]" %>
|
9
|
+
<%= f.cms_drop_down :slide_4_id, @slide_map, :label=>"Slide 4", :include_blank=>"[No slide selected]" %>
|
10
|
+
<%= f.cms_drop_down :slide_5_id, @slide_map, :label=>"Slide 5", :include_blank=>"[No slide selected]" %>
|
11
|
+
<%= f.cms_check_box :autorotate, :instructions => "Should slides automatically rotate?" %>
|
12
|
+
<%= f.cms_text_field :rotate_interval, :label => "Rotation delay", :instructions => "How long each slide will appear (in seconds). Has no effect if autorotate is off." %>
|
13
|
+
<style>
|
14
|
+
textarea { font-family: "Courier"}
|
15
|
+
</style>
|
10
16
|
<%= f.cms_template_editor :template %>
|
@@ -1,64 +1,22 @@
|
|
1
|
-
<
|
2
|
-
//<![CDATA[
|
3
|
-
$(function() {
|
4
|
-
var slides = $('#slides div.slide'),
|
5
|
-
currentItem = 0,
|
6
|
-
rotateInterval = <%= @portlet.rotate_interval.to_i %> * 1000,
|
7
|
-
autorotate = <%= @portlet.autorotate %>,
|
8
|
-
|
9
|
-
|
10
|
-
runSlideShow = function() {
|
11
|
-
var item = $('#slides ul#controls li a:eq('+currentItem+')');
|
12
|
-
if (item.length) {
|
13
|
-
item.trigger('click', ['timer']);
|
14
|
-
currentItem++;
|
15
|
-
} else {
|
16
|
-
currentItem = 0;
|
17
|
-
}
|
18
|
-
},
|
19
|
-
|
20
|
-
selectSlide = function(e) {
|
21
|
-
if ($(this).parent().hasClass('on')) {
|
22
|
-
return false;
|
23
|
-
} else {
|
24
|
-
$('#slides ul#controls li').removeClass('on');
|
25
|
-
$(this).parent().addClass('on');
|
26
|
-
slides.hide();
|
27
|
-
slides.filter(this.hash).show();
|
28
|
-
return false;
|
29
|
-
}
|
30
|
-
};
|
31
|
-
|
32
|
-
slides.hide();
|
33
|
-
slides.filter(':first').show();
|
34
|
-
$('#slides #controls li').filter(':first').addClass('on');
|
35
|
-
$('#slides ul#controls li a').bind('click', {}, selectSlide).
|
36
|
-
each(function(i) { this.slideIndex=i; });
|
37
|
-
|
38
|
-
if (autorotate) {
|
39
|
-
setInterval(runSlideShow, (rotateInterval < 1000 ? 1000 : rotateInterval));
|
40
|
-
}
|
41
|
-
});
|
42
|
-
//]]>
|
43
|
-
</script>
|
44
|
-
|
45
|
-
<div id="slides">
|
1
|
+
<div id="slides" data-rotate-interval="<%= @portlet.rotate_interval.to_i %>" data-autorotate="<%= @portlet.autorotate %>">
|
46
2
|
<ul id="controls">
|
47
3
|
<% @slides.each_with_index do |slide, i| %>
|
48
|
-
<li><a href="#slide-<%= i %>"><%= h slide.
|
4
|
+
<li><a href="#slide-<%= i %>"><%= h slide.nav_title_or_name %></a></li>
|
49
5
|
<% end %>
|
50
6
|
</ul>
|
51
7
|
<% @slides.each_with_index do |slide, i| %>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<% unless slide.image_url.blank? %>
|
60
|
-
<%= image_tag slide.image_url, :alt => h(slide.alt_text) %>
|
61
|
-
<% end %>
|
8
|
+
<div id="slide-<%= i %>" class="slide">
|
9
|
+
<div class="info">
|
10
|
+
<div class="pad">
|
11
|
+
<h3><%= h slide.name %></h3>
|
12
|
+
<%= slide.description.html_safe %>
|
13
|
+
<%= link_to("Read More »".html_safe, slide.link_url) if slide.has_link? %>
|
62
14
|
</div>
|
15
|
+
</div>
|
16
|
+
<% unless slide.image_url.blank? %>
|
17
|
+
<%= image_tag(slide.image_url, :alt => h(slide.alt_text)) %>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
63
20
|
<% end %>
|
64
21
|
</div>
|
22
|
+
|
data/db/migrate/{20101111030324_create_slides.rb → 20101111030324_bcms_content_rotator120.rb}
RENAMED
@@ -1,14 +1,16 @@
|
|
1
|
-
|
1
|
+
# Migration for v1.2.0 of bcms_content_rotator
|
2
|
+
class BcmsContentRotator120 < ActiveRecord::Migration
|
2
3
|
def self.up
|
3
4
|
create_content_table :slides do |t|
|
4
5
|
t.string :name
|
5
|
-
t.string :
|
6
|
+
t.string :link_url
|
7
|
+
t.string :navigation_title
|
6
8
|
t.string :alt_text
|
7
|
-
t.text :description
|
9
|
+
t.text :description
|
10
|
+
t.belongs_to :attachment
|
11
|
+
t.integer :attachment_version
|
8
12
|
end
|
9
13
|
|
10
|
-
|
11
|
-
ContentType.create!(:name => "Slide", :group_name => "Content Rotator")
|
12
14
|
end
|
13
15
|
|
14
16
|
def self.down
|
data/lib/bcms_content_rotator.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'cms/module_installation'
|
2
|
+
|
3
|
+
class BcmsContentRotator::InstallGenerator < Cms::ModuleInstallation
|
4
|
+
add_migrations_directory_to_source_root __FILE__
|
5
|
+
|
6
|
+
# Add migrations to be copied, by uncommenting the following file and editing as needed.
|
7
|
+
copy_migration_file '20101111030324_bcms_content_rotator120.rb'
|
8
|
+
|
9
|
+
def add_seed_data_to_project
|
10
|
+
copy_file "../bcms_content_rotator.seeds.rb", "db/bcms_content_rotator.seeds.rb"
|
11
|
+
append_to_file "db/seeds.rb", "load File.expand_path('../bcms_content_rotator.seeds.rb', __FILE__)"
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
$(function() {
|
3
|
+
var autorotate = $('#slides').data('autorotate'),
|
4
|
+
rotateInterval = $('#slides').data('rotate-interval') * 1000;
|
5
|
+
|
6
|
+
var slides = $('#slides div.slide'),
|
7
|
+
currentItem = 0,
|
8
|
+
runSlideShow = function() {
|
9
|
+
var item = $('#slides ul#controls li a:eq('+currentItem+')');
|
10
|
+
if (item.length) {
|
11
|
+
item.trigger('click', ['timer']);
|
12
|
+
currentItem++;
|
13
|
+
} else {
|
14
|
+
currentItem = 0;
|
15
|
+
}
|
16
|
+
},
|
17
|
+
|
18
|
+
selectSlide = function(e) {
|
19
|
+
if ($(this).parent().hasClass('on')) {
|
20
|
+
return false;
|
21
|
+
} else {
|
22
|
+
$('#slides ul#controls li').removeClass('on');
|
23
|
+
$(this).parent().addClass('on');
|
24
|
+
slides.hide();
|
25
|
+
slides.filter(this.hash).show();
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
slides.hide();
|
31
|
+
slides.filter(':first').show();
|
32
|
+
$('#slides #controls li').filter(':first').addClass('on');
|
33
|
+
$('#slides ul#controls li a').bind('click', {}, selectSlide).
|
34
|
+
each(function(i) { this.slideIndex=i; });
|
35
|
+
|
36
|
+
if (autorotate) {
|
37
|
+
setInterval(runSlideShow, (rotateInterval < 1000 ? 1000 : rotateInterval));
|
38
|
+
}
|
39
|
+
});
|
metadata
CHANGED
@@ -1,36 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_content_rotator
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- BrowserMedia
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2012-01-16 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: browsercms
|
16
|
+
requirement: &70298296728480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.3.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70298296728480
|
22
25
|
description:
|
23
26
|
email: github@browsermedia.com
|
24
27
|
executables: []
|
25
|
-
|
26
28
|
extensions: []
|
27
|
-
|
28
|
-
extra_rdoc_files:
|
29
|
+
extra_rdoc_files:
|
29
30
|
- README.markdown
|
30
|
-
files:
|
31
|
-
- app/controllers/application_controller.rb
|
31
|
+
files:
|
32
32
|
- app/controllers/cms/slides_controller.rb
|
33
|
-
- app/helpers/application_helper.rb
|
34
33
|
- app/models/slide.rb
|
35
34
|
- app/portlets/content_rotator_portlet.rb
|
36
35
|
- app/portlets/helpers/content_rotator_portlet_helper.rb
|
@@ -39,44 +38,50 @@ files:
|
|
39
38
|
- app/views/layouts/templates/default.html.erb
|
40
39
|
- app/views/portlets/content_rotator/_form.html.erb
|
41
40
|
- app/views/portlets/content_rotator/render.html.erb
|
42
|
-
- db/migrate/
|
43
|
-
-
|
41
|
+
- db/migrate/20101111030324_bcms_content_rotator120.rb
|
42
|
+
- db/bcms_content_rotator.seeds.rb
|
43
|
+
- public/bcms/content_rotator/content_rotator.js
|
44
|
+
- lib/bcms_content_rotator/engine.rb
|
44
45
|
- lib/bcms_content_rotator/routes.rb
|
45
|
-
-
|
46
|
+
- lib/bcms_content_rotator/version.rb
|
47
|
+
- lib/bcms_content_rotator.rb
|
48
|
+
- lib/generators/bcms_content_rotator/install/install_generator.rb
|
49
|
+
- lib/generators/bcms_content_rotator/install/USAGE
|
50
|
+
- lib/tasks/install.rake
|
51
|
+
- COPYRIGHT.txt
|
52
|
+
- GPL.txt
|
53
|
+
- LICENSE.txt
|
54
|
+
- Gemfile
|
46
55
|
- README.markdown
|
47
|
-
|
48
|
-
homepage: http://www.browsercms.org
|
56
|
+
homepage: https://github.com/browsermedia/bcms_content_rotator
|
49
57
|
licenses: []
|
50
|
-
|
51
58
|
post_install_message:
|
52
59
|
rdoc_options: []
|
53
|
-
|
54
|
-
require_paths:
|
60
|
+
require_paths:
|
55
61
|
- lib
|
56
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
63
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
segments:
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
segments:
|
63
69
|
- 0
|
64
|
-
|
65
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
hash: -3829606389742193028
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
72
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
segments:
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
segments:
|
72
78
|
- 0
|
73
|
-
|
79
|
+
hash: -3829606389742193028
|
74
80
|
requirements: []
|
75
|
-
|
76
81
|
rubyforge_project: bcms_content_rotator
|
77
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 1.8.10
|
78
83
|
signing_key:
|
79
84
|
specification_version: 3
|
80
|
-
summary: A
|
85
|
+
summary: A BrowserCMS module for creating a Slideshow/Homepage rotator designed to
|
86
|
+
showcase site content using jQuery.
|
81
87
|
test_files: []
|
82
|
-
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Filters added to this controller apply to all controllers in the application.
|
2
|
-
# Likewise, all the methods added will be available for all controllers.
|
3
|
-
|
4
|
-
class ApplicationController < ActionController::Base
|
5
|
-
helper :all # include all helpers, all the time
|
6
|
-
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
-
|
8
|
-
# Scrub sensitive parameters from your log
|
9
|
-
# filter_parameter_logging :password
|
10
|
-
end
|