spree_multi_slideshow 0.70.5 → 0.70.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/app/assets/stylesheets/admin/spree_multi_slideshow.css +14 -0
- data/app/controllers/admin/slides_controller.rb +6 -6
- data/app/helpers/slideshow_types_helper.rb +1 -1
- data/app/models/slide.rb +8 -5
- data/app/models/slideshow_type.rb +3 -2
- data/app/views/admin/slides/_form.html.erb +6 -4
- data/app/views/admin/slides/edit.html.erb +1 -1
- data/app/views/admin/slides/index.html.erb +2 -2
- data/db/migrate/20120116083546_create_slides.rb +1 -1
- data/db/migrate/20120719112245_rename_image_to_attachment.rb +15 -0
- data/lib/generators/spree_multi_slideshow/install/install_generator.rb +11 -2
- metadata +68 -99
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Basic Installation
|
|
9
9
|
|
10
10
|
1. Add the following to your Gemfile
|
11
11
|
<pre>
|
12
|
-
gem 'spree_multi_slideshow',
|
12
|
+
gem 'spree_multi_slideshow', '~> 0.70.6'
|
13
13
|
</pre>
|
14
14
|
2. Run `bundle install`
|
15
15
|
3. To copy and apply migrations run:
|
@@ -1,3 +1,17 @@
|
|
1
1
|
/*
|
2
2
|
*= require admin/spree_core
|
3
|
+
*= require formtastic
|
3
4
|
*/
|
5
|
+
|
6
|
+
.formtastic input, .formtastic textarea, .formtastic select {
|
7
|
+
font-size: 100%;
|
8
|
+
padding: 5px;
|
9
|
+
}
|
10
|
+
|
11
|
+
.formtastic button {
|
12
|
+
margin: 0;
|
13
|
+
padding: 0 20px 0 0;
|
14
|
+
}
|
15
|
+
.formtastic button:hover {
|
16
|
+
text-shadow: #FFFFFF -1px -1px 0px;
|
17
|
+
}
|
@@ -1,21 +1,21 @@
|
|
1
1
|
class Admin::SlidesController < Admin::ResourceController
|
2
|
-
before_filter :load_data
|
3
|
-
|
4
|
-
def load_data
|
5
|
-
@slideshow_type = SlideshowType.find(params[:slideshow_type_id])
|
6
|
-
end
|
2
|
+
before_filter :load_data, :only => [:index, :new, :show, :edit]
|
7
3
|
|
8
4
|
def update_positions
|
9
5
|
params[:positions].each do |id, index|
|
10
|
-
|
6
|
+
Slide.update_all(['position=?', index], ['id=?', id])
|
11
7
|
end
|
12
8
|
|
13
9
|
respond_to do |format|
|
10
|
+
format.html { redirect_to admin_slideshow_type_slides_url(@slideshow_type) }
|
14
11
|
format.js { render :text => 'Ok' }
|
15
12
|
end
|
16
13
|
end
|
17
14
|
|
18
15
|
private
|
16
|
+
def load_data
|
17
|
+
@slideshow_type = SlideshowType.find(params[:slideshow_type_id])
|
18
|
+
end
|
19
19
|
|
20
20
|
def location_after_save
|
21
21
|
admin_slideshow_type_slides_url(@slideshow_type)
|
@@ -22,7 +22,7 @@ module SlideshowTypesHelper
|
|
22
22
|
slides = Slide.where("slideshow_type_id = ?", slideshow.first.id).limit(max).sort_by { |slide| slide.position }
|
23
23
|
|
24
24
|
slides.map do |slide|
|
25
|
-
content_tag(:li, raw(link_to(image_tag(slide.
|
25
|
+
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)), :class => "text-holder")))
|
26
26
|
end.join
|
27
27
|
else
|
28
28
|
false
|
data/app/models/slide.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
class Slide < ActiveRecord::Base
|
2
|
-
|
3
2
|
has_many :slideshow_types
|
4
|
-
validates_presence_of :slideshow_type_id
|
5
3
|
|
6
|
-
|
4
|
+
attr_accessor :attachment_width, :attachment_height
|
5
|
+
attr_accessible :title, :url, :slideshow_type_id, :attachment, :attachment_width, :attachment_height
|
6
|
+
|
7
|
+
has_attached_file :attachment,
|
7
8
|
:url => "/spree/slides/:id/:style_:basename.:extension",
|
8
9
|
:path => ":rails_root/public/spree/slides/:id/:style_:basename.:extension",
|
9
10
|
#:default_url => "/missing/:style.jpg",
|
@@ -12,7 +13,7 @@ class Slide < ActiveRecord::Base
|
|
12
13
|
:small => "300x100#",
|
13
14
|
:medium => "600x200#",
|
14
15
|
:slide => "900x300#",
|
15
|
-
:custom => Proc.new {
|
16
|
+
:custom => Proc.new {|instance| "#{instance.attachment_width}x#{instance.attachment_height}#"}
|
16
17
|
},
|
17
18
|
:convert_options => {
|
18
19
|
:thumbnail => "-gravity center",
|
@@ -22,7 +23,9 @@ class Slide < ActiveRecord::Base
|
|
22
23
|
:custom => "-gravity center"
|
23
24
|
}
|
24
25
|
|
25
|
-
|
26
|
+
validates_presence_of :slideshow_type_id
|
27
|
+
validates_attachment_presence :attachment
|
28
|
+
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"
|
26
29
|
|
27
30
|
def initialize(*args)
|
28
31
|
super(*args)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class SlideshowType < ActiveRecord::Base
|
2
|
-
|
3
2
|
belongs_to :slide
|
4
|
-
|
3
|
+
|
4
|
+
attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled
|
5
|
+
|
5
6
|
validates :slide_number, :slide_width, :slide_height, :presence => true
|
6
7
|
validates_uniqueness_of :category
|
7
8
|
validates_numericality_of :slide_number, :only_integer => true
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<%= f.inputs do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
<%= f.input :title %>
|
3
|
+
<%= f.input :url %>
|
4
|
+
<%= f.input :attachment_width, :input_html => { :value => @slideshow_type.slide_width}, :as => :hidden %>
|
5
|
+
<%= f.input :attachment_height, :input_html => { :value => @slideshow_type.slide_height}, :as => :hidden %>
|
6
|
+
<%= f.input :attachment, :as => :file, :label => I18n.t("slideshow_type.slide.image.one").capitalize, :hint => f.object.attachment.blank? ? f.template.content_tag(:span, "No Image Yet") : f.template.image_tag(f.object.attachment.url(:thumbnail)) %>
|
7
|
+
<%= f.input :slideshow_type_id, :as => :hidden, :value => params[:slideshow_type_id] %>
|
6
8
|
<% end %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<table class="basic-table" data-hook="edit_image">
|
7
7
|
<tr data-hook="thumbnail">
|
8
8
|
<td><%= t(:thumbnail) %>:</td>
|
9
|
-
<td><%= link_to image_tag(@slide.
|
9
|
+
<td><%= link_to image_tag(@slide.attachment.url(:small)), @slide.image.url(:medium) %></td>
|
10
10
|
</tr>
|
11
11
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
12
12
|
</table>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= link_to icon('add') + ' ' + t("slideshow_type.slide.new_page"), new_admin_slideshow_type_slide_url(@slideshow_type), :id => 'new_slide_link' %>
|
7
7
|
</p>
|
8
8
|
|
9
|
-
<table class="index sortable" data-hook="slide_table">
|
9
|
+
<table class="index sortable" data-hook="slide_table" data-hook data-sortable-link="<%= update_positions_admin_slideshow_type_slides_url %>">
|
10
10
|
<tr data-hook="images_header">
|
11
11
|
<th><%= t("slideshow_type.slide.thumbnail") %></th>
|
12
12
|
<th><%= t("slideshow_type.slide.title") %></th>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<tr id="<%= dom_id(slide) %>" data-hook="images_row">
|
19
19
|
<td>
|
20
20
|
<span class="handle"></span>
|
21
|
-
<%= link_to image_tag(slide.
|
21
|
+
<%= link_to image_tag(slide.attachment.url(:thumbnail)), slide.attachment.url(:medium) %>
|
22
22
|
</td>
|
23
23
|
<td><%= slide.title %></td>
|
24
24
|
<td><%= slide.url %></td>
|
@@ -3,7 +3,7 @@ class CreateSlides < ActiveRecord::Migration
|
|
3
3
|
create_table :slides do |t|
|
4
4
|
t.string :title, :url
|
5
5
|
|
6
|
-
t.string :image_content_type, :image_file_name
|
6
|
+
t.string :image_content_type, :image_file_name
|
7
7
|
t.datetime :image_updated_at
|
8
8
|
t.integer :image_size, :position
|
9
9
|
t.string :type, :limit => 75
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class RenameImageToAttachment < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
rename_column :slides, :image_content_type, :attachment_content_type
|
4
|
+
rename_column :slides, :image_file_name, :attachment_file_name
|
5
|
+
rename_column :slides, :image_updated_at, :attachment_updated_at
|
6
|
+
rename_column :slides, :image_size, :attachment_size
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
rename_column :slides, :attachment_content_type, :image_content_type
|
11
|
+
rename_column :slides, :attachment_file_name, :image_file_name
|
12
|
+
rename_column :slides, :attachment_updated_at, :image_updated_at
|
13
|
+
rename_column :slides, :attachment_size, :image_size
|
14
|
+
end
|
15
|
+
end
|
@@ -1,10 +1,19 @@
|
|
1
1
|
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
|
+
|
5
14
|
def add_javascripts
|
6
15
|
append_file "app/assets/javascripts/store/all.js", "//= require store/spree_multi_slideshow\n"
|
7
|
-
|
16
|
+
append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_multi_slideshow\n"
|
8
17
|
end
|
9
18
|
|
10
19
|
def add_stylesheets
|
metadata
CHANGED
@@ -1,107 +1,86 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_multi_slideshow
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.70.6
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 70
|
9
|
-
- 5
|
10
|
-
version: 0.70.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Damiano Giacomello
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: spree_core
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 70
|
32
|
-
- 5
|
33
|
-
version: 0.70.5
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: spree_auth
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
25
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
- 0
|
47
|
-
- 70
|
48
|
-
- 5
|
49
|
-
version: 0.70.5
|
50
|
-
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
53
31
|
name: formtastic
|
54
|
-
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
56
33
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
version: "0"
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
64
38
|
type: :runtime
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: paperclip
|
68
39
|
prerelease: false
|
69
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: paperclip
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
70
49
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 27
|
75
|
-
segments:
|
76
|
-
- 2
|
77
|
-
- 5
|
78
|
-
- 0
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
79
53
|
version: 2.5.0
|
80
54
|
type: :runtime
|
81
|
-
version_requirements: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: rspec-rails
|
84
55
|
prerelease: false
|
85
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.5.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec-rails
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
86
65
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
94
70
|
type: :development
|
95
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
96
78
|
description:
|
97
79
|
email: damiano.giacomello@diginess.it
|
98
80
|
executables: []
|
99
|
-
|
100
81
|
extensions: []
|
101
|
-
|
102
82
|
extra_rdoc_files: []
|
103
|
-
|
104
|
-
files:
|
83
|
+
files:
|
105
84
|
- README.md
|
106
85
|
- LICENSE
|
107
86
|
- lib/generators/spree_multi_slideshow/install/install_generator.rb
|
@@ -136,38 +115,29 @@ files:
|
|
136
115
|
- app/views/admin/slideshow_types/new.html.erb
|
137
116
|
- db/migrate/20120116081431_create_slideshow_types.rb
|
138
117
|
- db/migrate/20120116083546_create_slides.rb
|
118
|
+
- db/migrate/20120719112245_rename_image_to_attachment.rb
|
139
119
|
- config/locales/en.yml
|
140
120
|
- config/locales/it.yml
|
141
121
|
- config/routes.rb
|
142
122
|
homepage:
|
143
123
|
licenses: []
|
144
|
-
|
145
124
|
post_install_message:
|
146
125
|
rdoc_options: []
|
147
|
-
|
148
|
-
require_paths:
|
126
|
+
require_paths:
|
149
127
|
- lib
|
150
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
129
|
none: false
|
152
|
-
requirements:
|
153
|
-
- -
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
hash: 57
|
156
|
-
segments:
|
157
|
-
- 1
|
158
|
-
- 8
|
159
|
-
- 7
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
160
133
|
version: 1.8.7
|
161
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
135
|
none: false
|
163
|
-
requirements:
|
164
|
-
- -
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
|
167
|
-
|
168
|
-
- 0
|
169
|
-
version: "0"
|
170
|
-
requirements:
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements:
|
171
141
|
- none
|
172
142
|
rubyforge_project:
|
173
143
|
rubygems_version: 1.8.22
|
@@ -175,4 +145,3 @@ signing_key:
|
|
175
145
|
specification_version: 3
|
176
146
|
summary: Extension to manage multi slideshow for Spree Shop
|
177
147
|
test_files: []
|
178
|
-
|