Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from solidusio:main #392

Merged
merged 9 commits into from
Jan 18, 2024
1 change: 1 addition & 0 deletions admin/app/assets/stylesheets/solidus_admin/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ html {

main img {
filter: invert(100%) hue-rotate(-180deg);
background-color: #fff;
}
1 change: 1 addition & 0 deletions admin/app/assets/stylesheets/solidus_admin/dimmed.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ html {

main img {
filter: invert(91%) brightness(1.5) contrast(1.5) hue-rotate(-180deg);
background-color: #ddd;
}
2 changes: 1 addition & 1 deletion admin/app/components/solidus_admin/ui/button/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def initialize(

@attributes[:class] = [
'justify-start items-center justify-center gap-1 inline-flex rounded',
'focus:ring focus:ring-gray-300 focus:ring-0.5 focus:bg-white focus:ring-offset-0 [&:focus-visible]:outline-none',
'focus:ring focus:ring-gray-300 focus:ring-0.5 focus:ring-offset-0 [&:focus-visible]:outline-none',
SIZES.fetch(size.to_sym),
(TEXT_PADDINGS.fetch(size.to_sym) if @text),
SCHEMES.fetch(scheme.to_sym),
Expand Down
21 changes: 5 additions & 16 deletions admin/app/components/solidus_admin/ui/panel/component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,18 @@
<% end %>

<% if @title %>
<section class="border-gray-100 border-t w-full first-of-type:border-t-0 p-6">
<%= render_section do %>
<h2>
<span class="font-semibold text-xl"><%= @title %></span>
<span class="font-semibold text-base"><%= @title %></span>
<%= render component("ui/toggletip").new(text: @title_hint) if @title_hint %>
</h2>
</section>
<% end %>
<% end %>

<% sections.each do |section| %>
<%= section %>
<% end %>

<% if content.present? %>
<section class="border-gray-100 border-t w-full first-of-type:border-t-0 p-6">
<%= content %>
</section>
<% end %>

<% if action? %>
<section class="border-gray-100 border-t w-full first-of-type:border-t-0 p-6">
<div class="flex justify-between items-center">
<%= action %>
</div>
</section>
<% end %>
<%= render_section { content } if content.present? %>
<%= render_section { tag.div(action, class: "flex justify-between items-center") } if action? %>
</div>
18 changes: 11 additions & 7 deletions admin/app/components/solidus_admin/ui/panel/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ class SolidusAdmin::UI::Panel::Component < SolidusAdmin::BaseComponent
)
}

renders_many :sections, ->(wide: false, high: false, **args, &block) do
tag.section(**args, class: "
border-gray-100 border-t w-full first-of-type:border-t-0
#{'px-6' unless wide}
#{'py-6' unless high}
#{args[:class]}
", &block)
renders_many :sections, ->(**args, &block) do
render_section(**args, &block)
end

renders_many :menus, ->(name, url, **args) do
Expand All @@ -33,4 +28,13 @@ def initialize(title: nil, title_hint: nil)
@title = title
@title_hint = title_hint
end

def render_section(wide: false, high: false, **args, &block)
tag.section(**args, class: "
border-gray-100 border-t w-full first-of-type:border-t-0
#{'px-6' unless wide}
#{'py-4' unless high}
#{args[:class]}
", &block)
end
end
4 changes: 4 additions & 0 deletions admin/spec/features/stock_items_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,28 @@
expect(find('tr', text: 'MY-SKU-1234567890')).to have_content('1 stock movement')

click_on 'Back Orderable'
expect(page).to have_css('[aria-current="true"]', text: 'Back Orderable')
expect(page).to_not have_content(non_backorderable.variant.sku)
expect(page).to have_content(backorderable.variant.sku)
expect(page).to_not have_content(out_of_stock.variant.sku)
expect(page).to_not have_content(low_stock.variant.sku)

click_on 'Out Of Stock'
expect(page).to have_css('[aria-current="true"]', text: 'Out Of Stock')
expect(page).to_not have_content(non_backorderable.variant.sku)
expect(page).to_not have_content(backorderable.variant.sku)
expect(page).to have_content(out_of_stock.variant.sku)
expect(page).to_not have_content(low_stock.variant.sku)

click_on 'Low Stock'
expect(page).to have_css('[aria-current="true"]', text: 'Low Stock')
expect(page).to_not have_content(non_backorderable.variant.sku)
expect(page).to_not have_content(backorderable.variant.sku)
expect(page).to_not have_content(out_of_stock.variant.sku)
expect(page).to have_content(low_stock.variant.sku)

click_on 'In Stock'
expect(page).to have_css('[aria-current="true"]', text: 'In Stock')
expect(page).to have_content(non_backorderable.variant.sku)
expect(page).to have_content(backorderable.variant.sku)
expect(page).to_not have_content(out_of_stock.variant.sku)
Expand Down
1 change: 1 addition & 0 deletions core/lib/spree/testing_support/common_rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def initialize
'solidus:install',
Dir.pwd, # use the current dir as Rails.root
"--auto-accept",
"--admin-preview=#{ENV.fetch('ADMIN_PREVIEW', 'false')}",
"--authentication=none",
"--payment-method=none",
"--migrate=false",
Expand Down
Loading