spree_banner 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/stylesheets/admin/spree_banner.css +14 -0
- data/app/models/spree/banner.rb +3 -0
- data/app/views/spree/admin/banners/_form.html.erb +7 -7
- data/app/views/spree/admin/banners/edit.html.erb +1 -1
- data/app/views/spree/admin/banners/index.html.erb +5 -5
- data/app/views/spree/admin/banners/new.html.erb +1 -1
- data/lib/generators/spree_banner/install/install_generator.rb +1 -0
- metadata +4 -4
@@ -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/spree/banner.rb
CHANGED
@@ -13,6 +13,9 @@ module Spree
|
|
13
13
|
:thumbnail => "-gravity center"
|
14
14
|
}
|
15
15
|
|
16
|
+
validates_presence_of :category, :attachment_width, :attachment_height
|
17
|
+
validates_attachment_presence :attachment
|
18
|
+
validates_attachment_content_type :attachment, :content_type => ['image/jpeg', 'image/png', 'image/gif'], :message => "deve essere JPG, JPEG o PNG"
|
16
19
|
#process_in_background :image UTILE MA OCCORRE ATTIVARE ANCHE LA GEMMA DELAYED-PAPERCLIP
|
17
20
|
scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
|
18
21
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%= f.inputs do %>
|
2
|
-
<%= f.input :category %>
|
3
|
-
<%= f.input :url %>
|
4
|
-
<%= f.input :position %>
|
5
|
-
<%= f.input :attachment_width %>
|
6
|
-
<%= f.input :attachment_height %>
|
7
|
-
<%= f.input :enabled %>
|
8
|
-
<%= f.input :attachment, :as => :file, :label =>
|
2
|
+
<%= f.input :category, :required => true, :label => t("banner.category") %>
|
3
|
+
<%= f.input :url, :label => t("banner.url") %>
|
4
|
+
<%= f.input :position, :label => t("banner.position") %>
|
5
|
+
<%= f.input :attachment_width, :required => true, :label => t("banner.attachment_width") %>
|
6
|
+
<%= f.input :attachment_height, :required => true, :label => t("banner.attachment_height") %>
|
7
|
+
<%= f.input :enabled, :label => t("banner.enabled") %>
|
8
|
+
<%= f.input :attachment, :required => true, :as => :file, :label => t("banner.image.one").capitalize, :hint => f.object.attachment.blank? ? f.template.content_tag(:span, t("banner.no_image")) : f.template.image_tag(f.object.attachment.url(:thumbnail)) %>
|
9
9
|
<% end %>
|
@@ -1,19 +1,19 @@
|
|
1
1
|
<div class='toolbar'>
|
2
2
|
<ul class='actions'>
|
3
3
|
<li>
|
4
|
-
<%= button_link_to t(
|
4
|
+
<%= button_link_to t("banner.new_banner"), spree.new_admin_banner_path, :icon => 'add' %>
|
5
5
|
</li>
|
6
6
|
</ul>
|
7
7
|
<br class="clear" />
|
8
8
|
</div>
|
9
9
|
|
10
|
-
<h1><%= t(
|
10
|
+
<h1><%= t("banner.many") %></h1>
|
11
11
|
|
12
12
|
<table class="index">
|
13
13
|
<tr>
|
14
|
-
<th><%= t(
|
15
|
-
<th><%= t(
|
16
|
-
<th><%= t(
|
14
|
+
<th><%= t("banner.category") %></th>
|
15
|
+
<th><%= t("banner.position") %></th>
|
16
|
+
<th><%= t("banner.enable") %></th>
|
17
17
|
<th><%= t(:action) %></th>
|
18
18
|
</tr>
|
19
19
|
<tbody>
|
@@ -3,6 +3,7 @@ module SpreeBanner
|
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
4
|
|
5
5
|
def add_stylesheets
|
6
|
+
inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_banner\n", :before => /\*\//, :verbose => true
|
6
7
|
inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_banner\n", :before => /\*\//, :verbose => true
|
7
8
|
end
|
8
9
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_banner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Damiano Giacomello
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-21 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: spree_core
|