diff --git a/.ruby-gemset b/.ruby-gemset
new file mode 100644
index 0000000..dad7eea
--- /dev/null
+++ b/.ruby-gemset
@@ -0,0 +1 @@
+spree_slider
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 0000000..03463f3
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+ruby-3.3.0
diff --git a/Gemfile b/Gemfile
index d0ca03a..ec4ce59 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-spree_version = '~> 4.0'
+spree_version = '~> 4.10.1'
gem 'spree', spree_version
gemspec
diff --git a/README.md b/README.md
index df6023e..97f6a98 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,7 @@ If you desire to have a customized carousel template you can specify your own li
## Dynamic content management
-To add dynamic content, go to the spree admin section, under 'Configuration'
+To add dynamic content, go to the spree admin section, under 'Settings'
and find the Spree Slider & Spree Slider Locations menu.
You can create new slides and new locations. Then to fetch & render the slider for a particular location you can do the following:
diff --git a/app/controllers/spree/admin/slides_controller.rb b/app/controllers/spree/admin/slides_controller.rb
index 4a86b4c..137ec41 100644
--- a/app/controllers/spree/admin/slides_controller.rb
+++ b/app/controllers/spree/admin/slides_controller.rb
@@ -18,7 +18,7 @@ def location_after_save
end
def slide_params
- params.require(:slide).permit(:name, :body, :link_url, :published, :image, :position, :product_id)
+ params.require(:slide).permit(:name, :body, :link_url, :published, :image, :position)
end
end
end
diff --git a/app/helpers/spree/admin/slides_helper.rb b/app/helpers/spree/admin/slides_helper.rb
deleted file mode 100644
index ddd9314..0000000
--- a/app/helpers/spree/admin/slides_helper.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-module Spree
- module Admin
- module SlidesHelper
- def get_column_header_by_type(type)
- return Spree.t(:name) if type == :image
- return Spree.t(:product) if type == :product
-
- return '----'
- end
-
- def get_image_link_by_type(slide, type)
- return link_to(slide.name, object_url(slide)) if type == :image
- return link_to(slide.product.name, object_url(slide)) if type == :product && slide.product
-
- return '----'
- end
- end
- end
-end
diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb
deleted file mode 100644
index af401ec..0000000
--- a/app/models/spree/product_decorator.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Spree
- module ProductDecorator
- def self.prepended(base)
- base.has_one :slide
- base.after_destroy :destroy_slide_if_deleted
- end
-
- def destroy_slide_if_deleted
- slide.update(published: false) if slide && deleted_at
- end
- end
-end
-
-::Spree::Product.prepend(Spree::ProductDecorator)
diff --git a/app/models/spree/slide.rb b/app/models/spree/slide.rb
index 92bd691..c72b490 100644
--- a/app/models/spree/slide.rb
+++ b/app/models/spree/slide.rb
@@ -1,20 +1,15 @@
class Spree::Slide < ActiveRecord::Base
- has_and_belongs_to_many :slide_locations,
- class_name: 'Spree::SlideLocation',
- join_table: 'spree_slide_slide_locations'
-
- belongs_to :product, touch: true, optional: true
+ belongs_to :slide_location, class_name: 'Spree::SlideLocation', optional: true
has_one_attached :image
- validates :link_url, presence: true, url: true, unless: -> { product }
- validates :name, :image, presence: true, unless: -> { product }
+ validates :name, :image, presence: true
validates :image, content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif']
scope :published, -> { where(published: true).order('position ASC') }
- scope :location, ->(location) { joins(:slide_locations).where('spree_slide_locations.name = ?', location) }
- scope :product_slides, -> { published.where.not(product_id: nil).order('position ASC') }
- scope :image_slides, -> { published.where(product_id: nil).order('position ASC') }
+ scope :location, ->(location) { joins(:slide_location).where(spree_slide_locations: { name: location })}
+
+ acts_as_list
STYLES = {
preview: [120, 120],
@@ -26,16 +21,8 @@ def initialize(attrs = nil)
super
end
- def slide_name
- name.blank? && product.present? ? product.name : name
- end
-
- def slide_link
- link_url.blank? && product.present? ? product : link_url
- end
-
def slide_image
- !image.attached? && product.present? && product.images.any? ? product.images.first.attachment : image.attachment
+ image.attachment
end
# Helper for resizing
diff --git a/app/models/spree/slide_location.rb b/app/models/spree/slide_location.rb
index 41e5879..61abb4a 100644
--- a/app/models/spree/slide_location.rb
+++ b/app/models/spree/slide_location.rb
@@ -1,7 +1,5 @@
class Spree::SlideLocation < ActiveRecord::Base
- has_and_belongs_to_many :slides,
- class_name: 'Spree::Slide',
- join_table: 'spree_slide_slide_locations'
+ has_many :slides, class_name: 'Spree::Slide', dependent: :nullify
validates :name, presence: true
end
diff --git a/app/overrides/spree/admin/shared/sub_menu/_configuration/add_slide_locations_to_admin_configurations_sidebar_menu.html.erb.deface b/app/overrides/spree/admin/shared/sub_menu/_configuration/add_slide_locations_to_admin_configurations_sidebar_menu.html.erb.deface
deleted file mode 100644
index e7459d6..0000000
--- a/app/overrides/spree/admin/shared/sub_menu/_configuration/add_slide_locations_to_admin_configurations_sidebar_menu.html.erb.deface
+++ /dev/null
@@ -1,2 +0,0 @@
-
-<%= configurations_sidebar_menu_item t('spree_slider_locations.config_name'), admin_slide_locations_path %>
diff --git a/app/overrides/spree/admin/shared/sub_menu/_configuration/add_slides_to_admin_configurations_sidebar_menu.html.erb.deface b/app/overrides/spree/admin/shared/sub_menu/_configuration/add_slides_to_admin_configurations_sidebar_menu.html.erb.deface
deleted file mode 100644
index 482490d..0000000
--- a/app/overrides/spree/admin/shared/sub_menu/_configuration/add_slides_to_admin_configurations_sidebar_menu.html.erb.deface
+++ /dev/null
@@ -1,2 +0,0 @@
-
-<%= configurations_sidebar_menu_item t('spree_slider.config_name'), admin_slides_path %>
diff --git a/app/overrides/spree/home/index/add_slider.html.erb.deface b/app/overrides/spree/home/index/add_slider.html.erb.deface
deleted file mode 100644
index 19be251..0000000
--- a/app/overrides/spree/home/index/add_slider.html.erb.deface
+++ /dev/null
@@ -1,3 +0,0 @@
-
-<% slides = Spree::Slide.published %>
-<%= render partial: 'spree/shared/slider', locals: { slider: slides } %>
diff --git a/app/overrides/spree/shared/_header/add_slider.html.erb.deface b/app/overrides/spree/shared/_header/add_slider.html.erb.deface
deleted file mode 100644
index 8e1e1f1..0000000
--- a/app/overrides/spree/shared/_header/add_slider.html.erb.deface
+++ /dev/null
@@ -1,2 +0,0 @@
-
-<%= yield :spree_slider %>
\ No newline at end of file
diff --git a/app/views/spree/admin/slide_locations/_form.html.erb b/app/views/spree/admin/slide_locations/_form.html.erb
index 593aa1a..88ca9fb 100644
--- a/app/views/spree/admin/slide_locations/_form.html.erb
+++ b/app/views/spree/admin/slide_locations/_form.html.erb
@@ -1,10 +1,8 @@
-
<%= f.field_container :name do %>
- <%= f.label :name, t(:name) %>
+ <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %>
<%= f.text_field :name, class: "form-control fullwidth" %>
<% end %>
-
diff --git a/app/views/spree/admin/slide_locations/edit.html.erb b/app/views/spree/admin/slide_locations/edit.html.erb
index e284b09..564617d 100644
--- a/app/views/spree/admin/slide_locations/edit.html.erb
+++ b/app/views/spree/admin/slide_locations/edit.html.erb
@@ -1,9 +1,6 @@
<% content_for :page_title do %>
- <%= t('spree_slider_locations.editing_location') %>
-<% end %>
-
-<% content_for :page_actions do %>
- <%= button_link_to t('spree_slider_locations.back_to_locations'), spree.admin_slide_locations_path, icon: 'arrow-left' %>
+ <%= link_to Spree.t(:slider_locations), spree.admin_slide_locations_url %> /
+ <%= @slide_location.name %>
<% end %>
<%= render 'spree/shared/error_messages', target: @slide_location %>
diff --git a/app/views/spree/admin/slide_locations/index.html.erb b/app/views/spree/admin/slide_locations/index.html.erb
index f45ee4c..5c843be 100644
--- a/app/views/spree/admin/slide_locations/index.html.erb
+++ b/app/views/spree/admin/slide_locations/index.html.erb
@@ -1,29 +1,36 @@
<% content_for :page_actions do %>
- <%= button_link_to t('spree_slider_locations.new_location'), new_object_url, { class: 'btn-success', icon: 'add', id: 'admin_new_slide_link' } %>
+ <%= button_link_to t('spree_slider_locations.new_location'), new_object_url, { class: 'btn-primary', icon: 'add.svg', id: 'admin_new_slide_link' } %>
<% end %>
<% content_for :page_title do %>
<%= t('spree_slider_locations.title') %>
<% end %>
-
-
-
-
- <%= Spree.t(:name) %>
-
-
-
-
- <% @slide_locations.each do |location|%>
-
- <%= location.name %>
-
- <%= link_to_edit location, no_text: true, class: 'edit' %>
-
- <%= link_to_delete location, no_text: true %>
-
-
- <% end %>
-
-
-
+<% if @slide_locations.any? %>
+
+
+
+
+ <%= Spree.t(:name) %>
+
+
+
+
+ <% @slide_locations.each do |location|%>
+
+ <%= location.name %>
+
+ <%= link_to_edit location, no_text: true, class: 'edit' %>
+
+ <%= link_to_delete location, no_text: true %>
+
+
+ <% end %>
+
+
+
+<% else %>
+
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::SlideLocation)) %>,
+ <%= link_to Spree.t(:add_one), new_object_url if can?(:create, Spree::SlideLocation) %>!
+
+<% end %>
diff --git a/app/views/spree/admin/slide_locations/new.html.erb b/app/views/spree/admin/slide_locations/new.html.erb
index 3694c96..3e8bafd 100644
--- a/app/views/spree/admin/slide_locations/new.html.erb
+++ b/app/views/spree/admin/slide_locations/new.html.erb
@@ -1,11 +1,8 @@
<% content_for :page_title do %>
+ <%= link_to Spree.t(:slider_locations), spree.admin_slide_locations_url %> /
<%= t('spree_slider_locations.new_location') %>
<% end %>
-<% content_for :page_actions do %>
- <%= button_link_to t('spree_slider_locations.back_to_locations'), spree.admin_slide_locations_path, icon: 'arrow-left' %>
-<% end %>
-
<%= render 'spree/shared/error_messages', :target => @slide_location %>
<%= form_for [:admin, @slide_location] do |f| %>
diff --git a/app/views/spree/admin/slides/_edit_slider_locations.html.erb b/app/views/spree/admin/slides/_edit_slider_locations.html.erb
deleted file mode 100644
index de8cbcc..0000000
--- a/app/views/spree/admin/slides/_edit_slider_locations.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- <%= t('spree_slider_locations.title') %>
-
-
-
-
-
- <%= f.field_container :slide_location, class: ['form-group'] do %>
- <%= f.label :slide_location_id, Spree.t(:location) %>
- <%= f.collection_select(:slide_location_ids, Spree::SlideLocation.all, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2', disabled: (cannot? :edit, Spree::SlideLocation) }) %>
- <%= f.error_message_on :slide_location %>
- <% end %>
-
-
-
-
-
-<%= button_link_to t('spree_slider_locations.new_location'), 'javascript:;', {
- icon: 'add',
- 'data-target': 'tbody#slider_locations',
- class: 'btn-success spree_add_fields'
-} %>
-
-
diff --git a/app/views/spree/admin/slides/_form.html.erb b/app/views/spree/admin/slides/_form.html.erb
index 2b1a0df..2fbcbd9 100644
--- a/app/views/spree/admin/slides/_form.html.erb
+++ b/app/views/spree/admin/slides/_form.html.erb
@@ -1,59 +1,43 @@
-
- <%= f.field_container :position do %>
- <%= f.label :position, t(:position) %>
- <%= f.number_field :position, class: 'fullwidth form-control' %>
- <% end %>
-
-
-
-
-
- <%= f.check_box :published, class: "form-control" %>
- <%= t(:published) %>
-
-
-
-
-
- <%= f.field_container :product_id do %>
- <%= label_tag :product_id, t(:product) %>
- <%= hidden_field_tag 'slide[product_id]', f.object.product_id.to_s, class: "product_picker fullwidth" %>
- <% end %>
-
-
<%= f.field_container :name do %>
<%= f.label :name, t(:name) %>
- <%= f.text_field :name, class: 'fullwidth form-control', placeholder: t('spree_slider.placeholder_name') %>
+ <%= f.text_field :name, class: 'fullwidth form-control' %>
<% end %>
<%= f.field_container :link_url do %>
<%= f.label :link_url, t(:link_url) %>
- <%= f.text_field :link_url, class: 'fullwidth form-control', placeholder: t('spree_slider.placeholder_link_url') %>
+ <%= f.text_field :link_url, class: 'fullwidth form-control' %>
<% end %>
- <%= render 'spree/admin/slides/edit_slider_locations', f: f %>
+ <%= f.field_container :image do %>
+ <%= f.label :image, t(:image) %>
+ <%= f.file_field :image %>
+ <% end %>
-
- <%= f.field_container :body do %>
- <%= f.label :body, t(:body) %>
- <%= f.text_area :body, {cols: 60, rows: 4, class: 'fullwidth form-control'} %>
- <% end %>
+
+
+
+ <%= f.check_box :published, class: "form-control" %>
+ <%= t(:published) %>
+
+
- <%= f.field_container :image do %>
- <%= f.label :image, t(:image) %> (<%= t('spree_slider.image_tip') %>)
- <%= f.file_field :image %>
+ <%= f.field_container :slide_location do %>
+ <%= f.label :slide_location_id, Spree.t(:location) %>
+ <%= f.collection_select(:slide_location_id, Spree::SlideLocation.all, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2', disabled: (cannot? :edit, Spree::SlideLocation) }) %>
+ <%= f.error_message_on :slide_location_id %>
<% end %>
+
<%= f.field_container :image do %>
<% if f.object.image.attached? %>
diff --git a/app/views/spree/admin/slides/edit.html.erb b/app/views/spree/admin/slides/edit.html.erb
index a550403..611845f 100644
--- a/app/views/spree/admin/slides/edit.html.erb
+++ b/app/views/spree/admin/slides/edit.html.erb
@@ -1,9 +1,6 @@
<% content_for :page_title do %>
- <%= t('spree_slider.editing_slide') %>
-<% end %>
-
-<% content_for :page_actions do %>
- <%= button_link_to t('spree_slider.back_to_slides'), spree.admin_slides_path, icon: 'arrow-left' %>
+ <%= link_to Spree.t(:slides), spree.admin_slides_url %> /
+ <%= @slide.name %>
<% end %>
<%= render 'spree/shared/error_messages', target: @slide %>
diff --git a/app/views/spree/admin/slides/index.html.erb b/app/views/spree/admin/slides/index.html.erb
index 19fdcf1..98a2044 100644
--- a/app/views/spree/admin/slides/index.html.erb
+++ b/app/views/spree/admin/slides/index.html.erb
@@ -1,42 +1,48 @@
<% content_for :page_actions do %>
- <%= button_link_to t('spree_slider.new_slide'), new_object_url, { class: 'btn-success', icon: 'add', id: 'admin_new_slide_link' } %>
+ <%= button_link_to t('spree_slider.new_slide'), new_object_url, { class: 'btn-primary', icon: 'add.svg', id: 'admin_new_slide_link' } %>
<% end %>
<% content_for :page_title do %>
<%= t('spree_slider.title') %>
<% end %>
-<% product_slides = @slides.where.not(product_id: nil) %>
-<% image_slides = @slides.where(product_id: nil) %>
-
-<% [
- [I18n.t("spree_slider.image_slides"), image_slides, :image],
- [I18n.t("spree_slider.product_slides"), product_slides, :product]
- ].each do |translation, slides, type|%>
-
<%= translation %>
-
-
-
- <%= Spree.t(:image) %>
- <%= get_column_header_by_type(type) %>
- <%= Spree.t(:published) %>
-
-
-
-
- <% slides.each do |slide| %>
-
- <%= image_tag slide.slide_image ? main_app.url_for(slide.preview) : "noimage/small.png" %>
- <%= get_image_link_by_type(slide, type) %>
- <%= slide.published ? Spree.t(:say_yes) : Spree.t(:say_no) %>
-
- <%= link_to_edit slide, no_text: true, class: 'edit' %>
-
- <%= link_to_delete slide, no_text: true %>
-
+<% if @slides.any? %>
+
+
+
+
+
+ <%= Spree.t(:image) %>
+ <%= Spree.t(:name) %>
+ <%= Spree.t(:published) %>
+ <%= Spree.t(:location) %>
+
- <% end %>
-
-
+
+
+ <% @slides.each do |slide| %>
+
+
+ <%= svg_icon name: "grip-vertical.svg", width: '14', height: '14' %>
+
+ <%= image_tag slide.slide_image ? main_app.url_for(slide.preview) : "noimage/small.png" %>
+ <%= slide.name %>
+ <%= slide.published ? Spree.t(:say_yes) : Spree.t(:say_no) %>
+ <%= slide.slide_location&.name || Spree.t("None") %>
+
+ <%= link_to_edit slide, no_text: true, class: 'edit' %>
+
+ <%= link_to_delete slide, no_text: true %>
+
+
+ <% end %>
+
+
+
+<% else %>
+
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Slide)) %>,
+ <%= link_to Spree.t(:add_one), new_object_url if can?(:create, Spree::Slide) %>!
+
<% end %>
diff --git a/app/views/spree/admin/slides/new.html.erb b/app/views/spree/admin/slides/new.html.erb
index ea69ba9..122805d 100644
--- a/app/views/spree/admin/slides/new.html.erb
+++ b/app/views/spree/admin/slides/new.html.erb
@@ -1,11 +1,8 @@
<% content_for :page_title do %>
+ <%= link_to Spree.t(:slides), spree.admin_slides_url %> /
<%= t('spree_slider.new_slide') %>
<% end %>
-<% content_for :page_actions do %>
- <%= button_link_to t('spree_slider.back_to_slides'), spree.admin_slides_path, icon: 'arrow-left' %>
-<% end %>
-
<%= render 'spree/shared/error_messages', target: @slide %>
<%= form_for [:admin, @slide] , html: { multipart: true } do |f| %>
diff --git a/app/views/spree/admin/slides/show.html.erb b/app/views/spree/admin/slides/show.html.erb
deleted file mode 100644
index ad6540f..0000000
--- a/app/views/spree/admin/slides/show.html.erb
+++ /dev/null
@@ -1,51 +0,0 @@
-
<%= t(:slide) %>
-
-
-
- <%= t(:product) %>
-
- <%= @slide.product.name unless @slide.product_id.blank? %>
-
-
-
- <%= t(:name) %>
-
- <%= @slide.name %>
-
-
-
- <%= t(:body) %>
-
- <%= @slide.body %>
-
-
-
- <%= t(:link_url) %>
-
- <%= @slide.link_url %>
-
-
-
- <%= t(:published) %>
-
- <%= @slide.published ? t(:y) : t(:n) %>
-
-
-
- <%= t(:image_file_name) %>
-
- <%= @slide.image_file_name %>
-
-
-
- <%= t(:position) %>
-
- <%= @slide.position %>
-
-
-
-
-
- <%= link_to_edit @slide, class: 'edit_slide' %> <%= t(:or) %>
- <%= link_to t(:back), collection_url %>
-
diff --git a/app/views/spree/shared/_slider.html.erb b/app/views/spree/shared/_slider.html.erb
index e5d25ea..ecf5f0f 100644
--- a/app/views/spree/shared/_slider.html.erb
+++ b/app/views/spree/shared/_slider.html.erb
@@ -1,41 +1,40 @@
-<% if slider.size > 0 %>
-
+<% if sliders.size > 0 %>
<%# generate a random number for the carousel id - in case you want multiple per page %>
<% cid ||= Random.rand(1000) %>
-
>
<%# Indicators %>
- <% slider.each_with_index do |slide, index| %>
+ <% sliders.each_with_index do |slide, index| %>
<% end %>
<%# Wrapper for slider %>
- <% slider.each_with_index do |slide, index| %>
+ <% sliders.each_with_index do |slide, index| %>
- <% image_url = slide.slide_image ? main_app.url_for(slide.slide_image) : "noimage/large"%>
- <%= link_to image_tag(image_url, alt: slide.slide_name), url_for(slide.slide_link) %>
+ <% image_url = slide.slide_image ? main_app.url_for(slide.slide_image) : "noimage/large" %>
+ <%= link_to image_tag(image_url, alt: slide.name, style: 'height: auto;'), url_for(slide&.link_url) %>
-
<%= slide.slide_name %>
+
<%= slide.name %>
<% unless slide.body.blank? %>
-
<%= slide.body %>
-
- <% end %>
-
-
- <% end %>
+
<%= slide.body %>
+ <% end %>
+
-
- <%# Controls %>
-
-
- <%= t(:previous) %>
-
-
-
- <%= t(:next) %>
-
+ <% end %>
+
+ <%# Controls %>
+ <% if sliders.size > 1 %>
+
+
+ <%= t(:previous) %>
+
+
+
+ <%= t(:next) %>
+
+ <% end %>
+
<% end %>
diff --git a/config/initializers/slider.rb b/config/initializers/slider.rb
new file mode 100644
index 0000000..4157725
--- /dev/null
+++ b/config/initializers/slider.rb
@@ -0,0 +1,23 @@
+Rails.application.config.after_initialize do
+ if Spree::Core::Engine.backend_available?
+ Rails.application.config.spree_backend.main_menu.add_to_section(
+ 'settings',
+ ::Spree::Admin::MainMenu::ItemBuilder.new(
+ 'slider_locations',
+ ::Spree::Core::Engine.routes.url_helpers.admin_slide_locations_path
+ )
+ .with_manage_ability_check(::Spree::SlideLocation)
+ .build
+ )
+
+ Rails.application.config.spree_backend.main_menu.add_to_section(
+ 'settings',
+ ::Spree::Admin::MainMenu::ItemBuilder.new(
+ 'slides',
+ ::Spree::Core::Engine.routes.url_helpers.admin_slides_path
+ )
+ .with_manage_ability_check(::Spree::Slide)
+ .build
+ )
+ end
+end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e0c35c3..943470f 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -36,3 +36,7 @@ en:
new_location: 'New Location'
editing_location: 'Editing Location'
back_to_locations: 'Back to Locations'
+
+ spree:
+ slider_locations: 'Slider Locations'
+ slides: 'Slides'
diff --git a/db/migrate/20121219124126_add_product_id_to_slides.rb b/db/migrate/20121219124126_add_product_id_to_slides.rb
deleted file mode 100644
index 9c71b99..0000000
--- a/db/migrate/20121219124126_add_product_id_to_slides.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddProductIdToSlides < ActiveRecord::Migration[5.2]
- def change
- add_column :spree_slides, :product_id, :integer
- end
-end
diff --git a/db/migrate/20150611113500_create_slider_location.rb b/db/migrate/20150611113500_create_slider_location.rb
index 03019b6..0d38dd2 100644
--- a/db/migrate/20150611113500_create_slider_location.rb
+++ b/db/migrate/20150611113500_create_slider_location.rb
@@ -4,10 +4,5 @@ def change
t.string :name
t.timestamps
end
-
- create_table :spree_slide_slide_locations do |t|
- t.belongs_to :slide, index: true
- t.belongs_to :slide_location, index: true
- end
end
end
diff --git a/db/migrate/20250118192852_update_slide_location_associations.rb b/db/migrate/20250118192852_update_slide_location_associations.rb
new file mode 100644
index 0000000..6f22ddc
--- /dev/null
+++ b/db/migrate/20250118192852_update_slide_location_associations.rb
@@ -0,0 +1,5 @@
+class UpdateSlideLocationAssociations < ActiveRecord::Migration[5.2]
+ def change
+ add_reference :spree_slides, :slide_location, foreign_key: { to_table: :spree_slide_locations }
+ end
+end
diff --git a/spree_slider.gemspec b/spree_slider.gemspec
index cc1e506..1007e5f 100644
--- a/spree_slider.gemspec
+++ b/spree_slider.gemspec
@@ -1,10 +1,10 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_slider'
- s.version = '4.0.0'
+ s.version = '4.10.1'
s.summary = 'Spree Slider extension'
s.description = 'Adds a slider to the homepage'
- s.required_ruby_version = '>= 2.5.0'
+ s.required_ruby_version = '>= 3.3.0'
s.author = 'Giuseppe Privitera'
s.email = 'priviterag@gmail.com'
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.requirements << 'none'
spree_version = '>= 3.7.0', '< 5.0'
- s.add_dependency 'active_storage_validations', '~> 0.9.0'
+ s.add_dependency 'active_storage_validations', '~> 1.2.0'
s.add_dependency 'spree_backend', spree_version
s.add_dependency 'spree_core', spree_version
s.add_dependency 'spree_extension'