spree_multi_slideshow 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -12
- data/app/assets/images/store/bx_loader.gif +0 -0
- data/app/assets/images/store/controls.png +0 -0
- data/app/assets/javascripts/admin/slide_settings.js.erb +41 -0
- data/app/assets/javascripts/admin/slides/index.js.coffee +15 -0
- data/app/assets/javascripts/admin/slides/new.js.coffee +7 -0
- data/app/assets/javascripts/admin/spree_multi_slideshow.js +3 -1
- data/app/assets/javascripts/store/spree_multi_slideshow.js +1284 -1
- data/app/assets/stylesheets/store/spree_multi_slideshow.css +197 -3
- data/app/controllers/spree/admin/slide_settings_controller.rb +50 -0
- data/app/controllers/spree/admin/slides_controller.rb +15 -14
- data/app/controllers/spree/admin/slideshows_controller.rb +31 -0
- data/app/helpers/spree/slideshows_helper.rb +68 -0
- data/app/models/spree/app_configuration_decorator.rb +25 -0
- data/app/models/spree/product_decorator.rb +3 -0
- data/app/models/spree/slide.rb +23 -25
- data/app/models/spree/slideshow.rb +17 -0
- data/app/models/spree/taxon_decorator.rb +3 -0
- data/app/overrides/slideshow_admin_tab.rb +10 -0
- data/app/views/spree/admin/shared/_slideshow_sub_menu.html.erb +6 -0
- data/app/views/spree/admin/shared/_slideshow_tabs.html.erb +21 -0
- data/app/views/spree/admin/slide_settings/edit.html.erb +74 -0
- data/app/views/spree/admin/slides/_form.html.erb +29 -9
- data/app/views/spree/admin/slides/edit.html.erb +26 -16
- data/app/views/spree/admin/slides/index.html.erb +47 -31
- data/app/views/spree/admin/slides/new.html.erb +12 -9
- data/app/views/spree/admin/slideshows/_form.html.erb +59 -0
- data/app/views/spree/admin/slideshows/edit.html.erb +17 -0
- data/app/views/spree/admin/slideshows/index.html.erb +51 -0
- data/app/views/spree/admin/slideshows/new.html.erb +80 -0
- data/app/views/spree/admin/slideshows/new.js.erb +2 -0
- data/config/locales/en.yml +53 -85
- data/config/locales/it.yml +56 -90
- data/config/routes.rb +3 -1
- data/db/migrate/20120116081431_create_slideshows.rb +17 -0
- data/db/migrate/20120116083546_create_slides.rb +5 -4
- data/db/migrate/20120323164044_multi_slideshow_namespace.rb +1 -1
- data/lib/generators/spree_multi_slideshow/install/install_generator.rb +1 -21
- data/lib/spree_multi_slideshow.rb +0 -2
- metadata +26 -73
- data/app/assets/images/store/slides/bg-gallery.png +0 -0
- data/app/assets/images/store/slides/bg-text02.png +0 -0
- data/app/assets/images/store/slides/sprite01.png +0 -0
- data/app/assets/javascripts/admin/slides/index.js +0 -10
- data/app/assets/javascripts/admin/slides/new.js +0 -5
- data/app/assets/javascripts/store/fadeGallery.js +0 -229
- data/app/assets/stylesheets/admin/spree_multi_slideshow.css +0 -16
- data/app/assets/stylesheets/store/carousel_slideshow.css.scss +0 -73
- data/app/controllers/spree/admin/slideshow_types_controller.rb +0 -11
- data/app/controllers/spree/slides_controller.rb +0 -5
- data/app/controllers/spree/slideshow_types_controller.rb +0 -5
- data/app/helpers/spree/slides_helper.rb +0 -4
- data/app/helpers/spree/slideshow_types_helper.rb +0 -53
- data/app/models/spree/slideshow_type.rb +0 -18
- data/app/overrides/slideshow_type_admin_tab.rb +0 -4
- data/app/views/spree/admin/shared/_slideshow_type_tabs.html.erb +0 -16
- data/app/views/spree/admin/slideshow_types/_form.html.erb +0 -8
- data/app/views/spree/admin/slideshow_types/edit.html.erb +0 -8
- data/app/views/spree/admin/slideshow_types/index.html.erb +0 -32
- data/app/views/spree/admin/slideshow_types/new.html.erb +0 -7
- data/db/migrate/20120116081431_create_slideshow_types.rb +0 -15
@@ -1,16 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*= require formtastic
|
3
|
-
*/
|
4
|
-
|
5
|
-
.formtastic input, .formtastic textarea, .formtastic select {
|
6
|
-
font-size: 100%;
|
7
|
-
padding: 5px;
|
8
|
-
}
|
9
|
-
|
10
|
-
.formtastic button {
|
11
|
-
margin: 0;
|
12
|
-
padding: 0 20px 0 0;
|
13
|
-
}
|
14
|
-
.formtastic button:hover {
|
15
|
-
text-shadow: #FFFFFF -1px -1px 0px;
|
16
|
-
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
.left {
|
2
|
-
float: left !important;
|
3
|
-
}
|
4
|
-
.right {
|
5
|
-
float: right !important;
|
6
|
-
}
|
7
|
-
.gallery {
|
8
|
-
position: relative;
|
9
|
-
overflow: hidden;
|
10
|
-
z-index:0;
|
11
|
-
color:#fff;
|
12
|
-
margin:auto;
|
13
|
-
}
|
14
|
-
.gallery .gallery-inner {
|
15
|
-
position:relative;
|
16
|
-
}
|
17
|
-
.gallery .gallery-inner ul {
|
18
|
-
position:absolute;
|
19
|
-
margin:0;
|
20
|
-
padding:0;
|
21
|
-
list-style:none;
|
22
|
-
}
|
23
|
-
.gallery .gallery-inner li {
|
24
|
-
position:absolute;
|
25
|
-
top:0;
|
26
|
-
left:0;
|
27
|
-
background: transparent;
|
28
|
-
}
|
29
|
-
.gallery .gallery-inner li.active {z-index:2;}
|
30
|
-
.gallery img {
|
31
|
-
display:block;
|
32
|
-
}
|
33
|
-
.gallery .text-holder {
|
34
|
-
position: absolute;
|
35
|
-
text-align:center;
|
36
|
-
}
|
37
|
-
.gallery-control {
|
38
|
-
font-size: 60px;
|
39
|
-
font-weight: 100;
|
40
|
-
line-height: 27px;
|
41
|
-
color: white;
|
42
|
-
text-align: center;
|
43
|
-
width: 40px;
|
44
|
-
height: 40px;
|
45
|
-
}
|
46
|
-
a.gallery-control:hover {
|
47
|
-
text-decoration: none;
|
48
|
-
color: white;
|
49
|
-
}
|
50
|
-
.carousel-control {
|
51
|
-
position: absolute;
|
52
|
-
top: 40%;
|
53
|
-
left: 15px;
|
54
|
-
width: 40px;
|
55
|
-
height: 40px;
|
56
|
-
margin-top: -20px;
|
57
|
-
font-size: 60px;
|
58
|
-
font-weight: 100;
|
59
|
-
line-height: 30px;
|
60
|
-
color: white;
|
61
|
-
text-align: center;
|
62
|
-
background: #222;
|
63
|
-
border: 3px solid white;
|
64
|
-
-webkit-border-radius: 23px;
|
65
|
-
-moz-border-radius: 23px;
|
66
|
-
border-radius: 23px;
|
67
|
-
opacity: 0.5;
|
68
|
-
filter: alpha(opacity=50);
|
69
|
-
}
|
70
|
-
.carousel-control.right {
|
71
|
-
left: auto;
|
72
|
-
right: 15px;
|
73
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
module Spree
|
3
|
-
module SlideshowTypesHelper
|
4
|
-
|
5
|
-
def insert_slideshow(params={})
|
6
|
-
if slide_images(params)
|
7
|
-
navigation = enable_navigation(params)
|
8
|
-
content_tag(:div, navigation[:prev] + content_tag(:div, content_tag(:ul, raw(slide_images(params))), :class => "gallery-inner clearfix") + navigation[:succ], :class => "gallery #{params[:class]}", :style => "width: #{Spree::SlideshowType.enable(params[:category] || "home").first.slide_width}px; height: #{Spree::SlideshowType.enable(params[:category] || "home").first.slide_height}px;")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def slide_images(params)
|
13
|
-
category = params[:category] || "home"
|
14
|
-
style = params[:style] || "custom"
|
15
|
-
slideshow = Spree::SlideshowType.enable(category)
|
16
|
-
if !slideshow.blank?
|
17
|
-
max = slideshow.first.slide_number || 4
|
18
|
-
slides = Spree::Slide.where("slideshow_type_id = ?", slideshow.first.id).limit(max).sort_by { |slide| slide.position }
|
19
|
-
|
20
|
-
slides.map do |slide|
|
21
|
-
if params[:enable_content]
|
22
|
-
link_content = content_tag(:div, content_tag(:strong, raw(slide.title)) + content_tag(:p, raw(slide.content)), :class => "text-holder")
|
23
|
-
else
|
24
|
-
link_content = ""
|
25
|
-
end
|
26
|
-
content_tag(:li, raw(link_to(image_tag(slide.attachment.url(style.to_sym)), slide.url, { :title => slide.title })) + raw(link_content))
|
27
|
-
end.join
|
28
|
-
else
|
29
|
-
false
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def enable_navigation(params)
|
34
|
-
category = params[:category] || "home"
|
35
|
-
slideshow = Spree::SlideshowType.enable(category)
|
36
|
-
if !slideshow.blank?
|
37
|
-
if slideshow.first.enable_navigation
|
38
|
-
prev = link_to("‹", "#", :class => "gallery-control left")
|
39
|
-
succ = link_to("›", "#", :class => "gallery-control right")
|
40
|
-
else
|
41
|
-
prev = ""
|
42
|
-
succ = ""
|
43
|
-
end
|
44
|
-
|
45
|
-
res = Hash.new()
|
46
|
-
res[:prev] = content_tag(:div, prev, :class => "carousel-control left")
|
47
|
-
res[:succ] = content_tag(:div, succ, :class => "carousel-control right")
|
48
|
-
return res
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
class SlideshowType < ActiveRecord::Base
|
3
|
-
has_many :slides
|
4
|
-
|
5
|
-
attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled
|
6
|
-
|
7
|
-
validates :slide_number, :slide_width, :slide_height, :presence => true
|
8
|
-
validates_uniqueness_of :category
|
9
|
-
validates_numericality_of :slide_number, :only_integer => true
|
10
|
-
|
11
|
-
scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
|
12
|
-
|
13
|
-
def initialize(*args)
|
14
|
-
super(*args)
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<% content_for :sidebar do %>
|
2
|
-
|
3
|
-
<h3><%= t("slideshow_type.sidebar") %></h3>
|
4
|
-
<br class="clear" />
|
5
|
-
|
6
|
-
<ul class="sidebar slide-menu" data-hook="admin_slide_tabs">
|
7
|
-
<li<%== ' class="active"' if current == 'Slideshow_type Details' %>>
|
8
|
-
<%= link_to t("slideshow_type.detail"), edit_admin_slideshow_type_url(@slideshow_type) %>
|
9
|
-
</li>
|
10
|
-
<li<%== ' class="active"' if current == 'Slide Image' %>>
|
11
|
-
<%= link_to t("slideshow_type.slide.many"), admin_slideshow_type_slides_path(@slideshow_type) %>
|
12
|
-
</li>
|
13
|
-
</ul>
|
14
|
-
<br class="clear" />
|
15
|
-
|
16
|
-
<% end %>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<h1><%= t("slideshow_type.editing_page") %></h1>
|
2
|
-
<%= render :partial => 'spree/admin/shared/slideshow_type_tabs', :locals => {:current => 'Slideshow_type Details'} %>
|
3
|
-
<%= render "spree/shared/error_messages", :target => @slideshow_type %>
|
4
|
-
|
5
|
-
<%= semantic_form_for([:admin, @slideshow_type]) do |f| %>
|
6
|
-
<%= render :partial => "form", :locals => { :f => f } %>
|
7
|
-
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
8
|
-
<% end %>
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<div class='toolbar'>
|
2
|
-
<ul class='actions'>
|
3
|
-
<li id="new_product_link">
|
4
|
-
<%= button_link_to t("slideshow_type.new_page"), new_admin_slideshow_type_url, {:icon => 'add'} %>
|
5
|
-
</li>
|
6
|
-
</ul>
|
7
|
-
<br class='clear' />
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<h1><%= t("slideshow_type.many") %></h1>
|
11
|
-
|
12
|
-
<table class="index">
|
13
|
-
<tr>
|
14
|
-
<th><%= t("slideshow_type.category") %></th>
|
15
|
-
<th><%= t("slideshow_type.enable") %></th>
|
16
|
-
<th><%= t("slideshow_type.slide_number") %></th>
|
17
|
-
<th><%= t("action") %></th>
|
18
|
-
</tr>
|
19
|
-
<tbody>
|
20
|
-
<% @slideshow_types.each do |slideshow_type| %>
|
21
|
-
<tr class="<%= cycle('even', 'odd') %>" id="<%= dom_id slideshow_type %>">
|
22
|
-
<td><%= slideshow_type.category %></td>
|
23
|
-
<td><%= icon('tick') if slideshow_type.enabled %></td>
|
24
|
-
<td><%= slideshow_type.slide_number %></td>
|
25
|
-
<td>
|
26
|
-
<%= link_to_edit slideshow_type %>
|
27
|
-
<%= link_to_delete slideshow_type %>
|
28
|
-
</td>
|
29
|
-
</tr>
|
30
|
-
<% end %>
|
31
|
-
</tbody>
|
32
|
-
</table>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<h1><%= t("slideshow_type.new_page") %></h1>
|
2
|
-
<%= render "spree/shared/error_messages", :target => @slideshow_type %>
|
3
|
-
|
4
|
-
<%= semantic_form_for([:admin, @slideshow_type], :html => { :enctype => "multipart/form-data" }) do |f| %>
|
5
|
-
<%= render :partial => "form", :locals => { :f => f } %>
|
6
|
-
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
|
7
|
-
<% end %>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreateSlideshowTypes < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :slideshow_types do |t|
|
4
|
-
t.string :category
|
5
|
-
t.boolean :enabled, :default => false
|
6
|
-
t.integer :slide_height, :default => 400
|
7
|
-
t.integer :slide_width, :default => 900
|
8
|
-
t.integer :slide_number, :default => 4
|
9
|
-
t.boolean :enable_navigation, :default => true
|
10
|
-
|
11
|
-
t.timestamps
|
12
|
-
end
|
13
|
-
add_index :slideshow_types, :category, :unique => true
|
14
|
-
end
|
15
|
-
end
|