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.
- data/README.md +3 -3
- data/app/assets/images/store/slides/bg-gallery.png +0 -0
- data/app/assets/images/store/slides/bg-text02.png +0 -0
- data/app/assets/javascripts/admin/slides/index.js +1 -1
- data/app/assets/javascripts/admin/slides/new.js +1 -1
- data/app/assets/javascripts/admin/spree_multi_slideshow.js +1 -1
- data/app/assets/javascripts/store/spree_multi_slideshow.js +211 -537
- data/app/assets/stylesheets/admin/spree_multi_slideshow.css +16 -0
- data/app/assets/stylesheets/store/carousel_slideshow.css.scss +73 -0
- data/app/assets/stylesheets/store/spree_multi_slideshow.css +3 -47
- data/app/controllers/spree/admin/slides_controller.rb +5 -3
- data/app/controllers/spree/admin/slideshow_types_controller.rb +1 -5
- data/app/controllers/spree/slides_controller.rb +5 -0
- data/app/controllers/spree/slideshow_types_controller.rb +5 -0
- data/app/helpers/spree/slides_helper.rb +4 -0
- data/app/helpers/spree/slideshow_types_helper.rb +46 -44
- data/app/models/spree/slide.rb +27 -39
- data/app/models/spree/slideshow_type.rb +10 -4
- data/app/overrides/slideshow_type_admin_tab.rb +1 -6
- data/app/views/spree/admin/shared/_slideshow_type_tabs.html.erb +6 -8
- data/app/views/spree/admin/slides/_form.html.erb +9 -22
- data/app/views/spree/admin/slides/edit.html.erb +7 -7
- data/app/views/spree/admin/slides/index.html.erb +31 -30
- data/app/views/spree/admin/slides/new.html.erb +2 -2
- data/app/views/spree/admin/slideshow_types/_form.html.erb +8 -30
- data/app/views/spree/admin/slideshow_types/edit.html.erb +7 -6
- data/app/views/spree/admin/slideshow_types/index.html.erb +29 -30
- data/app/views/spree/admin/slideshow_types/new.html.erb +5 -33
- data/config/locales/en.yml +0 -1
- data/config/locales/it.yml +0 -1
- data/config/routes.rb +0 -1
- data/db/migrate/20120116081431_create_slideshow_types.rb +4 -1
- data/db/migrate/20120116083546_create_slides.rb +1 -0
- data/lib/generators/spree_multi_slideshow/install/install_generator.rb +22 -2
- data/lib/spree_multi_slideshow.rb +2 -0
- metadata +110 -81
- data/app/assets/images/store/slides/pagination.png +0 -0
- data/app/assets/javascripts/admin/slide_settings.js +0 -31
- data/app/controllers/spree/admin/slide_settings_controller.rb +0 -51
- data/app/models/spree/app_configuration_decorator.rb +0 -8
- data/app/views/spree/admin/shared/_slide_setting_configurations_menu.html.erb +0 -4
- data/app/views/spree/admin/slide_settings/edit.html.erb +0 -48
- data/app/views/spree/admin/slide_settings/show.html.erb +0 -10
- data/app/views/spree/admin/slideshow_types/new.js.erb +0 -2
- data/db/migrate/20130114150224_add_enable_pagination.rb +0 -5
- data/db/migrate/20130226082756_add_enable_to_slide.rb +0 -8
Binary file
|
@@ -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"> 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,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,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
|