solidus_admin 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/solidus_admin/tailwind.css +153 -133
  3. data/app/components/solidus_admin/base_component.rb +19 -5
  4. data/app/components/solidus_admin/layout/navigation/account/component.rb +2 -2
  5. data/app/components/solidus_admin/layout/navigation/component.rb +1 -1
  6. data/app/components/solidus_admin/layout/navigation/item/component.html.erb +2 -2
  7. data/app/components/solidus_admin/layout/navigation/item/component.rb +3 -6
  8. data/app/components/solidus_admin/orders/index/component.rb +1 -1
  9. data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/component.rb +1 -1
  10. data/app/components/solidus_admin/orders/show/adjustments/index/source/component.rb +1 -1
  11. data/app/components/solidus_admin/products/status/component.rb +1 -1
  12. data/app/components/solidus_admin/stock_items/index/component.rb +1 -1
  13. data/app/components/solidus_admin/stock_locations/index/component.rb +2 -2
  14. data/app/components/solidus_admin/ui/forms/field/component.rb +17 -17
  15. data/app/components/solidus_admin/ui/icon/component.rb +3 -1
  16. data/app/components/solidus_admin/ui/pages/index/component.rb +5 -5
  17. data/app/components/solidus_admin/ui/table/component.rb +1 -1
  18. data/app/components/solidus_admin/ui/thumbnail_with_caption/component.rb +1 -1
  19. data/app/components/solidus_admin/ui/toast/component.html.erb +1 -1
  20. data/app/components/solidus_admin/users/index/component.rb +1 -1
  21. data/app/components/solidus_admin/users/store_credits/index/component.html.erb +49 -0
  22. data/app/components/solidus_admin/users/store_credits/index/component.rb +106 -0
  23. data/app/components/solidus_admin/users/store_credits/index/component.yml +12 -0
  24. data/app/controllers/solidus_admin/controller_helpers/search.rb +4 -4
  25. data/app/controllers/solidus_admin/users_controller.rb +9 -1
  26. data/config/routes.rb +1 -0
  27. data/lib/generators/solidus_admin/install/install_generator.rb +2 -0
  28. data/lib/solidus_admin/component_registry.rb +1 -1
  29. data/lib/solidus_admin/configuration.rb +3 -3
  30. data/lib/solidus_admin/install_tailwindcss.rb +1 -1
  31. data/lib/solidus_admin/testing_support/dummy_app/rake_tasks.rb +1 -1
  32. data/lib/solidus_admin/testing_support/feature_helpers.rb +1 -1
  33. data/lib/solidus_admin/version.rb +1 -1
  34. data/solidus_admin.gemspec +2 -2
  35. metadata +7 -5
  36. data/bin/rails +0 -13
@@ -10,7 +10,7 @@ module SolidusAdmin
10
10
  include Turbo::FramesHelper
11
11
 
12
12
  def icon_tag(name, **attrs)
13
- render component("ui/icon").new(name: name, **attrs)
13
+ render component("ui/icon").new(name:, **attrs)
14
14
  end
15
15
 
16
16
  def missing_translation(key, options)
@@ -25,6 +25,10 @@ module SolidusAdmin
25
25
  end
26
26
  end
27
27
 
28
+ def self.i18n_scope
29
+ @i18n_scope ||= name.underscore.tr("/", ".")
30
+ end
31
+
28
32
  def self.stimulus_id
29
33
  @stimulus_id ||= name.underscore
30
34
  .sub(/^solidus_admin\/(.*)\/component$/, '\1')
@@ -34,12 +38,22 @@ module SolidusAdmin
34
38
 
35
39
  delegate :stimulus_id, to: :class
36
40
 
37
- def spree
38
- @spree ||= Spree::Core::Engine.routes.url_helpers
41
+ class << self
42
+ private
43
+
44
+ def engines_with_routes
45
+ Rails::Engine.subclasses.map(&:instance).reject do |engine|
46
+ engine.routes.empty?
47
+ end
48
+ end
39
49
  end
40
50
 
41
- def solidus_admin
42
- @solidus_admin ||= SolidusAdmin::Engine.routes.url_helpers
51
+ # For each engine with routes, define a method that returns the routes proxy.
52
+ # This allows us to use the routes in the context of a component class.
53
+ engines_with_routes.each do |engine|
54
+ define_method(engine.engine_name) do
55
+ engine.routes.url_helpers
56
+ end
43
57
  end
44
58
  end
45
59
  end
@@ -11,7 +11,7 @@ class SolidusAdmin::Layout::Navigation::Account::Component < SolidusAdmin::BaseC
11
11
  def locale_options_for_select(available_locales)
12
12
  available_locales.map do |locale|
13
13
  [
14
- t("spree.i18n.this_file_language", locale: locale, default: locale.to_s, fallback: false),
14
+ t("spree.i18n.this_file_language", locale:, default: locale.to_s, fallback: false),
15
15
  locale,
16
16
  ]
17
17
  end.sort
@@ -27,7 +27,7 @@ class SolidusAdmin::Layout::Navigation::Account::Component < SolidusAdmin::BaseC
27
27
  block_given? ? capture(&block) : nil,
28
28
  tag.label(safe_join([
29
29
  icon_tag(icon, class: "w-full max-w-[20px] h-5 fill-current shrink"),
30
- tag.select(options, name: name, onchange: "this.form.requestSubmit()", class: "w-full appearance-none grow bg-transparent outline-none"),
30
+ tag.select(options, name:, onchange: "this.form.requestSubmit()", class: "w-full appearance-none grow bg-transparent outline-none"),
31
31
  icon_tag("expand-up-down-line", class: "w-full max-w-[20px] h-5 fill-current shrink"),
32
32
  ]), class: "flex gap-2 items-center px-2"),
33
33
  ])
@@ -9,7 +9,7 @@ class SolidusAdmin::Layout::Navigation::Component < SolidusAdmin::BaseComponent
9
9
  @logo_path = logo_path
10
10
  @items = items.map do |attrs|
11
11
  children = attrs[:children].to_a.map { SolidusAdmin::MenuItem.new(**_1, top_level: false) }
12
- SolidusAdmin::MenuItem.new(**attrs, children: children, top_level: true)
12
+ SolidusAdmin::MenuItem.new(**attrs, children:, top_level: true)
13
13
  end
14
14
  @store = store
15
15
  end
@@ -1,7 +1,7 @@
1
1
  <li class="group <%= "active" if active? %>">
2
2
  <a
3
3
  href="<%= path %>"
4
- aria-current="<%= @item.current?(@url_helpers, @fullpath) ? "page" : "false" %>"
4
+ aria-current="<%= @item.current?(self, @fullpath) ? "page" : "false" %>"
5
5
  class="
6
6
  flex gap-3 items-center
7
7
  py-1 px-3 rounded
@@ -20,7 +20,7 @@
20
20
 
21
21
  <% if @item.children? %>
22
22
  <ul class="flex flex-col gap-0.5 pt-0.5 <%= "hidden" unless active? %>">
23
- <%= render self.class.with_collection(@item.children, url_helpers: @url_helpers, fullpath: @fullpath) %>
23
+ <%= render self.class.with_collection(@item.children, fullpath: @fullpath) %>
24
24
  </ul>
25
25
  <% end %>
26
26
  </li>
@@ -6,22 +6,19 @@ class SolidusAdmin::Layout::Navigation::Item::Component < SolidusAdmin::BaseComp
6
6
 
7
7
  # @param item [SolidusAdmin::MenuItem]
8
8
  # @param fullpath [String] the current path
9
- # @param url_helpers [#solidus_admin, #spree] context for generating paths
10
9
  def initialize(
11
10
  item:,
12
- fullpath: "#",
13
- url_helpers: Struct.new(:spree, :solidus_admin).new(spree, solidus_admin)
11
+ fullpath: "#"
14
12
  )
15
13
  @item = item
16
- @url_helpers = url_helpers
17
14
  @fullpath = fullpath
18
15
  end
19
16
 
20
17
  def path
21
- @item.path(@url_helpers)
18
+ @item.path(self)
22
19
  end
23
20
 
24
21
  def active?
25
- @item.active?(@url_helpers, @fullpath)
22
+ @item.active?(self, @fullpath)
26
23
  end
27
24
  end
@@ -124,7 +124,7 @@ class SolidusAdmin::Orders::Index::Component < SolidusAdmin::UI::Pages::Index::C
124
124
  'canceled' => :blue,
125
125
  'cart' => :graphite_light,
126
126
  }[order.state] || :yellow
127
- component('ui/badge').new(name: order.state.humanize, color: color)
127
+ component('ui/badge').new(name: order.state.humanize, color:)
128
128
  end
129
129
  }
130
130
  end
@@ -10,7 +10,7 @@ class SolidusAdmin::Orders::Show::Adjustments::Index::Adjustable::Component < So
10
10
  end
11
11
 
12
12
  def call
13
- render component("ui/thumbnail_with_caption").new(caption: caption, detail: detail) do
13
+ render component("ui/thumbnail_with_caption").new(caption:, detail:) do
14
14
  thumbnail
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ class SolidusAdmin::Orders::Show::Adjustments::Index::Source::Component < Solidu
10
10
  end
11
11
 
12
12
  def call
13
- render component("ui/thumbnail_with_caption").new(icon: icon, caption: caption, detail: detail)
13
+ render component("ui/thumbnail_with_caption").new(icon:, caption:, detail:)
14
14
  end
15
15
 
16
16
  def caption
@@ -20,7 +20,7 @@ class SolidusAdmin::Products::Status::Component < SolidusAdmin::BaseComponent
20
20
  :unavailable
21
21
  end
22
22
 
23
- new(status: status)
23
+ new(status:)
24
24
  end
25
25
 
26
26
  def initialize(status:)
@@ -138,7 +138,7 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
138
138
  count = stock_movement_counts[_1.id] || 0
139
139
 
140
140
  link_to(
141
- "#{count} #{Spree::StockMovement.model_name.human(count: count).downcase}",
141
+ "#{count} #{Spree::StockMovement.model_name.human(count:).downcase}",
142
142
  spree.admin_stock_location_stock_movements_path(
143
143
  _1.stock_location.id,
144
144
  q: { variant_sku_eq: _1.variant.sku },
@@ -57,7 +57,7 @@ class SolidusAdmin::StockLocations::Index::Component < SolidusAdmin::Shipping::C
57
57
  color = _1.active? ? :green : :graphite_light
58
58
  text = _1.active? ? t('.active') : t('.inactive')
59
59
 
60
- component('ui/badge').new(name: text, color: color)
60
+ component('ui/badge').new(name: text, color:)
61
61
  },
62
62
  },
63
63
  {
@@ -78,7 +78,7 @@ class SolidusAdmin::StockLocations::Index::Component < SolidusAdmin::Shipping::C
78
78
  count = _1.stock_movements.count
79
79
 
80
80
  link_to(
81
- "#{count} #{Spree::StockMovement.model_name.human(count: count).downcase}",
81
+ "#{count} #{Spree::StockMovement.model_name.human(count:).downcase}",
82
82
  spree.admin_stock_location_stock_movements_path(_1),
83
83
  class: 'body-link'
84
84
  )
@@ -18,14 +18,14 @@ class SolidusAdmin::UI::Forms::Field::Component < SolidusAdmin::BaseComponent
18
18
  object_name, object, label, errors = extract_form_details(form, object, method)
19
19
 
20
20
  new(
21
- label: label,
22
- hint: hint,
23
- tip: tip,
21
+ label:,
22
+ hint:,
23
+ tip:,
24
24
  error: errors,
25
25
  input_attributes: {
26
26
  name: "#{object_name}[#{method}]",
27
27
  tag: :input,
28
- size: size,
28
+ size:,
29
29
  value: object.public_send(method),
30
30
  error: (errors.to_sentence.capitalize if errors),
31
31
  **attributes,
@@ -37,15 +37,15 @@ class SolidusAdmin::UI::Forms::Field::Component < SolidusAdmin::BaseComponent
37
37
  object_name, object, label, errors = extract_form_details(form, object, method)
38
38
 
39
39
  new(
40
- label: label,
41
- hint: hint,
42
- tip: tip,
40
+ label:,
41
+ hint:,
42
+ tip:,
43
43
  error: errors,
44
44
  input_attributes: {
45
45
  name: "#{object_name}[#{method}]",
46
46
  tag: :select,
47
- choices: choices,
48
- size: size,
47
+ choices:,
48
+ size:,
49
49
  value: object.public_send(method),
50
50
  error: (errors.to_sentence.capitalize if errors),
51
51
  **attributes,
@@ -57,13 +57,13 @@ class SolidusAdmin::UI::Forms::Field::Component < SolidusAdmin::BaseComponent
57
57
  object_name, object, label, errors = extract_form_details(form, object, method)
58
58
 
59
59
  new(
60
- label: label,
61
- hint: hint,
62
- tip: tip,
60
+ label:,
61
+ hint:,
62
+ tip:,
63
63
  error: errors,
64
64
  input_attributes: {
65
65
  name: "#{object_name}[#{method}]",
66
- size: size,
66
+ size:,
67
67
  tag: :textarea,
68
68
  value: object.public_send(method),
69
69
  error: (errors.to_sentence.capitalize if errors),
@@ -76,14 +76,14 @@ class SolidusAdmin::UI::Forms::Field::Component < SolidusAdmin::BaseComponent
76
76
  object_name, object, label, errors = extract_form_details(form, object, method)
77
77
 
78
78
  new(
79
- label: label,
80
- hint: hint,
81
- tip: tip,
79
+ label:,
80
+ hint:,
81
+ tip:,
82
82
  error: errors,
83
83
  ).with_content(
84
84
  component('ui/forms/switch').new(
85
85
  name: "#{object_name}[#{method}]",
86
- size: size,
86
+ size:,
87
87
  checked: object.public_send(method),
88
88
  include_hidden: true,
89
89
  **attributes,
@@ -23,7 +23,9 @@ class SolidusAdmin::UI::Icon::Component < SolidusAdmin::BaseComponent
23
23
  end
24
24
 
25
25
  def call
26
- href = "#{image_path('solidus_admin/remixicon.symbol.svg')}#ri-#{@name}"
26
+ # bypass the asset_host configuration to avoid CORS issues with CDNs:
27
+ # https://github.com/solidusio/solidus/issues/5657
28
+ href = asset_path("solidus_admin/remixicon.symbol.svg#ri-#{@name}", host: "")
27
29
  tag.svg(tag.use("xlink:href": href), **@attrs)
28
30
  end
29
31
  end
@@ -61,8 +61,8 @@ class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
61
61
  value: search_params,
62
62
  url: search_url,
63
63
  searchbar_key: search_key,
64
- filters: filters,
65
- scopes: scopes,
64
+ filters:,
65
+ scopes:,
66
66
  }
67
67
  end
68
68
 
@@ -80,12 +80,12 @@ class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
80
80
  id: stimulus_id,
81
81
  data: {
82
82
  class: model_class,
83
- rows: rows,
83
+ rows:,
84
84
  fade: -> { row_fade(_1) },
85
85
  prev: prev_page_path,
86
86
  next: next_page_path,
87
- columns: columns,
88
- batch_actions: batch_actions,
87
+ columns:,
88
+ batch_actions:,
89
89
  url: -> { row_url(_1) },
90
90
  },
91
91
  search: search_options,
@@ -138,7 +138,7 @@ class SolidusAdmin::UI::Table::Component < SolidusAdmin::BaseComponent
138
138
  predicate: filter.predicate,
139
139
  options: filter.options,
140
140
  form: search_form_id,
141
- index: index,
141
+ index:,
142
142
  )
143
143
  end
144
144
 
@@ -10,6 +10,6 @@ class SolidusAdmin::UI::ThumbnailWithCaption::Component < SolidusAdmin::BaseComp
10
10
  end
11
11
 
12
12
  def icon_thumbnail
13
- render component("ui/thumbnail").new(icon: icon)
13
+ render component("ui/thumbnail").new(icon:)
14
14
  end
15
15
  end
@@ -8,7 +8,7 @@
8
8
  "
9
9
  data-controller="<%= stimulus_id %>"
10
10
  data-<%= stimulus_id %>-animation-class="translate-y-full opacity-0"
11
- data-<%= stimulus_id %>-transition-value="500"
11
+ data-<%= stimulus_id %>-transition-value="<%= Rails.env.test? ? 1000 : 500 %>"
12
12
  role="dialog"
13
13
  aria-label="<%= t(".#{@scheme}_label") %>"
14
14
  aria-live="polite"
@@ -77,7 +77,7 @@ class SolidusAdmin::Users::Index::Component < SolidusAdmin::UsersAndRoles::Compo
77
77
  when 'customer' then :green
78
78
  else :graphite_light
79
79
  end
80
- render component('ui/badge').new(name: _1.name, color: color)
80
+ render component('ui/badge').new(name: _1.name, color:)
81
81
  })
82
82
  end,
83
83
  },
@@ -0,0 +1,49 @@
1
+ <%= page do %>
2
+ <%= page_header do %>
3
+ <%= page_header_back(solidus_admin.users_path) %>
4
+ <%= page_header_title(t(".title", email: @user.email)) %>
5
+
6
+ <%= page_header_actions do %>
7
+ <%= render component("ui/button").new(tag: :a, text: t(".add_store_credit"), href: spree.new_admin_user_store_credit_url(user_id: @user.id, only_path: true)) %>
8
+ <% end %>
9
+ <% end %>
10
+
11
+ <%= page_header do %>
12
+ <% tabs.each do |tab| %>
13
+ <%= render(component("ui/button").new(tag: :a, scheme: :ghost, text: tab[:text], 'aria-current': tab[:current], href: tab[:href])) %>
14
+ <% end %>
15
+ <% end %>
16
+
17
+ <%= page_with_sidebar do %>
18
+ <%= page_with_sidebar_main do %>
19
+
20
+ <% if @store_credits.present? %>
21
+ <% @store_credits.group_by(&:currency).each do |currency, credits| %>
22
+ <% title = [t('spree.admin.store_credits.current_balance'), Spree::Money.new(credits.sum(&:amount_remaining), currency: currency)].join(" ") %>
23
+
24
+ <%= render component('ui/panel').new(title: title) do %>
25
+ <%= render component('ui/table').new(
26
+ id: stimulus_id,
27
+ data: {
28
+ class: model_class,
29
+ rows: credits,
30
+ fade: -> (_order) { false },
31
+ columns: columns,
32
+ url: -> { row_url(_1) },
33
+ },
34
+ )%>
35
+ <% end %>
36
+ <% end %>
37
+ <% else %>
38
+ <%= render component('ui/panel').new(title: t(".store_credit")) do %>
39
+ <%= t(".no_credits_found") %>
40
+ <%= render component("ui/button").new(tag: :a, text: t(".create_one"), href: spree.new_admin_user_store_credit_url(user_id: @user.id, only_path: true)) %>
41
+ <% end %>
42
+ <% end %>
43
+ <% end %>
44
+
45
+ <%= page_with_sidebar_aside do %>
46
+ <%= render component("users/stats").new(user: @user) %>
47
+ <% end %>
48
+ <% end %>
49
+ <% end %>
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SolidusAdmin::Users::StoreCredits::Index::Component < SolidusAdmin::BaseComponent
4
+ include SolidusAdmin::Layout::PageHelpers
5
+
6
+ def initialize(user:, store_credits:)
7
+ @user = user
8
+ @store_credits = store_credits
9
+ end
10
+
11
+ def model_class
12
+ Spree::StoreCredit
13
+ end
14
+
15
+ def tabs
16
+ [
17
+ {
18
+ text: t('.account'),
19
+ href: solidus_admin.user_path(@user),
20
+ current: false,
21
+ },
22
+ {
23
+ text: t('.addresses'),
24
+ href: solidus_admin.addresses_user_path(@user),
25
+ current: false,
26
+ },
27
+ {
28
+ text: t('.order_history'),
29
+ href: solidus_admin.orders_user_path(@user),
30
+ current: false,
31
+ },
32
+ {
33
+ text: t('.items'),
34
+ href: spree.items_admin_user_path(@user),
35
+ current: false,
36
+ },
37
+ {
38
+ text: t('.store_credit'),
39
+ href: solidus_admin.store_credits_user_path(@user),
40
+ current: true,
41
+ },
42
+ ]
43
+ end
44
+
45
+ def rows
46
+ @store_credits
47
+ end
48
+
49
+ def row_url(store_credit)
50
+ spree.admin_user_store_credit_path(@user, store_credit)
51
+ end
52
+
53
+ def columns
54
+ [
55
+ {
56
+ header: :credited,
57
+ col: { class: "w-[12%]" },
58
+ data: ->(store_credit) do
59
+ content_tag :div, store_credit.display_amount.to_html, class: "text-sm"
60
+ end
61
+ },
62
+ {
63
+ header: :authorized,
64
+ col: { class: "w-[13%]" },
65
+ data: ->(store_credit) do
66
+ content_tag :div, store_credit.display_amount_authorized.to_html, class: "text-sm"
67
+ end
68
+ },
69
+ {
70
+ header: :used,
71
+ col: { class: "w-[9%]" },
72
+ data: ->(store_credit) do
73
+ content_tag :div, store_credit.display_amount_used.to_html, class: "text-sm"
74
+ end
75
+ },
76
+ {
77
+ header: :type,
78
+ col: { class: "w-[13%]" },
79
+ data: ->(store_credit) do
80
+ component('ui/badge').new(name: store_credit.credit_type.name, color: :blue)
81
+ end
82
+ },
83
+ {
84
+ header: :created_by,
85
+ col: { class: "w-[22%]" },
86
+ data: ->(store_credit) do
87
+ content_tag :div, store_credit.created_by_email, class: "font-semibold text-sm"
88
+ end
89
+ },
90
+ {
91
+ header: :issued_on,
92
+ col: { class: "w-[16%]" },
93
+ data: ->(store_credit) do
94
+ I18n.l(store_credit.created_at.to_date)
95
+ end
96
+ },
97
+ {
98
+ header: :invalidated,
99
+ col: { class: "w-[15%]" },
100
+ data: ->(store_credit) do
101
+ store_credit.invalidated? ? component('ui/badge').yes : component('ui/badge').no
102
+ end
103
+ },
104
+ ]
105
+ end
106
+ end
@@ -0,0 +1,12 @@
1
+ en:
2
+ title: "Users / %{email} / Store Credit"
3
+ account: Account
4
+ addresses: Addresses
5
+ order_history: Order History
6
+ items: Items
7
+ store_credit: Store Credit
8
+ last_active: Last Active
9
+ add_store_credit: Add Store Credit
10
+ no_credits_found: No Store Credits found.
11
+ create_one: Create One
12
+ back: Back
@@ -7,8 +7,8 @@ module SolidusAdmin::ControllerHelpers::Search
7
7
  def search_scope(name, default: false, &block)
8
8
  search_scopes << SearchScope.new(
9
9
  name: name.to_s,
10
- block: block,
11
- default: default,
10
+ block:,
11
+ default:,
12
12
  )
13
13
  end
14
14
 
@@ -20,8 +20,8 @@ module SolidusAdmin::ControllerHelpers::Search
20
20
  private
21
21
 
22
22
  def apply_search_to(relation, param:)
23
- relation = apply_scopes_to(relation, param: param)
24
- apply_ransack_search_to(relation, param: param)
23
+ relation = apply_scopes_to(relation, param:)
24
+ apply_ransack_search_to(relation, param:)
25
25
  end
26
26
 
27
27
  def apply_ransack_search_to(relation, param:)
@@ -5,7 +5,7 @@ module SolidusAdmin
5
5
  include SolidusAdmin::ControllerHelpers::Search
6
6
  include Spree::Core::ControllerHelpers::StrongParameters
7
7
 
8
- before_action :set_user, only: [:edit, :addresses, :update_addresses, :orders, :items]
8
+ before_action :set_user, only: [:edit, :addresses, :update_addresses, :orders, :items, :store_credits]
9
9
 
10
10
  search_scope(:all, default: true)
11
11
  search_scope(:customers) { _1.left_outer_joins(:role_users).where(role_users: { id: nil }) }
@@ -81,6 +81,14 @@ module SolidusAdmin
81
81
  redirect_back_or_to users_path, status: :see_other
82
82
  end
83
83
 
84
+ def store_credits
85
+ @store_credits = Spree::StoreCredit.where(user_id: @user.id).order(id: :desc)
86
+
87
+ respond_to do |format|
88
+ format.html { render component("users/store_credits/index").new(user: @user, store_credits: @store_credits) }
89
+ end
90
+ end
91
+
84
92
  private
85
93
 
86
94
  def set_user
data/config/routes.rb CHANGED
@@ -51,6 +51,7 @@ SolidusAdmin::Engine.routes.draw do
51
51
  put :update_addresses
52
52
  get :orders
53
53
  get :items
54
+ get :store_credits
54
55
  end
55
56
  end
56
57
 
@@ -38,6 +38,8 @@ module SolidusAdmin
38
38
  gem "actioncable"
39
39
  end
40
40
 
41
+ execute_command :bundle, :install
42
+
41
43
  route "mount Lookbook::Engine, at: '#{solidus_mount_point}lookbook' if Rails.env.development?"
42
44
  end
43
45
 
@@ -28,7 +28,7 @@ module SolidusAdmin
28
28
  prefix = "#{SolidusAdmin::Configuration::ENGINE_ROOT}/app/components/solidus_admin/"
29
29
  suffix = "/component.rb"
30
30
  dictionary = Dir["#{prefix}**#{suffix}"].map { _1.delete_prefix(prefix).delete_suffix(suffix) }
31
- corrections = DidYouMean::SpellChecker.new(dictionary: dictionary).correct(key.to_s)
31
+ corrections = DidYouMean::SpellChecker.new(dictionary:).correct(key.to_s)
32
32
 
33
33
  raise ComponentNotFoundError.new(
34
34
  "Unknown component #{key}#{DidYouMean.formatter.message_for(corrections)}",
@@ -169,10 +169,10 @@ module SolidusAdmin
169
169
  {
170
170
  position: index,
171
171
  key: item.label,
172
- icon: icon,
173
- route: route,
172
+ icon:,
173
+ route:,
174
174
  children: item.children.map.with_index(&menu_item_to_hash),
175
- match_path: match_path,
175
+ match_path:,
176
176
  }
177
177
  end
178
178
 
@@ -39,7 +39,7 @@ create_file "lib/tasks/solidus_admin/tailwind.rake", <<~RUBY
39
39
  namespace :solidus_admin do
40
40
  namespace :tailwindcss do
41
41
  root = Rails.root
42
- tailwindcss = Tailwindcss::Commands.executable
42
+ tailwindcss = Tailwindcss::Ruby.executable
43
43
 
44
44
  tailwindcss_command = [
45
45
  tailwindcss,
@@ -33,7 +33,7 @@ namespace :solidus_admin do
33
33
  DummyApp::Application.root.join("app/assets/stylesheets/solidus_admin/application.tailwind.css")
34
34
  )
35
35
 
36
- tailwindcss = Tailwindcss::Commands.executable
36
+ tailwindcss = Tailwindcss::Ruby.executable
37
37
 
38
38
  tailwindcss_command = [
39
39
  tailwindcss,
@@ -19,7 +19,7 @@ module SolidusAdmin
19
19
  end
20
20
 
21
21
  def find_row(text)
22
- find('table tbody tr', text: text)
22
+ find('table tbody tr', text:)
23
23
  end
24
24
 
25
25
  def find_row_checkbox(text)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusAdmin
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.2"
5
5
  end
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
22
22
  s.metadata["changelog_uri"] = "https://github.com/solidusio/solidus/releases?q=%22solidus_admin%2Fv0%22&expanded=true"
23
23
 
24
24
  s.files = `git ls-files -z`.split("\x0").reject do |f|
25
- f.match(%r{^(spec|script)/})
25
+ f.match(%r{^(spec|bin)/})
26
26
  end + ["app/assets/builds/solidus_admin/tailwind.css"]
27
27
 
28
- s.required_ruby_version = '>= 3.0.0'
28
+ s.required_ruby_version = '>= 3.1.0'
29
29
  s.required_rubygems_version = '>= 1.8.23'
30
30
 
31
31
  s.add_dependency 'geared_pagination', '~> 1.1'