spree_multi_slideshow 0.70.7 → 0.70.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,21 @@
1
1
  class SlideshowType < ActiveRecord::Base
2
- belongs_to :slide
2
+ has_many :slides
3
+ after_update :reprocess_slides
3
4
 
4
- 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
5
6
 
6
7
  validates :slide_number, :slide_width, :slide_height, :presence => true
7
8
  validates_uniqueness_of :category
8
9
  validates_numericality_of :slide_number, :only_integer => true
9
10
 
10
- scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
11
-
12
- def initialize(*args)
13
- super(*args)
11
+ scope :enable, where("enabled IS NOT NULL AND enabled = 1")
12
+
13
+ def reprocess_slides
14
+ self.slides.each do |slide|
15
+ slide.attachment_width = self.slide_width
16
+ slide.attachment_height = self.slide_height
17
+ slide.save!
18
+ slide.attachment.reprocess!(:custom)
19
+ end
14
20
  end
15
-
16
21
  end
@@ -1,14 +1,12 @@
1
1
  <% content_for :sidebar do %>
2
-
3
- <h3><%= t("slideshow_type.sidebar") %></h3>
2
+ <h3><%= t(:sidebar) %></h3>
4
3
  <br class="clear" />
5
-
6
4
  <ul class="sidebar slide-menu" data-hook="admin_slide_tabs">
7
- <li<%== ' class="active"' if current == 'Slideshow_type Details' %>>
8
- <%= link_to t("slideshow_type.detail"), edit_admin_slideshow_type_url(@slideshow_type) %>
5
+ <li<%== ' class="active"' if current == 'Slideshow Details' %>>
6
+ <%= link_to t(:detail), edit_admin_slideshow_type_url(@slideshow_type) %>
9
7
  </li>
10
- <li<%== ' class="active"' if current == 'Slide Image' %>>
11
- <%= link_to t("slideshow_type.slide.many"), admin_slideshow_type_slides_path(@slideshow_type) %>
8
+ <li<%== ' class="active"' if current == 'Slides' %>>
9
+ <%= link_to t(:slide), admin_slideshow_type_slides_path(@slideshow_type) %>
12
10
  </li>
13
11
  </ul>
14
12
  <br class="clear" />
@@ -1,8 +1,15 @@
1
- <%= f.inputs do %>
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] %>
8
- <% end %>
1
+ <%= f.hidden_field(:slideshow_type_id, :value => @slideshow_type.id) %>
2
+ <%= f.hidden_field(:attachment_width, :value => @slideshow_type.slide_width) %>
3
+ <%= f.hidden_field(:attachment_height, :value => @slideshow_type.slide_height) %>
4
+ <tr data-hook="file">
5
+ <td><%= t(:filename) %>:</td>
6
+ <td><%= f.file_field :attachment %></td>
7
+ </tr>
8
+ <tr data-hook="title">
9
+ <td><%= t(:title) %>:</td>
10
+ <td><%= f.text_field :title %></td>
11
+ </tr>
12
+ <tr data-hook="url">
13
+ <td><%= t(:url) %>:</td>
14
+ <td><%= f.text_field :url %></td>
15
+ </tr>
@@ -1,12 +1,12 @@
1
- <%= render :partial => 'admin/shared/slideshow_type_tabs', :locals => {:current => 'Slide Image'} %>
2
- <h1><%= t("slideshow_type.slide.editing_page") %></h1>
1
+ <%= render :partial => 'admin/shared/slideshow_type_tabs', :locals => {:current => 'Slides'} %>
2
+
3
3
  <%= render 'shared/error_messages', :target => @slide %>
4
4
 
5
- <%= semantic_form_for [:admin, @slideshow_type, @slide], :html => { :multipart => true } do |f| %>
6
- <table class="basic-table" data-hook="edit_image">
5
+ <%= form_for [:admin, @slideshow_type, @slide], :html => { :multipart => true } do |f| %>
6
+ <table class="basic-table" data-hook="edit_slide">
7
7
  <tr data-hook="thumbnail">
8
8
  <td><%= t(:thumbnail) %>:</td>
9
- <td><%= link_to image_tag(@slide.attachment.url(:small)), @slide.image.url(:medium) %></td>
9
+ <td><%= link_to image_tag(@slide.attachment.url(:small)), @slide.attachment.url(:medium) %></td>
10
10
  </tr>
11
11
  <%= render :partial => 'form', :locals => { :f => f } %>
12
12
  </table>
@@ -1,26 +1,20 @@
1
- <%= render :partial => 'admin/shared/slideshow_type_tabs', :locals => {:current => 'Slide Image'} %>
1
+ <%= render :partial => 'admin/shared/slideshow_type_tabs', :locals => {:current => 'Slides'} %>
2
2
 
3
- <%= javascript_include_tag 'admin/slides/index.js' %>
4
- <div id="slides" data-hook></div>
5
- <p data-hook="links">
6
- <%= link_to icon('add') + ' ' + t("slideshow_type.slide.new_page"), new_admin_slideshow_type_slide_url(@slideshow_type), :id => 'new_slide_link' %>
7
- </p>
8
-
9
- <table class="index sortable" data-hook="slide_table" data-hook data-sortable-link="<%= update_positions_admin_slideshow_type_slides_url %>">
3
+ <table class="index sortable" data-hook="images_table">
10
4
  <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.url") %></th>
5
+ <th><%= t(:thumbnail) %></th>
6
+ <th><%= t(:title) %></th>
7
+ <th><%= t(:url) %></th>
14
8
  <th><%= t(:action) %></th>
15
9
  </tr>
16
10
 
17
- <% Slide.find_all_by_slideshow_type_id(@slideshow_type.id).each do |slide| %>
18
- <tr id="<%= dom_id(slide) %>" data-hook="images_row">
11
+ <% @slideshow_type.slides.each do |slide| %>
12
+ <tr id="<%= dom_id(slide) %>" data-hook="slides_row">
19
13
  <td>
20
14
  <span class="handle"></span>
21
15
  <%= link_to image_tag(slide.attachment.url(:thumbnail)), slide.attachment.url(:medium) %>
22
16
  </td>
23
- <td><%= slide.title %></td>
17
+ <td><%= slide.title %></td>
24
18
  <td><%= slide.url %></td>
25
19
  <td class="actions">
26
20
  <%= link_to_with_icon 'edit', t(:edit), edit_admin_slideshow_type_slide_url(@slideshow_type, slide), :class => 'edit' %>
@@ -29,5 +23,10 @@
29
23
  </td>
30
24
  </tr>
31
25
  <% end %>
26
+ </table>
32
27
 
33
- </table>
28
+ <div id="slides" data-hook></div>
29
+ <br />
30
+ <p data-hook="links">
31
+ <%= link_to icon('add') + ' ' + t(:new_slide), new_admin_slideshow_type_slide_url(@slideshow_type), :id => 'new_slide_link' %>
32
+ </p>
@@ -1,5 +1,5 @@
1
- <h4><%= t("slideshow_type.slide.new_page") %></h4>
2
- <%= semantic_form_for [:admin, @slideshow_type, @slide], :html => { :multipart => true } do |f| %>
1
+ <h4><%= t(:new_slide) %></h4>
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,40 @@
1
- <%= f.inputs do %>
2
- <%= f.input :category %>
3
- <%= f.input :slide_width %>
4
- <%= f.input :slide_height %>
5
- <%= f.input :slide_number %>
6
- <%= f.input :enable_navigation %>
7
- <%= f.input :enabled %>
8
- <% end %>
1
+ <div class="clearfix">
2
+ <div class="left" data-hook="admin_slideshow_form_left">
3
+ <%= f.field_container :category do %>
4
+ <%= f.label :category, t(:category) %> <span class="required">*</span><br />
5
+ <%= f.text_field :category, :class => 'fullwidth title' %>
6
+ <%= f.error_message_on :category %>
7
+ <% end %>
8
+
9
+ <%= f.field_container :slide_width do %>
10
+ <%= f.label :slide_width, t(:slide_width) %> <span class="required">*</span><br />
11
+ <%= f.text_field :slide_width, :class => 'fullwidth title' %>
12
+ <%= f.error_message_on :slide_width %>
13
+ <% end %>
14
+
15
+ <%= f.field_container :slide_height do %>
16
+ <%= f.label :slide_height, t(:slide_height)%> <span class="required">*</span><br />
17
+ <%= f.text_field :slide_height, :class => 'fullwidth title' %>
18
+ <%= f.error_message_on :slide_height %>
19
+ <% end %>
20
+ </div>
21
+ <div class="right" data-hook="admin_slideshow_form_right">
22
+ <%= f.field_container :slide_number do %>
23
+ <%= f.label :slide_number, t(:slide_number) %><br />
24
+ <%= f.text_field :slide_number, :class => 'title' %>
25
+ <%= f.error_message_on :slide_number %>
26
+ <% end %>
27
+
28
+ <%= f.field_container :enable_navigation do %>
29
+ <%= f.label :enable_navigation, t(:enable_navigation) %><br />
30
+ <%= f.check_box :enable_navigation, :class => 'title' %>
31
+ <%= f.error_message_on :enable_navigation %>
32
+ <% end %>
33
+
34
+ <%= f.field_container :enabled do %>
35
+ <%= f.label :enabled, t(:enabled) %> <span class="required">*</span><br />
36
+ <%= f.check_box :enabled, :class => 'title' %>
37
+ <%= f.error_message_on :enabled %>
38
+ <% end %>
39
+ </div>
40
+ </div>
@@ -1,8 +1,7 @@
1
- <h1><%= t("slideshow_type.editing_page") %></h1>
2
- <%= render :partial => 'admin/shared/slideshow_type_tabs', :locals => {:current => 'Slideshow_type Details'} %>
3
- <%= render "shared/error_messages", :target => @slideshow_type %>
1
+ <%= render :partial => 'admin/shared/slideshow_type_tabs', :locals => {:current => 'Slideshow Details'} %>
2
+ <%= render 'shared/error_messages', :target => @slideshow_type %>
4
3
 
5
- <%= semantic_form_for([:admin, @slideshow_type]) do |f| %>
6
- <%= render :partial => "form", :locals => { :f => f } %>
7
- <%= render :partial => 'admin/shared/edit_resource_links' %>
8
- <% end %>
4
+ <%= form_for [:admin, @slideshow_type], :html => { :method => :put, :multipart => true } do |f| %>
5
+ <%= render :partial => 'form', :locals => {:f => f} %>
6
+ <%= render :partial => 'admin/shared/edit_resource_links' %>
7
+ <% end %>
@@ -1,32 +1,32 @@
1
- <div class='toolbar'>
2
- <ul class='actions'>
3
- <li id="new_product_link">
4
- <%= button_link_to t("slideshow_type.new_page"), new_admin_slideshow_type_url, {:icon => 'add'} %>
5
- </li>
6
- </ul>
7
- <br class='clear' />
1
+ <div class="toolbar" data-hook="toolbar">
2
+ <ul class="actions">
3
+ <li id="new_slideshow_type_link">
4
+ <%= button_link_to t(:new_slideshow_type), new_object_url, {:remote => true, :icon => 'add', :id => 'admin_new_slideshow_type'} %>
5
+ </li>
6
+ </ul>
7
+ <br class="clear" />
8
8
  </div>
9
9
 
10
- <h1><%= t("slideshow_type.many") %></h1>
10
+ <h1><%= "#{t('actions.listing')} #{t(:slideshow_type)}" %></h1>
11
11
 
12
- <table class="index">
13
- <tr>
14
- <th><%= t("slideshow_type.category") %></th>
15
- <th><%= t("slideshow_type.enable") %></th>
16
- <th><%= t("slideshow_type.slide_number") %></th>
17
- <th><%= t("action") %></th>
18
- </tr>
19
- <tbody>
20
- <% @slideshow_types.each do |slideshow_type| %>
21
- <tr class="<%= cycle('even', 'odd') %>" id="<%= dom_id slideshow_type %>">
22
- <td><%= slideshow_type.category %></td>
23
- <td><%= icon('tick') if slideshow_type.enabled %></td>
24
- <td><%= slideshow_type.slide_number %></td>
25
- <td>
26
- <%= link_to_edit slideshow_type %> &nbsp;
27
- <%= link_to_delete slideshow_type %>
28
- </td>
29
- </tr>
30
- <% end %>
31
- </tbody>
32
- </table>
12
+ <div id="new_slideshow" data-hook></div>
13
+
14
+ <table class="index" id="listing_slideshow_types">
15
+ <tr data-hook="admin_slideshow_types_index_headers">
16
+ <th><%= t(:category) %></th>
17
+ <th><%= t(:enable) %></th>
18
+ <th><%= t(:slide_number) %></th>
19
+ <th data-hook="admin_slideshow_types_index_header_actions"></th>
20
+ </tr>
21
+ <% @slideshow_types.each do |slideshow_type| %>
22
+ <tr id="<%= 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' %>&nbsp;
28
+ <%= link_to_delete slideshow_type %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </table>
@@ -1,7 +1,49 @@
1
- <h1><%= t("slideshow_type.new_page") %></h1>
2
- <%= render "shared/error_messages", :target => @slideshow_type %>
1
+ <%= render 'shared/error_messages', :target => @slideshow_type %>
3
2
 
4
- <%= semantic_form_for([:admin, @slideshow_type], :html => { :enctype => "multipart/form-data" }) do |f| %>
5
- <%= render :partial => "form", :locals => { :f => f } %>
6
- <%= render :partial => 'admin/shared/new_resource_links' %>
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) %> <span class="required">*</span><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) %><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, :class => 'fullwidth title' %>
35
+ <%= f.error_message_on :enable_navigation %>
36
+ <% end %>
37
+
38
+ <%= f.field_container :enabled do %>
39
+ <%= f.label :enabled, t(:enabled) %> <span class="required">*</span><br />
40
+ <%= f.check_box :enabled, :class => 'fullwidth title' %>
41
+ <%= f.error_message_on :enabled %>
42
+ <% end %>
43
+ </div>
44
+ </div>
45
+
46
+ <%= render :partial => 'admin/shared/new_resource_links' %>
47
+
48
+ </fieldset>
7
49
  <% end %>
@@ -0,0 +1,2 @@
1
+ $("#new_slideshow").html('<%= escape_javascript(render :template => "admin/slideshow_types/new.html.erb") %>');
2
+ $("#admin_new_slideshow").parent().hide();
@@ -9,6 +9,7 @@ it:
9
9
  slide_height: Altezza
10
10
  slide_number: Numero Slide
11
11
  enable_navigation: Tasti navigazione attivi?
12
+ enable_pagination: Paginazione attiva?
12
13
  slide:
13
14
  title: Titolo
14
15
  url: Link a prodotto o tassonomia o a sito esterno
@@ -21,25 +22,23 @@ it:
21
22
  one: Slide
22
23
  many: Slides
23
24
 
24
- slideshow_type:
25
- one: Slideshow
26
- many: Slideshows
27
- enable: Attivo?
28
- category: Categoria
29
- slide_number: Numero Slide
30
- detail: Attributi
31
- sidebar: Gestione slideshow e slide.
32
- new_page: Nuovo slideshow
33
- slide:
34
- one: Slide
35
- many: Slides
36
- new_page: Nuova slide
37
- image:
38
- one: Immagine
39
- many: Immagini
40
- thumbnail: Miniatura
41
- title: Titolo
42
- url: Link a prodotto o tassonomia o a sito esterno
43
- editing_page: Modifica slide
44
- editing_page: Modifica slideshow
45
- confirm_delete: Sei sicuro?
25
+ new_slideshow_type: "Nuovo Slideshow"
26
+ slideshow_type: "Slideshow"
27
+ slideshow_types: "Slideshows"
28
+ enable: Attivo?
29
+ category: Categoria
30
+ slide_number: Numero Slide
31
+ detail: Attributi
32
+ sidebar: Gestione slideshow e slide.
33
+ new_page: Nuovo slideshow
34
+ slide: "Slide"
35
+ slides: "Slides"
36
+ new_slide: Nuova slide
37
+ image:
38
+ one: Immagine
39
+ many: Immagini
40
+ thumbnail: Miniatura
41
+ title: Titolo
42
+ url: Link a prodotto o tassonomia o a sito esterno
43
+ editing_page: Modifica
44
+ confirm_delete: Sei sicuro?
@@ -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 => 1
9
+ t.boolean :enable_navigation, :default => 0
10
10
 
11
11
  t.timestamps
12
12
  end
@@ -0,0 +1,13 @@
1
+ class AddOptionPagination < ActiveRecord::Migration
2
+ def up
3
+ add_column :slideshow_types, :enable_pagination, :boolean, :default => false, :after => :enable_navigation
4
+ add_column :slides, :attachment_width, :string, :after => :attachment_size
5
+ add_column :slides, :attachment_height, :string, :after => :attachment_width
6
+ end
7
+
8
+ def down
9
+ remove_column :slideshow_types, :enable_pagination
10
+ remove_column :slides, :attachment_width
11
+ remove_column :slides, :attachment_height
12
+ end
13
+ 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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_multi_slideshow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.70.7
4
+ version: 0.70.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-22 00:00:00.000000000 Z
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
@@ -28,7 +28,7 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: formtastic
31
+ name: paperclip
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: paperclip
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: 2.5.0
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: 2.5.0
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: rspec-rails
64
48
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +70,8 @@ files:
86
70
  - lib/generators/spree_multi_slideshow/install/install_generator.rb
87
71
  - lib/spree_multi_slideshow/engine.rb
88
72
  - lib/spree_multi_slideshow.rb
73
+ - app/assets/images/store/bx_loader.gif
74
+ - app/assets/images/store/controls.png
89
75
  - app/assets/images/store/slides/bg-gallery.png
90
76
  - app/assets/images/store/slides/bg-text02.png
91
77
  - app/assets/images/store/slides/sprite01.png
@@ -113,9 +99,11 @@ files:
113
99
  - app/views/admin/slideshow_types/edit.html.erb
114
100
  - app/views/admin/slideshow_types/index.html.erb
115
101
  - app/views/admin/slideshow_types/new.html.erb
102
+ - app/views/admin/slideshow_types/new.js.erb
116
103
  - db/migrate/20120116081431_create_slideshow_types.rb
117
104
  - db/migrate/20120116083546_create_slides.rb
118
105
  - db/migrate/20120719112245_rename_image_to_attachment.rb
106
+ - db/migrate/20130116143809_add_option_pagination.rb
119
107
  - config/locales/en.yml
120
108
  - config/locales/it.yml
121
109
  - config/routes.rb