spree_multi_slideshow 1.1.8 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/README.md +3 -3
  2. data/app/assets/images/store/slides/bg-gallery.png +0 -0
  3. data/app/assets/images/store/slides/bg-text02.png +0 -0
  4. data/app/assets/javascripts/admin/slides/index.js +1 -1
  5. data/app/assets/javascripts/admin/slides/new.js +1 -1
  6. data/app/assets/javascripts/admin/spree_multi_slideshow.js +1 -1
  7. data/app/assets/javascripts/store/spree_multi_slideshow.js +211 -537
  8. data/app/assets/stylesheets/admin/spree_multi_slideshow.css +16 -0
  9. data/app/assets/stylesheets/store/carousel_slideshow.css.scss +73 -0
  10. data/app/assets/stylesheets/store/spree_multi_slideshow.css +3 -47
  11. data/app/controllers/spree/admin/slides_controller.rb +5 -3
  12. data/app/controllers/spree/admin/slideshow_types_controller.rb +1 -5
  13. data/app/controllers/spree/slides_controller.rb +5 -0
  14. data/app/controllers/spree/slideshow_types_controller.rb +5 -0
  15. data/app/helpers/spree/slides_helper.rb +4 -0
  16. data/app/helpers/spree/slideshow_types_helper.rb +46 -44
  17. data/app/models/spree/slide.rb +27 -39
  18. data/app/models/spree/slideshow_type.rb +10 -4
  19. data/app/overrides/slideshow_type_admin_tab.rb +1 -6
  20. data/app/views/spree/admin/shared/_slideshow_type_tabs.html.erb +6 -8
  21. data/app/views/spree/admin/slides/_form.html.erb +9 -22
  22. data/app/views/spree/admin/slides/edit.html.erb +7 -7
  23. data/app/views/spree/admin/slides/index.html.erb +31 -30
  24. data/app/views/spree/admin/slides/new.html.erb +2 -2
  25. data/app/views/spree/admin/slideshow_types/_form.html.erb +8 -30
  26. data/app/views/spree/admin/slideshow_types/edit.html.erb +7 -6
  27. data/app/views/spree/admin/slideshow_types/index.html.erb +29 -30
  28. data/app/views/spree/admin/slideshow_types/new.html.erb +5 -33
  29. data/config/locales/en.yml +0 -1
  30. data/config/locales/it.yml +0 -1
  31. data/config/routes.rb +0 -1
  32. data/db/migrate/20120116081431_create_slideshow_types.rb +4 -1
  33. data/db/migrate/20120116083546_create_slides.rb +1 -0
  34. data/lib/generators/spree_multi_slideshow/install/install_generator.rb +22 -2
  35. data/lib/spree_multi_slideshow.rb +2 -0
  36. metadata +110 -81
  37. data/app/assets/images/store/slides/pagination.png +0 -0
  38. data/app/assets/javascripts/admin/slide_settings.js +0 -31
  39. data/app/controllers/spree/admin/slide_settings_controller.rb +0 -51
  40. data/app/models/spree/app_configuration_decorator.rb +0 -8
  41. data/app/views/spree/admin/shared/_slide_setting_configurations_menu.html.erb +0 -4
  42. data/app/views/spree/admin/slide_settings/edit.html.erb +0 -48
  43. data/app/views/spree/admin/slide_settings/show.html.erb +0 -10
  44. data/app/views/spree/admin/slideshow_types/new.js.erb +0 -2
  45. data/db/migrate/20130114150224_add_enable_pagination.rb +0 -5
  46. data/db/migrate/20130226082756_add_enable_to_slide.rb +0 -8
@@ -1,31 +0,0 @@
1
- $(document).ready(function() {
2
-
3
- $('.destroy_slide_style').on("click", function() {
4
- $(this).parent().remove();
5
- });
6
-
7
- // Handle adding new styles
8
- var styles_hash_index = 1;
9
- $('.add_slide_style').click(function() {
10
- $('#styles_list').append(generate_html_for_hash("new_slide_styles", styles_hash_index));
11
- });
12
-
13
- // Generates html for new paperclip styles form fields
14
- generate_html_for_hash = function(hash_name, index) {
15
- var html = '<li>';
16
- html += '<label for="' + hash_name + '_' + index + '_name">';
17
- html += 'Name</label>';
18
- html += '<input id="' + hash_name + '_' + index + '_name" name="' + hash_name + '[' + index + '][name]" type="text">';
19
- html += '<label for="' + hash_name + '_' + index + '_value">';
20
- html += 'Value</label>';
21
- html += '<input id="' + hash_name + '_' + index + '_value" name="' + hash_name + '[' + index + '][value]" type="text">';
22
- html += '<a href="#" alt="Destroy" class="destroy_slide_style">&nbsp;x</a>';
23
- html += '</li>';
24
-
25
- index += 1;
26
- return html;
27
- };
28
-
29
-
30
-
31
- });
@@ -1,51 +0,0 @@
1
- module Spree
2
- module Admin
3
- class SlideSettingsController < Spree::Admin::BaseController
4
- def show
5
- styles = ActiveSupport::JSON.decode(Spree::Config[:slide_styles])
6
- @styles_list = styles.collect { |k, v| k }.join(", ")
7
- end
8
-
9
- def edit
10
- @styles = ActiveSupport::JSON.decode(Spree::Config[:slide_styles])
11
- @headers = ActiveSupport::JSON.decode(Spree::Config[:s3_headers])
12
- end
13
-
14
- def update
15
- update_styles(params)
16
-
17
- Spree::Config.set(params[:preferences])
18
- update_paperclip_settings
19
-
20
- respond_to do |format|
21
- format.html {
22
- flash[:notice] = t(:slide_settings_updated)
23
- redirect_to admin_slide_settings_path
24
- }
25
- end
26
- end
27
-
28
-
29
- private
30
-
31
- def update_styles(params)
32
- params[:new_slide_styles].each do |index, style|
33
- params[:slide_styles][style[:name]] = style[:value] unless style[:value].empty?
34
- end if params[:new_slide_styles].present?
35
-
36
- styles = params[:slide_styles]
37
-
38
- Spree::Config[:slide_styles] = ActiveSupport::JSON.encode(styles) unless styles.nil?
39
- end
40
-
41
- def update_paperclip_settings
42
-
43
- Spree::Slide.attachment_definitions[:attachment][:styles] = ActiveSupport::JSON.decode(Spree::Config[:slide_styles])
44
- Spree::Slide.attachment_definitions[:attachment][:path] = Spree::Config[:slide_path]
45
- Spree::Slide.attachment_definitions[:attachment][:default_url] = Spree::Config[:slide_default_url]
46
- Spree::Slide.attachment_definitions[:attachment][:default_style] = Spree::Config[:slide_default_style]
47
- end
48
- end
49
- end
50
- end
51
-
@@ -1,8 +0,0 @@
1
- Spree::AppConfiguration.class_eval do
2
- # Preferences related to slide settings
3
- preference :slide_default_url, :string, :default => '/spree/slides/:id/:style/:basename.:extension'
4
- preference :slide_path, :string, :default => ':rails_root/public/spree/slides/:id/:style/:basename.:extension'
5
- preference :slide_url, :string, :default => '/spree/slides/:id/:style/:basename.:extension'
6
- preference :slide_styles, :string, :default => "{\"mini\":\"100x33#\",\"small\":\"300x100#\",\"medium\":\"600x200#\",\"large\":\"900x300#\"}"
7
- preference :slide_default_style, :string, :default => 'medium'
8
- end
@@ -1,4 +0,0 @@
1
- <tr>
2
- <td><%= link_to t(:slide_settings), admin_slide_settings_path %></td>
3
- <td><%= t(:slide_settings_description) %></td>
4
- </tr>
@@ -1,48 +0,0 @@
1
- <%= render :partial => 'spree/admin/shared/configuration_menu' %>
2
-
3
- <h1><%= t(:slide_settings) %></h1>
4
-
5
- <p><span class="warning"><%= t(:slide_settings_warning) %></span></p>
6
-
7
- <%= form_tag admin_slide_settings_path, :method => :put do %>
8
-
9
- <p data-hook="slide_path">
10
- <label>
11
- <%= label_tag 'preferences[slide_path]', t(:slide_path) %>
12
- <%= preference_field_tag 'preferences[slide_path]', Spree::Config[:slide_path], :type => :string %>
13
- </label>
14
- </p>
15
-
16
- <p data-hook="slide_default_url">
17
- <label>
18
- <%= label_tag 'preferences[slide_default_url]', t(:slide_default_url) %>
19
- <%= preference_field_tag 'preferences[slide_default_url]', Spree::Config[:slide_default_url], :type => :string %>
20
- </label>
21
- </p>
22
-
23
- <p data-hook="slide_default_style">
24
- <label>
25
- <%= label_tag 'preferences[slide_default_style]', t(:slide_default_style) %>
26
- <%= collection_select 'preferences', 'slide_default_style', @styles, :first, :first, {:selected => Spree::Config[:slide_default_style] } %>
27
- </label>
28
- </p>
29
-
30
- <div id="slide_styles" data-hook="slide_styles">
31
- <h2><%= t(:slide_styles) %></h2>
32
- <ul id="styles_list">
33
- <% @styles.each do |style_name, style_value| %>
34
- <li>
35
- <%= label_tag "slide_styles[#{style_name}]", style_name %>
36
- <%= text_field_tag "slide_styles[#{style_name}]", style_value %>
37
- <a href="#" alt="Destroy" class="destroy_slide_style">x</a>
38
- </li>
39
- <% end %>
40
- </ul>
41
- <p><a href="#" alt="Add Style" class="add_slide_style"><%= t(:add_new_style) %></a></p>
42
- </div>
43
-
44
- <p class="form-buttons" data-hook="buttons">
45
- <%= button t(:update) %>
46
- </p>
47
-
48
- <% end %>
@@ -1,10 +0,0 @@
1
- <%= render :partial => 'spree/admin/shared/configuration_menu' %>
2
-
3
- <h1><%= t(:slide_settings) %></h1>
4
-
5
- <h4><%= t(:slide_path) %>: <%= Spree::Config[:slide_path] %></h4>
6
- <h4><%= t(:slide_default_url) %>: <%= Spree::Config[:slide_default_url] %></h4>
7
- <h4><%= t(:slide_default_style) %>: <%= Spree::Config[:slide_default_style] %></h4>
8
- <h4><%= t(:defined_paperclip_styles) %>: <%= @styles_list %></h4>
9
-
10
- <%= link_to_with_icon 'edit', t(:edit), edit_admin_slide_settings_path, :id => 'admin_slide_settings_link' %>
@@ -1,2 +0,0 @@
1
- $("#new_slideshow").html('<%= escape_javascript(render :template => "spree/admin/slideshow_types/new", :formats => [:html], :handlers => [:erb]) %>');
2
- $("#admin_new_slideshow").parent().hide();
@@ -1,5 +0,0 @@
1
- class AddEnablePagination < ActiveRecord::Migration
2
- def change
3
- add_column :spree_slideshow_types, :enable_pagination, :boolean, :default => false, :after => :enable_navigation
4
- end
5
- end
@@ -1,8 +0,0 @@
1
- class AddEnableToSlide < ActiveRecord::Migration
2
- def change
3
- add_column :spree_slides, :enable, :boolean, :default => true, :after => :content
4
- remove_column :spree_slideshow_types, :slide_number
5
- remove_column :spree_slideshow_types, :slide_width
6
- remove_column :spree_slideshow_types, :slide_height
7
- end
8
- end