solidus_slider 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +1 -0
  5. data/Gemfile +26 -0
  6. data/LICENSE +26 -0
  7. data/README.md +61 -0
  8. data/README.textile +71 -0
  9. data/Rakefile +21 -0
  10. data/Versionfile +5 -0
  11. data/app/assets/javascripts/spree/backend/slide_location_picker.js +53 -0
  12. data/app/assets/javascripts/spree/backend/solidus_slider.js +1 -0
  13. data/app/controllers/spree/admin/slide_locations_controller.rb +19 -0
  14. data/app/controllers/spree/admin/slides_controller.rb +57 -0
  15. data/app/models/spree/product_decorator.rb +8 -0
  16. data/app/models/spree/slide.rb +49 -0
  17. data/app/models/spree/slide_location.rb +8 -0
  18. data/app/models/spree/slide_slide_location.rb +8 -0
  19. data/app/overrides/spree/admin/configurations/index/add_slides_to_admin_configurations_menu.html.erb.deface +11 -0
  20. data/app/overrides/spree/admin/shared/_configuration_menu/add_slide_locations_to_admin_configurations_sidebar_menu.html.erb.deface +3 -0
  21. data/app/overrides/spree/admin/shared/_configuration_menu/add_slides_to_admin_configurations_sidebar_menu.html.erb.deface +3 -0
  22. data/app/overrides/spree/home/index/add_slider.html.erb.deface +5 -0
  23. data/app/overrides/spree/shared/_header/add_slider.html.erb.deface +3 -0
  24. data/app/views/spree/admin/slide_locations/_form.html.erb +10 -0
  25. data/app/views/spree/admin/slide_locations/edit.html.erb +18 -0
  26. data/app/views/spree/admin/slide_locations/index.html.erb +40 -0
  27. data/app/views/spree/admin/slide_locations/new.html.erb +16 -0
  28. data/app/views/spree/admin/slide_locations/search.json.jbuilder +4 -0
  29. data/app/views/spree/admin/slides/_form.html.erb +70 -0
  30. data/app/views/spree/admin/slides/edit.html.erb +23 -0
  31. data/app/views/spree/admin/slides/index.html.erb +50 -0
  32. data/app/views/spree/admin/slides/new.html.erb +18 -0
  33. data/app/views/spree/admin/slides/show.html.erb +54 -0
  34. data/app/views/spree/shared/_slider.html.erb +19 -0
  35. data/bin/rails +7 -0
  36. data/config/locales/de.yml +27 -0
  37. data/config/locales/en.yml +28 -0
  38. data/config/locales/es-MX.yml +33 -0
  39. data/config/locales/es.yml +27 -0
  40. data/config/locales/nl-NL.yml +27 -0
  41. data/config/locales/nl.yml +27 -0
  42. data/config/locales/pl.yml +29 -0
  43. data/config/locales/pt-BR.yml +36 -0
  44. data/config/locales/ru.yml +27 -0
  45. data/config/routes.rb +15 -0
  46. data/db/migrate/20120222184238_create_slides.rb +16 -0
  47. data/db/migrate/20120816192758_add_position_to_slides.rb +5 -0
  48. data/db/migrate/20121219124126_add_product_id_to_slides.rb +5 -0
  49. data/db/migrate/20150611113500_create_slider_location.rb +8 -0
  50. data/db/migrate/20160214061128_add_show_caption_to_slides.rb +5 -0
  51. data/db/migrate/20180113010348_create_spree_slide_slide_locations_table.rb +10 -0
  52. data/lib/generators/solidus_slider/install/install_generator.rb +24 -0
  53. data/lib/generators/solidus_slider/install_anything_generator.rb +31 -0
  54. data/lib/generators/solidus_slider/install_nivo_generator.rb +34 -0
  55. data/lib/generators/solidus_slider/install_simple_carousel_generator.rb +30 -0
  56. data/lib/generators/solidus_slider/templates/anything_slider.html.erb +23 -0
  57. data/lib/generators/solidus_slider/templates/nivo_slider.html.erb +37 -0
  58. data/lib/generators/solidus_slider/templates/simple_carousel_slider.html.erb +15 -0
  59. data/lib/solidus_slider.rb +4 -0
  60. data/lib/solidus_slider/engine.rb +22 -0
  61. data/lib/solidus_slider/version.rb +3 -0
  62. data/solidus_slider.gemspec +55 -0
  63. data/spec/spec_helper.rb +21 -0
  64. metadata +550 -0
@@ -0,0 +1,33 @@
1
+ es-MX:
2
+ activerecord:
3
+ models:
4
+ spree/slide: "Diapositiva"
5
+ spree:
6
+ next: "Siguiente"
7
+ previous: "Anterior"
8
+ name: "Nombre"
9
+ body: "Cuerpo"
10
+ link_url: "URL de enlace"
11
+ image: "Imagen"
12
+ image_file_name: "Nombre de la imagen"
13
+ published: "Publicado"
14
+ position: "Posición"
15
+ y: "Sí"
16
+ n: "No"
17
+ slider:
18
+ config_name: "Diapositivas"
19
+ config_description: "Configura las diapositivas de portada"
20
+ title: "Diapositivas"
21
+ new_slide: "Nueva Diapositiva"
22
+ back_to_slides: "Regresar a Diapositivas"
23
+ editing_slide: "Editando Diapositiva"
24
+ placeholder_name: "En blanco para usar el del producto"
25
+ placeholder_link_url: "En blanco para usar la del producto"
26
+ image_tip: "Si no selecciona ninguna imagen, se tomará la primera del producto"
27
+ slider_locations:
28
+ config_name: 'Locación de Diapositivas'
29
+ config_description: 'Configura las locaciones de las diapositivas'
30
+ title: 'Locación de Diapositivas'
31
+ new_location: 'Nueva Locación'
32
+ back_to_locations: 'Regresar a Locaciones'
33
+ editing_location: 'Editar Locación'
@@ -0,0 +1,27 @@
1
+ es:
2
+ activerecord:
3
+ models:
4
+ spree/slide: "Diapositiva"
5
+
6
+ spree:
7
+ next: "Siguiente"
8
+ previous: "Anterior"
9
+ name: "Nombre"
10
+ body: "Cuerpo"
11
+ link_url: "URL de enlace"
12
+ image: "Imagen"
13
+ image_file_name: "Nombre de la imagen"
14
+ published: "Publicado"
15
+ position: "Posición"
16
+ y: "Sí"
17
+ n: "No"
18
+
19
+ slider:
20
+ config_name: "Diapositivas"
21
+ config_description: "Configura las diapositivas de portada"
22
+ title: "Diapositivas"
23
+ new_slide: "Nueva Diapositiva"
24
+ editing_slide: "Editando Diapositiva"
25
+ placeholder_name: "En blanco para usar el del producto"
26
+ placeholder_link_url: "En blanco para usar la del producto"
27
+ image_tip: "Si no selecciona ninguna imagen, se tomará la primera del producto"
@@ -0,0 +1,27 @@
1
+ nl-NL:
2
+ activerecord:
3
+ models:
4
+ spree/slide: "Slide"
5
+
6
+ spree:
7
+ next: "Volgende"
8
+ previous: "Vorige"
9
+ name: "Naam"
10
+ body: "Lichaam"
11
+ link_url: "Link URL"
12
+ image: "Beeld"
13
+ image_file_name: "Bestandsnaam"
14
+ published: "Gepubliceerd"
15
+ position: "Positie"
16
+ y: "Ja"
17
+ n: "Geen"
18
+
19
+ slider:
20
+ config_name: "Spree Slider"
21
+ config_description: "Beheer Spree Slider inhoud"
22
+ title: "Slides"
23
+ new_slide: "Nieuwe Slide"
24
+ editing_slide: "Bewerken Van Slide"
25
+ placeholder_name: "Laat leeg om product naam te gebruiken"
26
+ placeholder_link_url: "Laat leeg om product url gebruiken"
27
+ image_tip: "Default eerste product afbeelding"
@@ -0,0 +1,27 @@
1
+ nl:
2
+ activerecord:
3
+ models:
4
+ spree/slide: "Slide"
5
+
6
+ spree:
7
+ next: "Volgende"
8
+ previous: "Vorige"
9
+ name: "Naam"
10
+ body: "Lichaam"
11
+ link_url: "Link URL"
12
+ image: "Beeld"
13
+ image_file_name: "Bestandsnaam"
14
+ published: "Gepubliceerd"
15
+ position: "Positie"
16
+ y: "Ja"
17
+ n: "Geen"
18
+
19
+ slider:
20
+ config_name: "Spree Slider"
21
+ config_description: "Beheer Spree Slider inhoud"
22
+ title: "Slides"
23
+ new_slide: "Nieuwe Slide"
24
+ editing_slide: "Bewerken Van Slide"
25
+ placeholder_name: "Laat leeg om product naam te gebruiken"
26
+ placeholder_link_url: "Laat leeg om product url gebruiken"
27
+ image_tip: "Default eerste product afbeelding"
@@ -0,0 +1,29 @@
1
+ pl:
2
+ activerecord:
3
+ models:
4
+ spree/slide: "Slajd"
5
+
6
+ spree:
7
+ next: "Następne"
8
+ previous: "Poprzednie"
9
+ name: "Nazwa"
10
+ body: "Treść"
11
+ link_url: "Adres URL"
12
+ image: "Zdjęcie"
13
+ image_file_name: "Nazwa pliku ze zdjęciem"
14
+ published: "Opublikowany"
15
+ position: "Pozycja"
16
+ slides: "Slajdy"
17
+ product: "Produkt"
18
+ y: "Tak"
19
+ n: "Nie"
20
+
21
+ slider:
22
+ config_name: "Spree Slider"
23
+ config_description: "Zarządzaj zawartości Spree Slidera"
24
+ title: "Slajdy"
25
+ new_slide: "Nowy slajd"
26
+ editing_slide: "Edycja slajdu"
27
+ placeholder_name: "Pozostaw puste aby użyć nazwy produktu"
28
+ placeholder_link_url: "Pozostaw puste aby użyć odnośnika do produktu"
29
+ image_tip: "Domyślnie pierwsze zdjęcie produktu"
@@ -0,0 +1,36 @@
1
+ pt-BR:
2
+ next: "Próximo"
3
+ previous: "Anterior"
4
+ name: "Nome"
5
+ body: "Corpo"
6
+ link_url: "URL"
7
+ image: "Imagem"
8
+ preview: "Visualizar"
9
+ image_file_name: "Nome da Imagem"
10
+ published: "Publicado"
11
+ position: "Posição"
12
+ y: "Sim"
13
+ n: "Não"
14
+
15
+ activerecord:
16
+ models:
17
+ spree/slide: "Slide"
18
+
19
+ solidus_slider:
20
+ config_name: "Solidus Slider"
21
+ config_description: "Configurações Solidus Slider"
22
+ title: "Slides"
23
+ new_slide: "Novo Slide"
24
+ editing_slide: "Editando Slide"
25
+ back_to_slides: "Voltar para Slides"
26
+ placeholder_name: "Deixe em branco para usar o nome do produto"
27
+ placeholder_link_url: "Deixe em branco para usar a url do produto"
28
+ image_tip: "Padrão é a primeira imagem do produto"
29
+
30
+ solidus_slider_locations:
31
+ config_name: "Locais do Solidus Slider"
32
+ config_description: "Configurações de Locais do Solidus Slider"
33
+ title: "Locais do Slider"
34
+ new_location: "Novo Local"
35
+ editing_location: "Editando Local"
36
+ back_to_locations: "Voltar para Locais"
@@ -0,0 +1,27 @@
1
+ ru:
2
+ next: "Следующий"
3
+ previous: "Предыдущий"
4
+ name: "Название"
5
+ body: "Содержимое"
6
+ link_url: "URL для ссылки"
7
+ image: "Изображение"
8
+ image_file_name: "Имя файла изображения"
9
+ published: "Опубликован"
10
+ position: "Позиция"
11
+ y: "Да"
12
+ n: "Нет"
13
+
14
+ activerecord:
15
+ models:
16
+ spree/slide: "Слайд"
17
+
18
+ solidus_slider:
19
+ config_name: "Слайды"
20
+ config_description: "Работа со слайдами"
21
+ title: "Слайды"
22
+ new_slide: "Новый Слайд"
23
+ editing_slide: "Редактирование Слайда"
24
+ back_to_slides: "Назад к Слайдам"
25
+ placeholder_name: "Оставьте пустым, чтобы использовать название выбранного продукта"
26
+ placeholder_link_url: "Оставьте пустым, чтобы использовать url продукта"
27
+ image_tip: "Изображение продукта"
data/config/routes.rb ADDED
@@ -0,0 +1,15 @@
1
+ Spree::Core::Engine.routes.draw do
2
+ namespace :admin do
3
+ resources :slides do
4
+ collection do
5
+ post :update_positions
6
+ end
7
+ end
8
+
9
+ resources :slide_locations do
10
+ collection do
11
+ get :search
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ class CreateSlides < SolidusSupport::Migration[4.2]
2
+ def change
3
+ create_table :spree_slides do |t|
4
+ t.string :name
5
+ t.text :body
6
+ t.string :link_url
7
+ t.boolean :published
8
+ t.string :image_file_name
9
+ t.string :image_content_type
10
+ t.integer :image_file_size
11
+ t.datetime :image_updated_at
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ class AddPositionToSlides < SolidusSupport::Migration[4.2]
2
+ def change
3
+ add_column :spree_slides, :position, :integer, null: false, default: 0
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddProductIdToSlides < SolidusSupport::Migration[4.2]
2
+ def change
3
+ add_column :spree_slides, :product_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class CreateSliderLocation < SolidusSupport::Migration[4.2]
2
+ def change
3
+ create_table :spree_slide_locations do |t|
4
+ t.string :name
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddShowCaptionToSlides < SolidusSupport::Migration[4.2]
2
+ def change
3
+ add_column :spree_slides, :show_caption, :boolean
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateSpreeSlideSlideLocationsTable < ActiveRecord::Migration[4.2]
2
+ def change
3
+ create_table :spree_slide_slide_locations do |t|
4
+ t.integer :slide_id
5
+ t.integer :slide_location_id
6
+ end
7
+
8
+ add_index :spree_slide_slide_locations, [:slide_id, :slide_location_id]
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ module SolidusSlider
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ class_option :auto_run_migrations, type: :boolean, default: false
5
+
6
+ def add_javascripts
7
+ append_file 'vendor/assets/javascripts/spree/backend/all.js', "\n//= require spree/backend/solidus_slider\n"
8
+ end
9
+
10
+ def add_migrations
11
+ run 'bundle exec rake railties:install:migrations FROM=solidus_slider'
12
+ end
13
+
14
+ def run_migrations
15
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
16
+ if run_migrations
17
+ run 'bundle exec rake db:migrate'
18
+ else
19
+ puts 'Skipping rake db:migrate, don\'t forget to run it!'
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,31 @@
1
+ module SolidusSlider
2
+ class InstallAnythingGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../templates", __FILE__)
4
+
5
+ def install
6
+ #copy slider partial
7
+ copy_file "anything_slider.html.erb", "app/views/spree/shared/_slider.html.erb"
8
+
9
+ #add javascripts
10
+ append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require js/jquery.anythingslider\n"
11
+ append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require js/jquery.anythingslider.fx\n"
12
+ append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require js/jquery.anythingslider.video\n"
13
+
14
+ #add stylesheets
15
+ inject_into_file "vendor/assets/stylesheets/spree/frontend/all.css", " *= require css/anythingslider\n", :before => /\*\//, :verbose => true
16
+
17
+ #copy migrations
18
+ run 'bundle exec rake railties:install:migrations FROM=solidus_slider'
19
+
20
+ #run migrations
21
+ res = ask "Would you like to run the migrations now? [Y/n]"
22
+ if res == "" || res.downcase == "y"
23
+ run 'bundle exec rake db:migrate'
24
+ else
25
+ puts "Skiping rake db:migrate, don't forget to run it!"
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,34 @@
1
+ module SolidusSlider
2
+ class InstallNivoGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../templates", __FILE__)
4
+ def install
5
+ #copy slider partial
6
+ copy_file "nivo_slider.html.erb", "app/views/spree/shared/_slider.html.erb"
7
+
8
+ #add javascripts
9
+ append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require jquery.nivo.slider.pack.js\n"
10
+
11
+ #add stylesheets
12
+ inject_into_file "vendor/assets/stylesheets/spree/frontend/all.css", " *= require themes/default/default\n", :before => /\*\//, :verbose => true
13
+ inject_into_file "vendor/assets/stylesheets/spree/frontend/all.css", " *= require themes/pascal/pascal\n", :before => /\*\//, :verbose => true
14
+ inject_into_file "vendor/assets/stylesheets/spree/frontend/all.css", " *= require themes/orman/orman\n", :before => /\*\//, :verbose => true
15
+ inject_into_file "vendor/assets/stylesheets/spree/frontend/all.css", " *= require nivo-slider\n", :before => /\*\//, :verbose => true
16
+
17
+ #copy migrations
18
+ run 'bundle exec rake railties:install:migrations FROM=solidus_slider'
19
+
20
+ #run migrations
21
+ res = ask "Would you like to run the migrations now? [Y/n]"
22
+ if res == "" || res.downcase == "y"
23
+ run 'bundle exec rake db:migrate'
24
+ else
25
+ puts "Skiping rake db:migrate, don't forget to run it!"
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+
32
+
33
+
34
+
@@ -0,0 +1,30 @@
1
+ module SolidusSlider
2
+ class InstallSimpleCarouselGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../templates", __FILE__)
4
+
5
+ def install
6
+ #copy slider partial
7
+ copy_file "simple_carousel_slider.html.erb", "app/views/spree/shared/_slider.html.erb"
8
+
9
+ #add javascripts
10
+ append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require simple.carousel\n"
11
+ append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require simple.carousel.slider\n"
12
+
13
+
14
+ #copy migrations
15
+ run 'bundle exec rake railties:install:migrations FROM=solidus_slider'
16
+
17
+ #run migrations
18
+ res = ask "Would you like to run the migrations now? [Y/n]"
19
+ if res == "" || res.downcase == "y"
20
+ run 'bundle exec rake db:migrate'
21
+ else
22
+ puts "Skiping rake db:migrate, don't forget to run it!"
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+
29
+
30
+
@@ -0,0 +1,23 @@
1
+ <% if Spree::Slide.published.count > 0 %>
2
+ <!-- Define slider dimensions here -->
3
+ <style>
4
+ #slider { width: 680px; height: 317px; }
5
+ .slider-wrapper { margin:0 auto 50px auto; }
6
+ </style>
7
+
8
+ <!-- AnythingSlider initialization -->
9
+ <script>
10
+ // DOM Ready
11
+ $(function(){
12
+ $('#slider').anythingSlider();
13
+ });
14
+ </script>
15
+
16
+ <div class="slider-wrapper">
17
+ <ul id="slider">
18
+ <% Spree::Slide.published.order('position ASC').each do |s| %>
19
+ <li><%= link_to image_tag(s.slide_image.url, :title => '#' + s.slide_name.to_url), url_for(s.slide_link) %></li>
20
+ <% end %>
21
+ </ul>
22
+ </div>
23
+ <% end %>