Skip to content

Commit

Permalink
Merge branch 'solidusio:main' into store_metadata_for_solidus_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
fthobe authored Nov 27, 2024
2 parents e023e91 + c560453 commit b29a74f
Show file tree
Hide file tree
Showing 43 changed files with 419 additions and 175 deletions.
12 changes: 12 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
- changed-files:
- any-glob-to-any-file:
- "admin/**/*"
"changelog:solidus_promotions":
- any:
- changed-files:
- any-glob-to-any-file:
- "promotions/**/*"
"changelog:solidus_legacy_promotions":
- any:
- changed-files:
- any-glob-to-any-file:
- "legacy_promotions/**/*"
"changelog:solidus_sample":
- any:
- changed-files:
Expand All @@ -40,6 +50,8 @@
- "!backend/**/*"
- "!api/**/*"
- "!admin/**/*"
- "!promotions/**/*"
- "!legacy_promotions/**/*"
- "!sample/**/*"
- "!lib/**/*"
- "!README.md"
Expand Down
3 changes: 3 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ changelog:
- title: Solidus Sample
labels:
- "changelog:solidus_sample"
- title: Solidus Promotions
labels:
- "changelog:solidus_promotions"
207 changes: 207 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

22 changes: 18 additions & 4 deletions admin/app/components/solidus_admin/base_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def missing_translation(key, options)
end
end

def self.i18n_scope
@i18n_scope ||= name.underscore.tr("/", ".")
end

def self.stimulus_id
@stimulus_id ||= name.underscore
.sub(/^solidus_admin\/(.*)\/component$/, '\1')
Expand All @@ -34,12 +38,22 @@ def self.stimulus_id

delegate :stimulus_id, to: :class

def spree
@spree ||= Spree::Core::Engine.routes.url_helpers
class << self
private

def engines_with_routes
Rails::Engine.subclasses.map(&:instance).reject do |engine|
engine.routes.empty?
end
end
end

def solidus_admin
@solidus_admin ||= SolidusAdmin::Engine.routes.url_helpers
# For each engine with routes, define a method that returns the routes proxy.
# This allows us to use the routes in the context of a component class.
engines_with_routes.each do |engine|
define_method(engine.engine_name) do
engine.routes.url_helpers
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<li class="group <%= "active" if active? %>">
<a
href="<%= path %>"
aria-current="<%= @item.current?(@url_helpers, @fullpath) ? "page" : "false" %>"
aria-current="<%= @item.current?(self, @fullpath) ? "page" : "false" %>"
class="
flex gap-3 items-center
py-1 px-3 rounded
Expand All @@ -20,7 +20,7 @@

<% if @item.children? %>
<ul class="flex flex-col gap-0.5 pt-0.5 <%= "hidden" unless active? %>">
<%= render self.class.with_collection(@item.children, url_helpers: @url_helpers, fullpath: @fullpath) %>
<%= render self.class.with_collection(@item.children, fullpath: @fullpath) %>
</ul>
<% end %>
</li>
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,19 @@ class SolidusAdmin::Layout::Navigation::Item::Component < SolidusAdmin::BaseComp

# @param item [SolidusAdmin::MenuItem]
# @param fullpath [String] the current path
# @param url_helpers [#solidus_admin, #spree] context for generating paths
def initialize(
item:,
fullpath: "#",
url_helpers: Struct.new(:spree, :solidus_admin).new(spree, solidus_admin)
fullpath: "#"
)
@item = item
@url_helpers = url_helpers
@fullpath = fullpath
end

def path
@item.path(@url_helpers)
@item.path(self)
end

def active?
@item.active?(@url_helpers, @fullpath)
@item.active?(self, @fullpath)
end
end
2 changes: 1 addition & 1 deletion admin/lib/solidus_admin/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module SolidusAdmin
VERSION = "0.3.1"
VERSION = "0.3.2"
end
2 changes: 1 addition & 1 deletion admin/solidus_admin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.metadata["changelog_uri"] = "https://github.com/solidusio/solidus/releases?q=%22solidus_admin%2Fv0%22&expanded=true"

s.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(spec|script)/})
f.match(%r{^(spec|bin)/})
end + ["app/assets/builds/solidus_admin/tailwind.css"]

s.required_ruby_version = '>= 3.1.0'
Expand Down
10 changes: 0 additions & 10 deletions api/script/rails

This file was deleted.

2 changes: 1 addition & 1 deletion api/solidus_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.metadata['rubygems_mfa_required'] = 'true'

s.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(spec|script)/})
f.match(%r{^(spec|bin)/})
end

s.required_ruby_version = '>= 3.1.0'
Expand Down
10 changes: 0 additions & 10 deletions backend/script/rails

This file was deleted.

2 changes: 1 addition & 1 deletion backend/solidus_backend.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.metadata['rubygems_mfa_required'] = 'true'

s.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(spec|script)/})
f.match(%r{^(spec|bin)/})
end

s.required_ruby_version = '>= 3.1.0'
Expand Down
2 changes: 1 addition & 1 deletion bin/dev
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ if ! test -d sandbox; then
bin/sandbox
fi

export PORT=3000
export PORT=${PORT:-3000}
exec foreman start -f Procfile.dev "$@"
3 changes: 0 additions & 3 deletions core/app/models/spree/line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ class LineItem < Spree::Base
has_many :adjustments, as: :adjustable, inverse_of: :adjustable, dependent: :destroy
has_many :inventory_units, inverse_of: :line_item

has_many :line_item_actions, dependent: :destroy
has_many :actions, through: :line_item_actions

before_validation :normalize_quantity
before_validation :set_required_attributes

Expand Down
4 changes: 3 additions & 1 deletion core/db/default/spree/return_reasons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Spree::ReturnReason.find_or_create_by(name: 'Better price available')
Spree::ReturnReason.find_or_create_by(name: 'Missed estimated delivery date')
Spree::ReturnReason.find_or_create_by(name: 'Missing parts or accessories')
Spree::ReturnReason.find_or_create_by(name: 'Damaged/Defective')
Spree::ReturnReason.find_or_create_by(name: 'Damaged during transport')
Spree::ReturnReason.find_or_create_by(name: 'Defective within warranty period')
Spree::ReturnReason.find_or_create_by(name: 'Other defects or damages')
Spree::ReturnReason.find_or_create_by(name: 'Different from what was ordered')
Spree::ReturnReason.find_or_create_by(name: 'Different from description')
Spree::ReturnReason.find_or_create_by(name: 'No longer needed/wanted')
Expand Down
10 changes: 0 additions & 10 deletions core/db/migrate/20160101010000_solidus_one_four.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,6 @@ def up
t.index ["variant_id"], name: "index_inventory_units_on_variant_id"
end

create_table "spree_line_item_actions", force: :cascade do |t|
t.integer "line_item_id", null: false
t.integer "action_id", null: false
t.integer "quantity", default: 0
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.index ["action_id"], name: "index_spree_line_item_actions_on_action_id"
t.index ["line_item_id"], name: "index_spree_line_item_actions_on_line_item_id"
end

create_table "spree_line_items", force: :cascade do |t|
t.integer "variant_id"
t.integer "order_id"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
apply 'https://github.com/solidusio/solidus_starter_frontend/raw/rails-7.2/template.rb'
apply 'https://github.com/solidusio/solidus_starter_frontend/raw/main/template.rb'
4 changes: 2 additions & 2 deletions core/lib/spree/core/version.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

module Spree
VERSION = "4.4.0.dev"
VERSION = "4.5.0.dev"

def self.solidus_version
VERSION
end

def self.previous_solidus_minor_version
'4.3'
'4.4'
end

def self.solidus_gem_version
Expand Down
10 changes: 0 additions & 10 deletions core/script/rails

This file was deleted.

2 changes: 1 addition & 1 deletion core/solidus_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.metadata['rubygems_mfa_required'] = 'true'

s.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(spec|script)/})
f.match(%r{^(spec|bin)/})
end

s.required_ruby_version = '>= 3.1.0'
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
NODE_VERSION: 20
MYSQL_VERSION: "8.0"
BUNDLER_VERSION: 2
image: solidus-4.4.0.dev
image: solidus-4.5.0.dev
command: bash -c "(bundle check || bundle) && bash -c 'echo Container initialized, see README.md for further steps.' && tail -f /dev/null"
environment:
CAPYBARA_DRIVER: selenium_chrome_headless_docker_friendly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import "spree/backend/themes/classic";
@import "spree/backend/globals/variables";

@import "solidus_legacy_promotions/promotions/edit";
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

module SolidusLegacyPromotions
module SpreeLineItemDecorator
def self.prepended(base)
base.has_many :line_item_actions, dependent: :destroy
base.has_many :actions, through: :line_item_actions
end

def total_before_tax
amount + adjustments.select { |value| !value.tax? && value.eligible? }.sum(&:amount)
end
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions legacy_promotions/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
en:
solidus_admin:
menu_item:
legacy_promotions: Promotions
legacy_promotion_categories: Promotion Categories
spree:
admin:
promotion_status:
Expand All @@ -23,8 +27,8 @@ en:
general: General
starts_at_placeholder: Immediately
tab:
promotion_categories: Promotion Categories
promotions: Promotions
legacy_promotions: Promotions
legacy_promotion_categories: Promotion Categories
back_to_promotion_categories_list: Back To Promotions Categories List
back_to_promotions_list: Back To Promotions List
base_amount: Base Amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,17 @@ def up
t.index ["starts_at"], name: "index_spree_promotions_on_starts_at"
end
end

unless table_exists?(:spree_line_item_actions)
create_table "spree_line_item_actions", force: :cascade do |t|
t.integer "line_item_id", null: false
t.integer "action_id", null: false
t.integer "quantity", default: 0
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.index ["action_id"], name: "index_spree_line_item_actions_on_action_id"
t.index ["line_item_id"], name: "index_spree_line_item_actions_on_line_item_id"
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
en:
columns:
items:
one: 1 Item
other: '%{count} Items'
filters:
status: Status
shipment_state: Shipment State
payment_state: Payment State
promotions: Promotions
date:
formats:
short: '%d %b %y'
scopes:
all_orders: All
canceled: Canceled
complete: Complete
returned: Returned
in_progress: In Progress
promotions: Promotions
Loading

0 comments on commit b29a74f

Please sign in to comment.