spree_multi_slideshow 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/app/assets/images/store/slides/pagination.png +0 -0
- data/app/assets/javascripts/store/spree_multi_slideshow.js +537 -213
- data/app/assets/stylesheets/store/spree_multi_slideshow.css +45 -55
- data/app/controllers/spree/admin/slides_controller.rb +3 -3
- data/app/controllers/spree/admin/slideshow_types_controller.rb +5 -1
- data/app/helpers/spree/slideshow_types_helper.rb +45 -50
- data/app/models/spree/slide.rb +2 -0
- data/app/models/spree/slideshow_type.rb +2 -7
- data/app/views/spree/admin/shared/_slideshow_type_tabs.html.erb +8 -6
- data/app/views/spree/admin/slides/edit.html.erb +1 -1
- data/app/views/spree/admin/slides/index.html.erb +31 -32
- data/app/views/spree/admin/slides/new.html.erb +1 -1
- data/app/views/spree/admin/slideshow_types/_form.html.erb +48 -8
- data/app/views/spree/admin/slideshow_types/edit.html.erb +6 -7
- data/app/views/spree/admin/slideshow_types/index.html.erb +30 -29
- data/app/views/spree/admin/slideshow_types/new.html.erb +51 -5
- data/app/views/spree/admin/slideshow_types/new.js.erb +2 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/db/migrate/20120116081431_create_slideshow_types.rb +1 -1
- data/db/migrate/20130114150224_add_enable_pagination.rb +5 -0
- data/lib/generators/spree_multi_slideshow/install/install_generator.rb +0 -9
- metadata +5 -22
- data/app/assets/images/store/slides/bg-gallery.png +0 -0
- data/app/assets/images/store/slides/bg-text02.png +0 -0
- data/app/controllers/spree/slides_controller.rb +0 -5
- data/app/controllers/spree/slideshow_types_controller.rb +0 -5
@@ -2,60 +2,50 @@
|
|
2
2
|
*= require store/spree_core
|
3
3
|
*/
|
4
4
|
|
5
|
-
|
5
|
+
#slides {
|
6
|
+
margin-bottom: 25px;
|
7
|
+
}
|
8
|
+
.slides_container {
|
9
|
+
width: 720px;
|
10
|
+
height: 287px;
|
11
|
+
}
|
12
|
+
.slides_container .slide_list {
|
13
|
+
width: 720px;
|
14
|
+
height: 287px;
|
15
|
+
display: block;
|
16
|
+
position: relative;
|
17
|
+
}
|
18
|
+
.text-holder {
|
19
|
+
position: absolute;
|
20
|
+
right: 0px;
|
21
|
+
top: 0px;
|
22
|
+
height: 271px;
|
23
|
+
padding: 8px;
|
24
|
+
width: 200px;
|
25
|
+
background: #EFEFEF;
|
26
|
+
}
|
27
|
+
.pagination {
|
28
|
+
margin: 6px 0 0;
|
29
|
+
float: right;
|
30
|
+
list-style: none;
|
31
|
+
}
|
32
|
+
.pagination li {
|
33
|
+
float: left;
|
34
|
+
margin: 0 1px;
|
35
|
+
}
|
36
|
+
.pagination li a {
|
37
|
+
display: block;
|
38
|
+
width: 13px;
|
39
|
+
height: 0;
|
40
|
+
padding-top: 13px;
|
41
|
+
background-image: url(slides/pagination.png);
|
42
|
+
background-position: 0 0;
|
43
|
+
float: left;
|
6
44
|
overflow: hidden;
|
7
|
-
|
8
|
-
|
9
|
-
background:
|
10
|
-
}
|
11
|
-
.
|
12
|
-
position:
|
13
|
-
}
|
14
|
-
.gallery .frame ul {
|
15
|
-
position:absolute;
|
16
|
-
margin:0;
|
17
|
-
padding:0;
|
18
|
-
list-style:none;
|
19
|
-
}
|
20
|
-
.gallery .frame li {
|
21
|
-
position:absolute;
|
22
|
-
top:0;
|
23
|
-
left:0;
|
24
|
-
background:#f1f1f1;
|
25
|
-
}
|
26
|
-
.gallery .frame li.active {z-index:2;}
|
27
|
-
.gallery img {
|
28
|
-
display:block;
|
29
|
-
}
|
30
|
-
.gallery .prev,
|
31
|
-
.gallery .next {
|
32
|
-
/*position:absolute;
|
33
|
-
top:160px;
|
34
|
-
left:47px;
|
35
|
-
background:url(/assets/images/sprite01.png) no-repeat;
|
36
|
-
width:39px;
|
37
|
-
height:39px;*/
|
38
|
-
text-indent:-9999px;
|
39
|
-
overflow:hidden;
|
40
|
-
z-index:3;
|
41
|
-
}
|
42
|
-
.gallery .next {
|
43
|
-
right:56px;
|
44
|
-
left:auto;
|
45
|
-
background-position: 0 -43px;
|
46
|
-
}
|
47
|
-
.gallery .text-holder {
|
48
|
-
background:url(/assets/images/bg-text02.png) no-repeat;
|
49
|
-
width: 234px;
|
50
|
-
height:98px;
|
51
|
-
padding:45px 0 0 50px;
|
52
|
-
position:absolute;
|
53
|
-
right:1px;
|
54
|
-
bottom:1px;
|
55
|
-
font:bold 33px/40px 'Candrb', Arial, Helvetica, sans-serif;
|
56
|
-
text-align:center;
|
57
|
-
}
|
58
|
-
.gallery .text-holder strong span {
|
59
|
-
font-size:52px;
|
60
|
-
display:block;
|
45
|
+
}
|
46
|
+
.pagination li a:hover {
|
47
|
+
background-position: 0 -26px;
|
48
|
+
}
|
49
|
+
.pagination li.current a, .pagination li.current a:hover {
|
50
|
+
background-position: 0 -13px;
|
61
51
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
module Admin
|
3
3
|
class SlidesController < ResourceController
|
4
|
-
before_filter :load_data, :
|
4
|
+
before_filter :load_data, :except => [:destroy]
|
5
5
|
|
6
6
|
def update_positions
|
7
7
|
params[:positions].each do |id, index|
|
@@ -16,11 +16,11 @@ module Spree
|
|
16
16
|
|
17
17
|
protected
|
18
18
|
def location_after_save
|
19
|
-
|
19
|
+
edit_admin_slideshow_type_url(@slideshow_type)
|
20
20
|
end
|
21
21
|
|
22
22
|
def load_data
|
23
|
-
@slideshow_type = Spree::SlideshowType.find(params[:slideshow_type_id]
|
23
|
+
@slideshow_type = Spree::SlideshowType.find(params[:slideshow_type_id])
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
@@ -1,60 +1,55 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
module Spree
|
2
4
|
module SlideshowTypesHelper
|
3
|
-
|
5
|
+
|
4
6
|
def insert_slideshow(params={})
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
if slide_images(params)
|
12
|
-
navigation = enable_navigation(params)
|
13
|
-
content_tag(:div, navigation[:prev] + content_tag(:div, content_tag(:ul, raw(slide_images(params))), :class => "frame") + 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;")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def slide_images(params)
|
18
|
-
category = params[:category] || "home"
|
19
|
-
style = params[:style] || "custom"
|
20
|
-
slideshow = Spree::SlideshowType.enable(category)
|
21
|
-
if !slideshow.blank?
|
22
|
-
max = slideshow.first.slide_number || 4
|
23
|
-
slides = Spree::Slide.where("slideshow_type_id = ?", slideshow.first.id).limit(max).sort_by { |slide| slide.position }
|
24
|
-
|
25
|
-
slides.map do |slide|
|
26
|
-
content_tag(:li, raw(link_to(image_tag(slide.attachment.url(style.to_sym)), slide.url, { :title => slide.title })) + raw(content_tag(:div, content_tag(:strong, raw(slide.title)) + content_tag(:p, raw(slide.content)), :class => "text-holder")))
|
27
|
-
end.join
|
28
|
-
else
|
29
|
-
false
|
7
|
+
params[:id] ||= "slides"
|
8
|
+
params[:class] ||= "my_slide"
|
9
|
+
params[:category] ||= "home"
|
10
|
+
@@slideshow = Spree::SlideshowType.enable.find_by_category(params[:category])
|
11
|
+
if @@slideshow.blank? || (!@@slideshow.blank? && @@slideshow.slides.empty?)
|
12
|
+
return ''
|
30
13
|
end
|
14
|
+
params[:pagination_class] ||= "pagination"
|
15
|
+
params[:slide_speed] ||= 350
|
16
|
+
res = []
|
17
|
+
|
18
|
+
res << content_tag(:div, content_tag(:div, slide_images(params, @@slideshow), :class => "slides_container"), :id => params[:id], :class => params[:class])
|
19
|
+
res << "<script type='text/javascript'>
|
20
|
+
$(function() {
|
21
|
+
$('##{params[:id]}').slides({
|
22
|
+
play: 100000,
|
23
|
+
preload: true,
|
24
|
+
generateNextPrev: #{@@slideshow.enable_navigation},
|
25
|
+
generatePagination: #{@@slideshow.enable_pagination},
|
26
|
+
paginationClass: '#{params[:pagination_class]}',
|
27
|
+
slideSpeed: #{params[:slide_speed]}
|
28
|
+
});
|
29
|
+
});
|
30
|
+
</script>"
|
31
|
+
|
32
|
+
res.join.html_safe
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
35
|
+
def slide_images(params, slideshow)
|
36
|
+
params[:style] ||= "custom"
|
37
|
+
params[:show_content] ||= false
|
38
|
+
max = slideshow.slide_number || slideshow.slides.count
|
39
|
+
slides = slideshow.slides.limit(max).sort_by { |slide| slide.position }
|
40
|
+
|
41
|
+
slides.map do |slide|
|
42
|
+
content_tag(:div, :class => "slide_list") do
|
43
|
+
divs = []
|
44
|
+
|
45
|
+
divs << link_to(image_tag(slide.attachment.url(params[:style].to_sym)), (slide.url.blank? ? "javascript: void(0)" : slide.url), { :title => slide.title })
|
46
|
+
if params[:show_content]
|
47
|
+
divs << content_tag(:div, content_tag(:strong, raw(slide.title)) + content_tag(:p, raw(slide.content)), :class => "text-holder")
|
48
|
+
end
|
49
|
+
|
50
|
+
divs.join.html_safe
|
46
51
|
end
|
47
|
-
|
48
|
-
unless container_nav.blank?
|
49
|
-
prev = content_tag(container_nav.to_sym, prev, :class => cl_nav_container[0])
|
50
|
-
succ = content_tag(container_nav.to_sym, succ, :class => cl_nav_container[1])
|
51
|
-
end
|
52
|
-
|
53
|
-
res = Hash.new()
|
54
|
-
res[:prev] = prev
|
55
|
-
res[:succ] = succ
|
56
|
-
return res
|
57
|
-
end
|
52
|
+
end.join.html_safe
|
58
53
|
end
|
59
54
|
|
60
55
|
end
|
data/app/models/spree/slide.rb
CHANGED
@@ -29,6 +29,8 @@ module Spree
|
|
29
29
|
validates_attachment_presence :attachment
|
30
30
|
validates_attachment_content_type :attachment, :content_type => ['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/x-png', 'image/pjpeg'], :message => "deve essere JPG, JPEG, PNG o GIF"
|
31
31
|
|
32
|
+
default_scope order("position ASC")
|
33
|
+
|
32
34
|
# Load S3 settings
|
33
35
|
if ( FileTest.exist?(Rails.root.join('config', 's3.yml')) && !YAML.load_file(Rails.root.join('config', 's3.yml'))[Rails.env].blank?)
|
34
36
|
S3_OPTIONS = {
|
@@ -2,17 +2,12 @@ module Spree
|
|
2
2
|
class SlideshowType < ActiveRecord::Base
|
3
3
|
has_many :slides
|
4
4
|
|
5
|
-
attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled
|
5
|
+
attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled, :enable_pagination
|
6
6
|
|
7
7
|
validates :slide_number, :slide_width, :slide_height, :presence => true
|
8
8
|
validates_uniqueness_of :category
|
9
9
|
validates_numericality_of :slide_number, :only_integer => true
|
10
10
|
|
11
|
-
scope :enable,
|
12
|
-
|
13
|
-
def initialize(*args)
|
14
|
-
super(*args)
|
15
|
-
end
|
16
|
-
|
11
|
+
scope :enable, where("enabled IS NOT NULL AND enabled = 1")
|
17
12
|
end
|
18
13
|
end
|
@@ -1,14 +1,16 @@
|
|
1
|
+
<h1><%= t(:editing_slideshow_type) %> “<%= @slideshow_type.category %>”</h1>
|
2
|
+
|
1
3
|
<% content_for :sidebar do %>
|
2
4
|
|
3
|
-
<h3><%=
|
5
|
+
<h3><%= @slideshow_type.category %></h3>
|
4
6
|
<br class="clear" />
|
5
7
|
|
6
8
|
<ul class="sidebar slide-menu" data-hook="admin_slide_tabs">
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<li<%== ' class="active"' if current == 'Slide
|
11
|
-
<%= link_to t(
|
9
|
+
<li<%== ' class="active"' if current == 'Slideshow_type Details' %>>
|
10
|
+
<%= link_to t(:slideshow_type_details), edit_admin_slideshow_type_url(@slideshow_type) %>
|
11
|
+
</li>
|
12
|
+
<li<%== ' class="active"' if current == 'Slide Images' %>>
|
13
|
+
<%= link_to t(:slides), admin_slideshow_type_slides_path(@slideshow_type) %>
|
12
14
|
</li>
|
13
15
|
</ul>
|
14
16
|
<br class="clear" />
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1><%= t("slideshow_type.slide.editing_page") %></h1>
|
3
3
|
<%= render 'spree/shared/error_messages', :target => @slide %>
|
4
4
|
|
5
|
-
<%=
|
5
|
+
<%= form_for [:admin, @slideshow_type, @slide], :html => { :multipart => true } do |f| %>
|
6
6
|
<table class="basic-table" data-hook="edit_image">
|
7
7
|
<tr data-hook="thumbnail">
|
8
8
|
<td><%= t(:thumbnail) %>:</td>
|
@@ -1,35 +1,34 @@
|
|
1
|
-
<%= render :partial => 'spree/admin/shared/slideshow_type_tabs', :locals => {:current => 'Slide
|
1
|
+
<%= render :partial => 'spree/admin/shared/slideshow_type_tabs', :locals => {:current => 'Slide Images'} %>
|
2
2
|
|
3
|
-
<%=
|
4
|
-
<
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<tr data-hook="images_header">
|
11
|
-
<th><%= t("slideshow_type.slide.thumbnail") %></th>
|
12
|
-
<th><%= t("slideshow_type.slide.title") %></th>
|
13
|
-
<th><%= t("slideshow_type.slide.position") %></th>
|
14
|
-
<th><%= t("slideshow_type.slide.url") %></th>
|
15
|
-
<th><%= t(:action) %></th>
|
16
|
-
</tr>
|
3
|
+
<table class="index sortable" data-hook="slide_table" data-sortable-link="<%= update_positions_admin_slideshow_type_slides_url(@slideshow_type) %>">
|
4
|
+
<tr data-hook="images_header">
|
5
|
+
<th><%= t(:thumbnail) %></th>
|
6
|
+
<th><%= t(:title) %></th>
|
7
|
+
<th><%= t(:url) %></th>
|
8
|
+
<th><%= t(:action) %></th>
|
9
|
+
</tr>
|
17
10
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
11
|
+
<tbody>
|
12
|
+
<% @slideshow_type.slides.each do |slide| %>
|
13
|
+
<tr id="<%= spree_dom_id slide %>" data-hook="images_row">
|
14
|
+
<td>
|
15
|
+
<span class="handle"></span>
|
16
|
+
<%= link_to image_tag(slide.attachment.url(:thumbnail)), slide.attachment.url(:medium) %>
|
17
|
+
</td>
|
18
|
+
<td><%= slide.title %></td>
|
19
|
+
<td><%= slide.url %></td>
|
20
|
+
<td class="actions">
|
21
|
+
<%= link_to_with_icon 'edit', t(:edit), edit_admin_slideshow_type_slide_url(@slideshow_type, slide), :class => 'edit' %>
|
22
|
+
|
23
|
+
<%= link_to_delete image, { :url => admin_slideshow_type_slide_url(@slideshow_type, slide) }%>
|
24
|
+
</td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
34
29
|
|
35
|
-
|
30
|
+
<div id="images" data-hook></div>
|
31
|
+
<br />
|
32
|
+
<p data-hook="links">
|
33
|
+
<%= link_to icon('add') + ' ' + t(:new_slide), new_admin_slideshow_type_slide_url(@slideshow_type), :id => 'new_slide_link' %>
|
34
|
+
</p>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<h4><%= t("slideshow_type.slide.new_page") %></h4>
|
2
|
-
<%=
|
2
|
+
<%= form_for [:admin, @slideshow_type, @slide], :html => { :multipart => true } do |f| %>
|
3
3
|
<table class="basic-table" data-hook="new_slide">
|
4
4
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
5
5
|
</table>
|
@@ -1,8 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<% end %>
|
1
|
+
<div data-hook="admin_slideshow_form_fields">
|
2
|
+
<div class="clearfix">
|
3
|
+
<div class="left" data-hook="admin_product_form_left">
|
4
|
+
<%= f.field_container :category do %>
|
5
|
+
<%= f.label :category, t(:category) %> <span class="required">*</span><br />
|
6
|
+
<%= f.text_field :category, :class => 'fullwidth title' %>
|
7
|
+
<%= f.error_message_on :category %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<%= f.field_container :slide_width do %>
|
11
|
+
<%= f.label :slide_width, t(:slide_width) %> <span class="required">*</span><br />
|
12
|
+
<%= f.text_field :slide_width, :class => 'fullwidth title' %>
|
13
|
+
<%= f.error_message_on :slide_width %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= f.field_container :slide_height do %>
|
17
|
+
<%= f.label :slide_height, t(:slide_height) %><br />
|
18
|
+
<%= f.text_field :slide_height, :class => 'fullwidth title' %>
|
19
|
+
<%= f.error_message_on :slide_height %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
<div class="right" data-hook="admin_product_form_right">
|
23
|
+
<%= f.field_container :slide_number do %>
|
24
|
+
<%= f.label :slide_number, t(:slide_number) %> <span class="required">*</span><br />
|
25
|
+
<%= f.text_field :slide_number, :class => 'fullwidth title' %>
|
26
|
+
<%= f.error_message_on :slide_number %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<%= f.field_container :enable_navigation do %>
|
30
|
+
<%= f.label :enable_navigation, t(:enable_navigation) %><br />
|
31
|
+
<%= f.check_box :enable_navigation %>
|
32
|
+
<%= f.error_message_on :enable_navigation %>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<%= f.field_container :enable_pagination do %>
|
36
|
+
<%= f.label :enable_pagination, t(:enable_pagination) %><br />
|
37
|
+
<%= f.check_box :enable_pagination %>
|
38
|
+
<%= f.error_message_on :enable_pagination %>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<%= f.field_container :enabled do %>
|
42
|
+
<%= f.label :enabled, t(:enabled) %><br />
|
43
|
+
<%= f.check_box :enabled %>
|
44
|
+
<%= f.error_message_on :enabled %>
|
45
|
+
<% end %>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</div>
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%= render "spree/shared/error_messages", :target => @slideshow_type %>
|
1
|
+
<%= render :partial => 'spree/admin/shared/slideshow_type_tabs', :locals => { :current => 'Slideshow_type Details' } %>
|
2
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @product } %>
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
<%= form_for([:admin, @slideshow_type], :html => { :multipart => true }) do |f| %>
|
5
|
+
<%= render :partial => 'form', :locals => { :f => f } %>
|
6
|
+
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
7
|
+
<% end %>
|
@@ -1,32 +1,33 @@
|
|
1
|
-
<div class=
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<div class="toolbar" data-hook="toolbar">
|
2
|
+
<ul class="actions">
|
3
|
+
<li id="new_slideshow_link">
|
4
|
+
<%= button_link_to t(:new_slideshow), new_object_url, {:remote => true, :icon => 'add', :id => 'admin_new_slideshow'} %>
|
5
|
+
</li>
|
6
|
+
</ul>
|
7
|
+
<br class="clear" />
|
8
8
|
</div>
|
9
9
|
|
10
|
-
<h1><%= t(
|
10
|
+
<h1><%= t(:listing_slideshows) %></h1>
|
11
11
|
|
12
|
-
<
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
12
|
+
<div id="new_slideshow" data-hook></div>
|
13
|
+
|
14
|
+
<table class="index" id="listing_products">
|
15
|
+
<tr data-hook="admin_products_index_headers">
|
16
|
+
<th><%= t(:category) %></th>
|
17
|
+
<th><%= t(:enable) %></th>
|
18
|
+
<th><%= t(:slide_number) %></th>
|
19
|
+
<th data-hook="admin_slideshows_index_header_actions"></th>
|
20
|
+
</tr>
|
21
|
+
<% @slideshow_types.each do |slideshow_type| %>
|
22
|
+
<tr id="<%= spree_dom_id slideshow_type %>" data-hook="admin_slideshow_types_index_rows">
|
23
|
+
<td><%= slideshow_type.category %></td>
|
24
|
+
<td><%= icon('tick') if slideshow_type.enabled %></td>
|
25
|
+
<td><%= slideshow_type.slide_number %></td>
|
26
|
+
<td class="actions" data-hook="admin_products_index_row_actions">
|
27
|
+
<%= link_to_edit slideshow_type, :class => 'edit' %>
|
28
|
+
|
29
|
+
<%= link_to_delete slideshow_type %>
|
30
|
+
</td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</table>
|
@@ -1,7 +1,53 @@
|
|
1
|
-
|
2
|
-
<%= render "spree/shared/error_messages", :target => @slideshow_type %>
|
1
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @slideshow_type } %>
|
3
2
|
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
3
|
+
<%= form_for [:admin, @slideshow_type], :html => { :multipart => true } do |f| %>
|
4
|
+
<fieldset data-hook="new_slideshow_type">
|
5
|
+
<div class="clearfix" data-hook="new_product_attrs">
|
6
|
+
<div class="left">
|
7
|
+
<%= f.field_container :category do %>
|
8
|
+
<%= f.label :category, t(:category) %> <span class="required">*</span><br />
|
9
|
+
<%= f.text_field :category, :class => 'fullwidth title' %>
|
10
|
+
<%= f.error_message_on :category %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= f.field_container :slide_width do %>
|
14
|
+
<%= f.label :slide_width, t(:slide_width) %> <span class="required">*</span><br />
|
15
|
+
<%= f.text_field :slide_width, :class => 'fullwidth title' %>
|
16
|
+
<%= f.error_message_on :slide_width %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<%= f.field_container :slide_height do %>
|
20
|
+
<%= f.label :slide_height, t(:slide_height) %><br />
|
21
|
+
<%= f.text_field :slide_height, :class => 'fullwidth title' %>
|
22
|
+
<%= f.error_message_on :slide_height %>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
<div class="right">
|
26
|
+
<%= f.field_container :slide_number do %>
|
27
|
+
<%= f.label :slide_number, t(:slide_number) %> <span class="required">*</span><br />
|
28
|
+
<%= f.text_field :slide_number, :class => 'fullwidth title' %>
|
29
|
+
<%= f.error_message_on :slide_number %>
|
30
|
+
<% end %>
|
31
|
+
|
32
|
+
<%= f.field_container :enable_navigation do %>
|
33
|
+
<%= f.label :enable_navigation, t(:enable_navigation) %><br />
|
34
|
+
<%= f.check_box :enable_navigation %>
|
35
|
+
<%= f.error_message_on :enable_navigation %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<%= f.field_container :enable_pagination do %>
|
39
|
+
<%= f.label :enable_pagination, t(:enable_pagination) %><br />
|
40
|
+
<%= f.check_box :enable_pagination %>
|
41
|
+
<%= f.error_message_on :enable_pagination %>
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
<%= f.field_container :enabled do %>
|
45
|
+
<%= f.label :enabled, t(:enabled) %><br />
|
46
|
+
<%= f.check_box :enabled %>
|
47
|
+
<%= f.error_message_on :enabled %>
|
48
|
+
<% end %>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
|
52
|
+
</fieldset>
|
7
53
|
<% end %>
|
data/config/locales/en.yml
CHANGED
data/config/locales/it.yml
CHANGED
@@ -6,7 +6,7 @@ class CreateSlideshowTypes < ActiveRecord::Migration
|
|
6
6
|
t.integer :slide_height, :default => 400
|
7
7
|
t.integer :slide_width, :default => 900
|
8
8
|
t.integer :slide_number, :default => 4
|
9
|
-
t.boolean :enable_navigation, :default =>
|
9
|
+
t.boolean :enable_navigation, :default => false
|
10
10
|
|
11
11
|
t.timestamps
|
12
12
|
end
|
@@ -2,15 +2,6 @@ module SpreeMultiSlideshow
|
|
2
2
|
module Generators
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
4
|
|
5
|
-
def add_formtastic
|
6
|
-
res = ask "Would you like to run the formtastic install now? [Y/n]"
|
7
|
-
if res == "" || res.downcase == "y"
|
8
|
-
run 'rails generate formtastic:install'
|
9
|
-
else
|
10
|
-
puts "Skiping rails generate formtastic:install, don't forget to run it!"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
5
|
def add_javascripts
|
15
6
|
append_file "app/assets/javascripts/store/all.js", "//= require store/spree_multi_slideshow\n"
|
16
7
|
#append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_multi_slideshow\n"
|