spree_banner 0.70.4 → 0.70.5
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -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
|
+
}
|
data/app/models/banner.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class Banner < ActiveRecord::Base
|
2
2
|
|
3
|
+
attr_accessible :category, :url, :position, :attachment_width, :attachment_height, :enabled, :attachment
|
4
|
+
|
3
5
|
has_attached_file :attachment,
|
4
6
|
:url => "/spree/banner/:id/:style_:basename.:extension",
|
5
7
|
:path => ":rails_root/public/spree/banner/:id/:style_:basename.:extension",
|
@@ -13,7 +15,12 @@ class Banner < ActiveRecord::Base
|
|
13
15
|
:custom => "-gravity center"
|
14
16
|
}
|
15
17
|
|
16
|
-
|
18
|
+
|
19
|
+
after_post_process :find_dimensions
|
20
|
+
validates_presence_of :category, :attachment_width, :attachment_height
|
21
|
+
validates_attachment_presence :attachment
|
22
|
+
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"
|
23
|
+
|
17
24
|
scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
|
18
25
|
|
19
26
|
def initialize(*args)
|
@@ -22,4 +29,12 @@ class Banner < ActiveRecord::Base
|
|
22
29
|
self.position = last_banner ? last_banner.position + 1 : 0
|
23
30
|
end
|
24
31
|
|
32
|
+
def find_dimensions
|
33
|
+
temporary = attachment.queued_for_write[:original]
|
34
|
+
filename = temporary.path unless temporary.nil?
|
35
|
+
filename = attachment.path if filename.blank?
|
36
|
+
geometry = Paperclip::Geometry.from_file(filename)
|
37
|
+
self.attachment_width = geometry.width
|
38
|
+
self.attachment_height = geometry.height
|
39
|
+
end
|
25
40
|
end
|
@@ -1,8 +1,18 @@
|
|
1
1
|
module SpreeBanner
|
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_stylesheets
|
15
|
+
inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_banner\n", :before => /\*\//, :verbose => true
|
6
16
|
inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_banner\n", :before => /\*\//, :verbose => true
|
7
17
|
end
|
8
18
|
|
metadata
CHANGED
@@ -1,103 +1,86 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_banner
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.70.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 70
|
9
|
-
- 4
|
10
|
-
version: 0.70.4
|
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
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: spree_auth
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
25
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
46
|
-
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
49
31
|
name: formtastic
|
50
|
-
|
51
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
52
33
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
version: "0"
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
60
38
|
type: :runtime
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: paperclip
|
64
39
|
prerelease: false
|
65
|
-
|
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
|
66
49
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
hash: 27
|
71
|
-
segments:
|
72
|
-
- 2
|
73
|
-
- 5
|
74
|
-
- 0
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
75
53
|
version: 2.5.0
|
76
54
|
type: :runtime
|
77
|
-
version_requirements: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rspec-rails
|
80
55
|
prerelease: false
|
81
|
-
|
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
|
82
65
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
90
70
|
type: :development
|
91
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
92
78
|
description:
|
93
79
|
email: damiano.giacomello@diginess.it
|
94
80
|
executables: []
|
95
|
-
|
96
81
|
extensions: []
|
97
|
-
|
98
82
|
extra_rdoc_files: []
|
99
|
-
|
100
|
-
files:
|
83
|
+
files:
|
101
84
|
- README.md
|
102
85
|
- LICENSE
|
103
86
|
- lib/generators/spree_banner/install/install_generator.rb
|
@@ -121,38 +104,27 @@ files:
|
|
121
104
|
- config/routes.rb
|
122
105
|
homepage:
|
123
106
|
licenses: []
|
124
|
-
|
125
107
|
post_install_message:
|
126
108
|
rdoc_options: []
|
127
|
-
|
128
|
-
require_paths:
|
109
|
+
require_paths:
|
129
110
|
- lib
|
130
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
112
|
none: false
|
132
|
-
requirements:
|
133
|
-
- -
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
hash: 57
|
136
|
-
segments:
|
137
|
-
- 1
|
138
|
-
- 8
|
139
|
-
- 7
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
140
116
|
version: 1.8.7
|
141
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
118
|
none: false
|
143
|
-
requirements:
|
144
|
-
- -
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
|
147
|
-
|
148
|
-
- 0
|
149
|
-
version: "0"
|
150
|
-
requirements:
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements:
|
151
124
|
- none
|
152
125
|
rubyforge_project:
|
153
|
-
rubygems_version: 1.8.
|
126
|
+
rubygems_version: 1.8.22
|
154
127
|
signing_key:
|
155
128
|
specification_version: 3
|
156
129
|
summary: Extension to manage banner for you Spree Shop
|
157
130
|
test_files: []
|
158
|
-
|