spree_banner 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
+ }
@@ -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 => I18n.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)) %>
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,4 +1,4 @@
1
- <h1><%= t(:editing_banner) %></h1>
1
+ <h1><%= t("banner.editing_banner") %></h1>
2
2
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @banner } %>
3
3
 
4
4
  <%= semantic_form_for([:admin, @banner]) do |f| %>
@@ -1,19 +1,19 @@
1
1
  <div class='toolbar'>
2
2
  <ul class='actions'>
3
3
  <li>
4
- <%= button_link_to t(:new_banner), spree.new_admin_banner_path, :icon => 'add' %>
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(:banner) %></h1>
10
+ <h1><%= t("banner.many") %></h1>
11
11
 
12
12
  <table class="index">
13
13
  <tr>
14
- <th><%= t(:category) %></th>
15
- <th><%= t(:position) %></th>
16
- <th><%= t(:enable) %></th>
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>
@@ -1,4 +1,4 @@
1
- <h1><%= t(:new_banner) %></h1>
1
+ <h1><%= t("banner.new_banner") %></h1>
2
2
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @banner } %>
3
3
 
4
4
  <%= semantic_form_for([:admin, @banner], :html => { :enctype => "multipart/form-data" }) do |f| %>
@@ -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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.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-15 00:00:00 Z
18
+ date: 2012-03-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: spree_core