spree_multi_slideshow 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/README.md +14 -12
  2. data/app/assets/images/store/bx_loader.gif +0 -0
  3. data/app/assets/images/store/controls.png +0 -0
  4. data/app/assets/javascripts/admin/slide_settings.js.erb +41 -0
  5. data/app/assets/javascripts/admin/slides/index.js.coffee +15 -0
  6. data/app/assets/javascripts/admin/slides/new.js.coffee +7 -0
  7. data/app/assets/javascripts/admin/spree_multi_slideshow.js +3 -1
  8. data/app/assets/javascripts/store/spree_multi_slideshow.js +1284 -1
  9. data/app/assets/stylesheets/store/spree_multi_slideshow.css +197 -3
  10. data/app/controllers/spree/admin/slide_settings_controller.rb +50 -0
  11. data/app/controllers/spree/admin/slides_controller.rb +15 -14
  12. data/app/controllers/spree/admin/slideshows_controller.rb +31 -0
  13. data/app/helpers/spree/slideshows_helper.rb +68 -0
  14. data/app/models/spree/app_configuration_decorator.rb +25 -0
  15. data/app/models/spree/product_decorator.rb +3 -0
  16. data/app/models/spree/slide.rb +23 -25
  17. data/app/models/spree/slideshow.rb +17 -0
  18. data/app/models/spree/taxon_decorator.rb +3 -0
  19. data/app/overrides/slideshow_admin_tab.rb +10 -0
  20. data/app/views/spree/admin/shared/_slideshow_sub_menu.html.erb +6 -0
  21. data/app/views/spree/admin/shared/_slideshow_tabs.html.erb +21 -0
  22. data/app/views/spree/admin/slide_settings/edit.html.erb +74 -0
  23. data/app/views/spree/admin/slides/_form.html.erb +29 -9
  24. data/app/views/spree/admin/slides/edit.html.erb +26 -16
  25. data/app/views/spree/admin/slides/index.html.erb +47 -31
  26. data/app/views/spree/admin/slides/new.html.erb +12 -9
  27. data/app/views/spree/admin/slideshows/_form.html.erb +59 -0
  28. data/app/views/spree/admin/slideshows/edit.html.erb +17 -0
  29. data/app/views/spree/admin/slideshows/index.html.erb +51 -0
  30. data/app/views/spree/admin/slideshows/new.html.erb +80 -0
  31. data/app/views/spree/admin/slideshows/new.js.erb +2 -0
  32. data/config/locales/en.yml +53 -85
  33. data/config/locales/it.yml +56 -90
  34. data/config/routes.rb +3 -1
  35. data/db/migrate/20120116081431_create_slideshows.rb +17 -0
  36. data/db/migrate/20120116083546_create_slides.rb +5 -4
  37. data/db/migrate/20120323164044_multi_slideshow_namespace.rb +1 -1
  38. data/lib/generators/spree_multi_slideshow/install/install_generator.rb +1 -21
  39. data/lib/spree_multi_slideshow.rb +0 -2
  40. metadata +26 -73
  41. data/app/assets/images/store/slides/bg-gallery.png +0 -0
  42. data/app/assets/images/store/slides/bg-text02.png +0 -0
  43. data/app/assets/images/store/slides/sprite01.png +0 -0
  44. data/app/assets/javascripts/admin/slides/index.js +0 -10
  45. data/app/assets/javascripts/admin/slides/new.js +0 -5
  46. data/app/assets/javascripts/store/fadeGallery.js +0 -229
  47. data/app/assets/stylesheets/admin/spree_multi_slideshow.css +0 -16
  48. data/app/assets/stylesheets/store/carousel_slideshow.css.scss +0 -73
  49. data/app/controllers/spree/admin/slideshow_types_controller.rb +0 -11
  50. data/app/controllers/spree/slides_controller.rb +0 -5
  51. data/app/controllers/spree/slideshow_types_controller.rb +0 -5
  52. data/app/helpers/spree/slides_helper.rb +0 -4
  53. data/app/helpers/spree/slideshow_types_helper.rb +0 -53
  54. data/app/models/spree/slideshow_type.rb +0 -18
  55. data/app/overrides/slideshow_type_admin_tab.rb +0 -4
  56. data/app/views/spree/admin/shared/_slideshow_type_tabs.html.erb +0 -16
  57. data/app/views/spree/admin/slideshow_types/_form.html.erb +0 -8
  58. data/app/views/spree/admin/slideshow_types/edit.html.erb +0 -8
  59. data/app/views/spree/admin/slideshow_types/index.html.erb +0 -32
  60. data/app/views/spree/admin/slideshow_types/new.html.erb +0 -7
  61. data/db/migrate/20120116081431_create_slideshow_types.rb +0 -15
@@ -1,16 +0,0 @@
1
- /*
2
- *= require formtastic
3
- */
4
-
5
- .formtastic input, .formtastic textarea, .formtastic select {
6
- font-size: 100%;
7
- padding: 5px;
8
- }
9
-
10
- .formtastic button {
11
- margin: 0;
12
- padding: 0 20px 0 0;
13
- }
14
- .formtastic button:hover {
15
- text-shadow: #FFFFFF -1px -1px 0px;
16
- }
@@ -1,73 +0,0 @@
1
- .left {
2
- float: left !important;
3
- }
4
- .right {
5
- float: right !important;
6
- }
7
- .gallery {
8
- position: relative;
9
- overflow: hidden;
10
- z-index:0;
11
- color:#fff;
12
- margin:auto;
13
- }
14
- .gallery .gallery-inner {
15
- position:relative;
16
- }
17
- .gallery .gallery-inner ul {
18
- position:absolute;
19
- margin:0;
20
- padding:0;
21
- list-style:none;
22
- }
23
- .gallery .gallery-inner li {
24
- position:absolute;
25
- top:0;
26
- left:0;
27
- background: transparent;
28
- }
29
- .gallery .gallery-inner li.active {z-index:2;}
30
- .gallery img {
31
- display:block;
32
- }
33
- .gallery .text-holder {
34
- position: absolute;
35
- text-align:center;
36
- }
37
- .gallery-control {
38
- font-size: 60px;
39
- font-weight: 100;
40
- line-height: 27px;
41
- color: white;
42
- text-align: center;
43
- width: 40px;
44
- height: 40px;
45
- }
46
- a.gallery-control:hover {
47
- text-decoration: none;
48
- color: white;
49
- }
50
- .carousel-control {
51
- position: absolute;
52
- top: 40%;
53
- left: 15px;
54
- width: 40px;
55
- height: 40px;
56
- margin-top: -20px;
57
- font-size: 60px;
58
- font-weight: 100;
59
- line-height: 30px;
60
- color: white;
61
- text-align: center;
62
- background: #222;
63
- border: 3px solid white;
64
- -webkit-border-radius: 23px;
65
- -moz-border-radius: 23px;
66
- border-radius: 23px;
67
- opacity: 0.5;
68
- filter: alpha(opacity=50);
69
- }
70
- .carousel-control.right {
71
- left: auto;
72
- right: 15px;
73
- }
@@ -1,11 +0,0 @@
1
- module Spree
2
- module Admin
3
- class SlideshowTypesController < ResourceController
4
-
5
- def location_after_save
6
- edit_admin_slideshow_type_url(@slideshow_type)
7
- end
8
-
9
- end
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- module Spree
2
- class SlidesController < BaseController
3
-
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module Spree
2
- class SlideshowTypesController < BaseController
3
-
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- module Spree
2
- module SlidesHelper
3
- end
4
- end
@@ -1,53 +0,0 @@
1
- # encoding: UTF-8
2
- module Spree
3
- module SlideshowTypesHelper
4
-
5
- def insert_slideshow(params={})
6
- if slide_images(params)
7
- navigation = enable_navigation(params)
8
- content_tag(:div, navigation[:prev] + content_tag(:div, content_tag(:ul, raw(slide_images(params))), :class => "gallery-inner clearfix") + navigation[:succ], :class => "gallery #{params[:class]}", :style => "width: #{Spree::SlideshowType.enable(params[:category] || "home").first.slide_width}px; height: #{Spree::SlideshowType.enable(params[:category] || "home").first.slide_height}px;")
9
- end
10
- end
11
-
12
- def slide_images(params)
13
- category = params[:category] || "home"
14
- style = params[:style] || "custom"
15
- slideshow = Spree::SlideshowType.enable(category)
16
- if !slideshow.blank?
17
- max = slideshow.first.slide_number || 4
18
- slides = Spree::Slide.where("slideshow_type_id = ?", slideshow.first.id).limit(max).sort_by { |slide| slide.position }
19
-
20
- slides.map do |slide|
21
- if params[:enable_content]
22
- link_content = content_tag(:div, content_tag(:strong, raw(slide.title)) + content_tag(:p, raw(slide.content)), :class => "text-holder")
23
- else
24
- link_content = ""
25
- end
26
- content_tag(:li, raw(link_to(image_tag(slide.attachment.url(style.to_sym)), slide.url, { :title => slide.title })) + raw(link_content))
27
- end.join
28
- else
29
- false
30
- end
31
- end
32
-
33
- def enable_navigation(params)
34
- category = params[:category] || "home"
35
- slideshow = Spree::SlideshowType.enable(category)
36
- if !slideshow.blank?
37
- if slideshow.first.enable_navigation
38
- prev = link_to("‹", "#", :class => "gallery-control left")
39
- succ = link_to("›", "#", :class => "gallery-control right")
40
- else
41
- prev = ""
42
- succ = ""
43
- end
44
-
45
- res = Hash.new()
46
- res[:prev] = content_tag(:div, prev, :class => "carousel-control left")
47
- res[:succ] = content_tag(:div, succ, :class => "carousel-control right")
48
- return res
49
- end
50
- end
51
-
52
- end
53
- end
@@ -1,18 +0,0 @@
1
- module Spree
2
- class SlideshowType < ActiveRecord::Base
3
- has_many :slides
4
-
5
- attr_accessible :category, :slide_width, :slide_height, :slide_number, :enable_navigation, :enabled
6
-
7
- validates :slide_number, :slide_width, :slide_height, :presence => true
8
- validates_uniqueness_of :category
9
- validates_numericality_of :slide_number, :only_integer => true
10
-
11
- scope :enable, lambda { |category| {:conditions => {:enabled => true, :category => category}} }
12
-
13
- def initialize(*args)
14
- super(*args)
15
- end
16
-
17
- end
18
- end
@@ -1,4 +0,0 @@
1
- Deface::Override.new(:virtual_path => "spree/layouts/admin",
2
- :name => "slideshow_type_admin_tab",
3
- :insert_bottom => "[data-hook='admin_tabs']",
4
- :text => "<%= tab(:slideshow_types) %>")
@@ -1,16 +0,0 @@
1
- <% content_for :sidebar do %>
2
-
3
- <h3><%= t("slideshow_type.sidebar") %></h3>
4
- <br class="clear" />
5
-
6
- <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) %>
9
- </li>
10
- <li<%== ' class="active"' if current == 'Slide Image' %>>
11
- <%= link_to t("slideshow_type.slide.many"), admin_slideshow_type_slides_path(@slideshow_type) %>
12
- </li>
13
- </ul>
14
- <br class="clear" />
15
-
16
- <% end %>
@@ -1,8 +0,0 @@
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,8 +0,0 @@
1
- <h1><%= t("slideshow_type.editing_page") %></h1>
2
- <%= render :partial => 'spree/admin/shared/slideshow_type_tabs', :locals => {:current => 'Slideshow_type Details'} %>
3
- <%= render "spree/shared/error_messages", :target => @slideshow_type %>
4
-
5
- <%= semantic_form_for([:admin, @slideshow_type]) do |f| %>
6
- <%= render :partial => "form", :locals => { :f => f } %>
7
- <%= render :partial => 'spree/admin/shared/edit_resource_links' %>
8
- <% end %>
@@ -1,32 +0,0 @@
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' />
8
- </div>
9
-
10
- <h1><%= t("slideshow_type.many") %></h1>
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>
@@ -1,7 +0,0 @@
1
- <h1><%= t("slideshow_type.new_page") %></h1>
2
- <%= render "spree/shared/error_messages", :target => @slideshow_type %>
3
-
4
- <%= semantic_form_for([:admin, @slideshow_type], :html => { :enctype => "multipart/form-data" }) do |f| %>
5
- <%= render :partial => "form", :locals => { :f => f } %>
6
- <%= render :partial => 'spree/admin/shared/new_resource_links' %>
7
- <% end %>
@@ -1,15 +0,0 @@
1
- class CreateSlideshowTypes < ActiveRecord::Migration
2
- def change
3
- create_table :slideshow_types do |t|
4
- t.string :category
5
- t.boolean :enabled, :default => false
6
- t.integer :slide_height, :default => 400
7
- t.integer :slide_width, :default => 900
8
- t.integer :slide_number, :default => 4
9
- t.boolean :enable_navigation, :default => true
10
-
11
- t.timestamps
12
- end
13
- add_index :slideshow_types, :category, :unique => true
14
- end
15
- end