Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed minor bug and update for new gem

  • Loading branch information...
commit 8e69ab1172279d0f1afd5f310b49c5e2f6618530 1 parent e64aa35
@damianogiacomello authored
View
13 README.md
@@ -9,7 +9,7 @@ Basic Installation
1. Add the following to your Gemfile
<pre>
- gem 'spree_multi_slideshow', '~> 1.2.2'
+ gem 'spree_multi_slideshow', '~> 1.3.0'
</pre>
2. Run `bundle install`
3. To copy and apply migrations run:
@@ -22,22 +22,21 @@ Example
1. add slideshow helper method in your view:
<pre>
- <%= insert_slideshow() %>
+ <%= insert_slideshow(:category => "my_category") %>
</pre>
add slides for the slideshow in the admin section
2. Additional options:
<pre>
{
- :id => "slideshow"
- :class => "first_slideshow"
- :category => "my_category"
- :style => "custom"
+ :id => "my_id"
+ :class => "my_class"
+ :style => "my_style"
:auto => true|false
:next_text => ">>"
:prev_text => "<<"
:next_selector => "bx-next"
:prev_selector => "bx-prev"
- :pagination_class => "pagination"
+ :pagination_class => "my_pagination"
:show_content => true|false
}
</pre>
View
4 app/assets/javascripts/admin/slide_settings.js.erb
@@ -12,9 +12,9 @@ $(document).ready(function() {
// Handle adding new styles
var styles_hash_index = 1;
- $('.add_new_style').live("click", function(e) {
+ $('.add_new_slide_style').live("click", function(e) {
e.preventDefault();
- $('#new-styles').append(generate_html_for_hash("new_slide_styles", styles_hash_index));
+ $('#new-slide-styles').append(generate_html_for_hash("new_slide_styles", styles_hash_index));
});
// Generates html for new paperclip styles form fields
View
10 app/assets/stylesheets/store/spree_multi_slideshow.css
@@ -49,7 +49,7 @@
.bx-wrapper .bx-loading {
min-height: 50px;
- background: url(store/bx_loader.gif) center center no-repeat #fff;
+ background: url(/assets/store/bx_loader.gif) center center no-repeat #fff;
height: 100%;
width: 100%;
position: absolute;
@@ -98,12 +98,12 @@
.bx-wrapper .bx-prev {
left: 10px;
- background: url(store/controls.png) no-repeat 0 -32px;
+ background: url(/assets/store/controls.png) no-repeat 0 -32px;
}
.bx-wrapper .bx-next {
right: 10px;
- background: url(store/controls.png) no-repeat -43px -32px;
+ background: url(/assets/store/controls.png) no-repeat -43px -32px;
}
.bx-wrapper .bx-prev:hover {
@@ -141,7 +141,7 @@
width: 10px;
height: 11px;
outline: 0;
- background: url(store/controls.png) -86px -11px no-repeat;
+ background: url(/assets/store/controls.png) -86px -11px no-repeat;
margin: 0 3px;
}
@@ -156,7 +156,7 @@
width: 9px;
height: 11px;
outline: 0;
- background: url(store/controls.png) -86px -44px no-repeat;
+ background: url(/assets/store/controls.png) -86px -44px no-repeat;
margin: 0 3px;
}
View
2  app/controllers/spree/admin/slide_settings_controller.rb
@@ -7,7 +7,7 @@ def show
end
def edit
- @styles = ActiveSupport::JSON.decode(Spree::Config[:attachment_styles])
+ @styles = ActiveSupport::JSON.decode(Spree::Config[:slide_styles])
end
def update
View
17 app/helpers/spree/slideshows_helper.rb
@@ -11,20 +11,21 @@ def insert_slideshow(params={})
params[:prev_text] ||= '<<'
params[:next_selector] ||= 'bx-next'
params[:prev_selector] ||= 'bx-prev'
- @@slideshow = Spree::Slideshow.enable.find_by_category(params[:category])
- if @@slideshow.blank? || (!@@slideshow.blank? && @@slideshow.slides.empty?)
+ @@slideshow = Spree::Slideshow.enable(params[:category]).try(:first)
+ if @@slideshow.blank? || (!@@slideshow.blank? && @@slideshow.slides.enable.empty?)
return ''
end
- params[:pagination_class] ||= "pagination"
+ params[:pagination_class] ||= ""
res = []
- res << content_tag(:div, content_tag(:div, slide_images(params, @@slideshow), :class => "slides_container"), :id => params[:id], :class => params[:class])
+ res << content_tag(:ul, slide_images(params, @@slideshow), :class => "bxslider #{params[:class]}", :id => params[:id])
res << "<script type='text/javascript'>
$(function() {
$('##{params[:id]}').bxSlider({
auto: #{params[:auto]},
+ adaptiveHeight: true,
autoStart: #{@@slideshow.auto_start},
- mode: #{@@slideshow.mode},
+ mode: '#{@@slideshow.mode}',
controls: #{@@slideshow.enable_navigation},
nextText: '#{params[:next_text]}',
nextSelector: '#{params[:next_selector]}',
@@ -35,6 +36,7 @@ def insert_slideshow(params={})
infiniteLoop: #{@@slideshow.infinite_loop},
hideControlOnEnd: #{@@slideshow.hide_control_on_end},
autoHover: true,
+ useCSS: true,
pagerSelector: '#{params[:pagination_class]}'
});
});
@@ -46,11 +48,10 @@ def insert_slideshow(params={})
def slide_images(params, slideshow)
params[:style] ||= "medium"
params[:show_content] ||= false
- max = slideshow.slides.enable.count
- slides = slideshow.slides.enable.limit(max).sort_by { |slide| slide.position }
+ slides = slideshow.slides.enable.sort_by { |slide| slide.position }
slides.map do |slide|
- content_tag(:div, :class => "slide_list") do
+ content_tag(:li, :class => "slides") do
divs = []
divs << link_to(image_tag(slide.attachment.url(params[:style].to_sym)), (slide.url.blank? ? "javascript: void(0)" : slide.url), { :title => slide.title })
View
4 app/models/spree/slideshow.rb
@@ -2,7 +2,7 @@ module Spree
class Slideshow < ActiveRecord::Base
has_many :slides
- attr_accessible :category, :enable_navigation, :enabled, :mode, :auto_start, :infinite_loop,
+ attr_accessible :category, :enable_navigation, :enable_pagination, :enabled, :mode, :auto_start, :infinite_loop,
:hide_control_on_end
validates :category, :presence => true
@@ -11,7 +11,7 @@ class Slideshow < ActiveRecord::Base
scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
def mode_enum
- [["Orizzontale", "horizontal"], ["Dissolvenza", "fade"], ["Verticale", "vertical"]]
+ [[I18n.t(:horizontal), "horizontal"], [I18n.t(:fade), "fade"], [I18n.t(:vertical), "vertical"]]
end
end
end
View
4 app/views/spree/admin/slide_settings/edit.html.erb
@@ -59,10 +59,10 @@
<% end %>
</div>
- <div id="new-styles" class="row frameless"></div>
+ <div id="new-slide-styles" class="row frameless"></div>
<div class="field">
- <%= link_to_with_icon 'icon-plus', t(:add_new_style), '#', :class => 'add_new_style button' %>
+ <%= link_to_with_icon 'icon-plus', t(:add_new_slide_style), '#', :class => 'add_new_slide_style button' %>
</div>
</fieldset>
View
2  app/views/spree/admin/slides/index.html.erb
@@ -24,6 +24,7 @@
<tr data-hook="slides_header">
<th colspan="2"><%= t(:thumbnail) %></th>
<th><%= t(:alt_text) %></th>
+ <th><%= t(:enabled) %></th>
<th class="actions"></th>
</tr>
</thead>
@@ -38,6 +39,7 @@
<%= link_to image_tag(slide.attachment.url(:mini)), slide.attachment.url(:large) %>
</td>
<td><%= slide.presentation %></td>
+ <td align="center"><%= icon('icon-check icon-large') if slide.enabled %></td>
<td class="actions">
<%= link_to_with_icon 'icon-edit', t(:edit), edit_admin_slideshow_slide_url(@slideshow, slide), :no_text => true, :data => {:action => 'edit'} %>
<%= link_to_delete slide, { :url => admin_slideshow_slide_url(@slideshow, slide), :no_text => true } %>
View
2  app/views/spree/admin/slideshows/_form.html.erb
@@ -27,7 +27,7 @@
<div class="right four columns omega" data-hook="admin_slideshow_form_right">
<%= f.field_container :mode do %>
<%= f.label :mode, t(:mode) %><br />
- <%= f.select(:mode, @slideshow.mode_enum, { :include_blank => 'None' }, { :class => 'select2' }) %>
+ <%= f.select(:mode, @slideshow.mode_enum, { :include_blank => false }, { :class => 'select2' }) %>
<%= f.error_message_on :mode %>
<% end %>
View
4 app/views/spree/admin/slideshows/index.html.erb
@@ -26,14 +26,14 @@
<thead>
<tr data-hook="admin_slideshows_index_headers">
<th><%= t(:category) %></th>
- <th><%= t(:enable) %></th>
+ <th><%= t(:enabled) %></th>
<th data-hook="admin_slideshows_index_header_actions" class="actions"></th>
</tr>
</thead>
<tbody>
<% @slideshows.each do |slideshow| %>
<tr id="<%= spree_dom_id slideshow %>" data-hook="admin_slideshows_index_rows" class="<%= cycle('odd', 'even') %>">
- <td><%= slideshow.category %></td>
+ <td><%= slideshow.category %> (<%= slideshow.slides.count %> <%= t(:slides) %>)</td>
<td align="center"><%= icon('icon-check icon-large') if slideshow.enabled %></td>
<td class="actions" data-hook="admin_slideshows_index_row_actions">
<%= link_to_edit slideshow, :no_text => true, :class => 'edit' %>
View
2  app/views/spree/admin/slideshows/new.html.erb
@@ -58,7 +58,7 @@
<div class="three columns">
<%= f.field_container :mode do %>
<%= f.label :mode, t(:mode) %><br />
- <%= f.select(:mode, @slideshow.mode_enum, { :include_blank => 'None' }, { :class => 'select2' }) %>
+ <%= f.select(:mode, @slideshow.mode_enum, { :include_blank => false }, { :class => 'select2' }) %>
<%= f.error_message_on :mode %>
<% end %>
</div>
View
138 config/locales/en.yml
@@ -1,95 +1,63 @@
----
en:
+ images_only: "must be JPG, JPEG, PNG o GIF"
+ slideshow_details: "Slideshow Details"
+ editing_slideshow: Edit Slideshow
+ slide_settings: Slide Setting
+ add_new_slide_style: "Add New Slide Style"
+ horizontal: "Horizontal"
+ fade: "Fade"
+ vertical: "Vertical"
+ slide_settings_warning: "You will need to regenerate thumbnails if you update the paperclip styles. Use rake paperclip:refresh:thumbnails CLASS=Spree::Slide to do this."
+ slide_settings_description: "Slide Settings Description"
+ slide_settings_updated: "Slide Settings successfully updated."
+ slide_default_style: "Slide Attachments Style"
+ slide_default_url: "Slide Attachments Default URL"
+ slide_path: "Slide Attachments Path"
+ slide_styles: "Slide Paperclip Styles"
+ slide_url: "Slide Attachments URL"
+ back_to_slides_list: "Back To Slides List"
+ back_to_slideshows_list: "Back To Slideshows List"
+ new_slideshow: "New Slideshow"
+ new_slide: "New Slide"
+ listing_slideshows: "Listing Slideshows"
+ listing_slides: "Listing Slides"
+ no_slides_found: "No Slide Found"
+ enabled: Enable?
+ slide_number: Slide number
+ slide_width: Width
+ slide_height: Height
+ enable_navigation: Navigation Enable?
+ enable_pagination: Pagination Enable?
+ mode: "Transaction type"
+ auto_start: "Auto start"
+ infinite_loop: "Infinite slide"
+ hide_control_on_end: "Hide controls on end"
+ title: Title
+ url: Link url
+ attachment: attachment
activerecord:
- errors: &errors
- format: "%{attribute} %{message}\n"
-
- messages: &errors_messages
- inclusion: "is not included in the list"
- exclusion: "is reserved"
- invalid: "is invalid"
- confirmation: "doesn't match confirmation"
- record_invalid: "Validation failed: %{errors}"
- taken: has already been taken
- accepted: "must be accepted"
- empty: "can't be empty"
- blank: "can't be blank"
- too_long:
- one: "is too long (maximum is 1 character)"
- other: "is too long (maximum is %{count} characters)"
- too_short:
- one: "is too short (minimum is 1 character)"
- other: "is too short (minimum is %{count} characters)"
- wrong_length:
- one: "is the wrong length (should be 1 character)"
- other: "is the wrong length (should be %{count} characters)"
- not_a_number: "is not a number"
- not_an_integer: "must be an integer"
- greater_than: "must be greater than %{count}"
- greater_than_or_equal_to: "must be greater than or equal to %{count}"
- equal_to: "must be equal to %{count}"
- less_than: "must be less than %{count}"
- less_than_or_equal_to: "must be less than or equal to %{count}"
- odd: "must be odd"
- even: "must be even"
-
- models:
- slideshow_type:
- attributes:
- slideshow_type:
- category: Category
- enabled: Enable?
- slide_width: Width
- slide_height: Height
- slide_number: Slide Number
- enable_navigation: Next and Prev enable?
+ models:
+ slideshow:
+ one: Slideshow
+ other: Slideshows
slide:
- attributes:
- slide:
- title: Title
- url: Link to product or taxonomy or to external website
- image: Image
+ one: Slide
+ other: Slides
attributes:
- slideshow_type:
+ slideshow:
category: Category
+ updated_at: Updated at
+ created_at: Created at
enabled: Enable?
+ slide_number: Slide number
slide_width: Width
slide_height: Height
- slide_number: Slide Number
- enable_navigation: Next and Prev enable?
+ enable_navigation: Navigation enable?
+ mode: "Transaction type"
+ auto_start: "Auto start"
+ infinite_loop: "Infinite slide"
+ hide_control_on_end: "Hide controls on end"
slide:
title: Title
- url: Link to product or taxonomy or to external website
- image: Image
- models:
- slideshow_type:
- one: Slideshow
- many: Slideshows
- slide:
- one: Slide
- many: Slides
-
- slideshow_type:
- one: Slideshow
- many: Slideshows
- enable: Enable?
- category: Category
- slide_number: Slide Number
- detail: Detail
- sidebar: Manage slideshow and slide.
- new_page: New page
- slide:
- one: Slide
- many: Slides
- new_page: New Slide
- image:
- one: Image
- many: Images
- thumbnail: Thumbnail
- title: Title
- position: Position
- content: Description
- url: Link to product or taxonomy or to external website
- editing_page: Editing slide
- editing_page: Editing slideshow
- confirm_delete: Are you sure ?
+ url: Link url
+ attachment: attachment
View
35 config/locales/it.yml
@@ -1,5 +1,40 @@
it:
images_only: "deve essere JPG, JPEG, PNG o GIF"
+ slideshow_details: "Dettagli Slideshow"
+ editing_slideshow: Modifica Slideshow
+ slide_settings: Impostazioni Slide
+ add_new_slide_style: "Aggiungi nuovo stile delle Slide"
+ horizontal: "Orizzontale"
+ fade: "Dissolvenza"
+ vertical: "Verticale"
+ slide_settings_warning: "Sarà necessario rigenerare le miniature dopo aver aggiornato gli stili di paperclip delle Slide, col comando rake paperclip:refresh:thumbnails CLASS=Spree::Slide"
+ slide_settings_description: "Descrizione Impostazioni Slide"
+ slide_settings_updated: "Impostazioni Slide aggiornate con successo."
+ slide_default_style: "Stile di Default dell'allegato delle Slide"
+ slide_default_url: "URL di Default dell'allegato delle Slide"
+ slide_path: "Percorso dell'allegato delle Slide"
+ slide_styles: "Stili di Paperclip delle Slide"
+ slide_url: "URL dell'allegato delle Slide"
+ back_to_slides_list: "Torna all'elenco Slides"
+ back_to_slideshows_list: "Torna all'elenco Slideshows"
+ new_slideshow: "Nuova Slideshow"
+ new_slide: "Nuova Slide"
+ listing_slideshows: "Elenco Slideshows"
+ listing_slides: "Elenco Slides"
+ no_slides_found: "Nessuna Slide Trovata"
+ enabled: Attiva?
+ slide_number: Numero Slide
+ slide_width: Larghezza
+ slide_height: Altezza
+ enable_navigation: Tasti navigazione attivi?
+ enable_pagination: Navigazione attiva?
+ mode: "Tipo transazione"
+ auto_start: "Start automatico"
+ infinite_loop: "Slide infinito"
+ hide_control_on_end: "Nascondi controller al termine"
+ title: Titolo
+ url: Link url
+ attachment: Immagine
activerecord:
models:
slideshow:
View
1  lib/generators/spree_multi_slideshow/install/install_generator.rb
@@ -4,6 +4,7 @@ class InstallGenerator < Rails::Generators::Base
def add_javascripts
append_file "app/assets/javascripts/store/all.js", "//= require store/spree_multi_slideshow\n"
+ append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_multi_slideshow\n"
end
def add_stylesheets
Please sign in to comment.
Something went wrong with that request. Please try again.