Class: SolidusAdmin::Configuration
- Inherits:
-
Spree::Preferences::Configuration
- Object
- Spree::Preferences::Configuration
- SolidusAdmin::Configuration
- Defined in:
- lib/solidus_admin/configuration.rb
Overview
Configuration for the admin interface.
Ensure requiring this file after the Rails application has been created, as some defaults depend on the application context.
Constant Summary collapse
- ComponentNotFoundError =
Class.new(NameError)
- ENGINE_ROOT =
File.("#{__dir__}/../..")
Instance Attribute Summary collapse
-
#order_search_key ⇒ String
The key that specifies the attributes for searching orders within the admin interface.
-
#orders_per_page ⇒ Integer
The number of orders to display per page in the admin interface.
-
#product_search_key ⇒ String
The key to use when searching for products in the admin interface.
-
#products_per_page ⇒ Integer
The number of products to display per page in the admin interface.
Instance Method Summary collapse
- #components ⇒ Object
-
#menu_items ⇒ Array<Hash>
Gives access to the main navigation configuration.
- #storefront_product_path(product) ⇒ Object
Instance Attribute Details
#order_search_key ⇒ String
The key that specifies the attributes for searching orders within the admin interface. This preference controls which attributes of an order are used in search queries. By default, it is set to ‘number_shipments_number_or_bill_address_name_or_email_order_promotions_promotion_code_value_cont’, enabling a search across order number, shipment number, billing address name, email, and promotion code value.
81 |
# File 'lib/solidus_admin/configuration.rb', line 81 preference :order_search_key, :string, default: :number_or_shipments_number_or_bill_address_name_or_email_or_order_promotions_promotion_code_value_cont |
#orders_per_page ⇒ Integer
Returns The number of orders to display per page in the admin interface. This preference determines the pagination limit for the order listing. The default value is fetched from the Spree core configuration and currently set to 15.
|
# File 'lib/solidus_admin/configuration.rb', line 72
|
#product_search_key ⇒ String
Returns The key to use when searching for products in the admin interface. This preference determines the product attribute to use for search. By default, it is set to ‘name_or_variants_including_master_sku_cont’, meaning it will search by product name or product variants sku.
94 |
# File 'lib/solidus_admin/configuration.rb', line 94 preference :product_search_key, :string, default: :name_or_variants_including_master_sku_cont |
#products_per_page ⇒ Integer
Returns The number of products to display per page in the admin interface. This preference determines the pagination limit for the product listing. The default value is fetched from the Spree core configuration and currently set to 10.
|
# File 'lib/solidus_admin/configuration.rb', line 87
|
Instance Method Details
#components ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/solidus_admin/configuration.rb', line 189 def components @components ||= Hash.new do |_h, k| "solidus_admin/#{k}/component".classify.constantize rescue NameError prefix = "#{ENGINE_ROOT}/app/components/solidus_admin/" suffix = "/component.rb" dictionary = Dir["#{prefix}**#{suffix}"].map { _1.delete_prefix(prefix).delete_suffix(suffix) } corrections = DidYouMean::SpellChecker.new(dictionary: dictionary).correct(k.to_s) raise ComponentNotFoundError, "Unknown component #{k}#{DidYouMean.formatter.(corrections)}" end end |
#menu_items ⇒ Array<Hash>
Gives access to the main navigation configuration
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/solidus_admin/configuration.rb', line 116 def @menu_items ||= [ { key: "orders", route: -> { spree.admin_orders_path }, icon: "inbox-line", position: 10 }, { key: "products", route: :products_path, icon: "price-tag-3-line", position: 20, children: [ { key: "products", route: -> { solidus_admin.products_path }, match_path: -> { _1.start_with?("/admin/products/") }, position: 0 }, { key: "option_types", route: -> { spree.admin_option_types_path }, position: 10 }, { key: "property_types", route: -> { spree.admin_properties_path }, position: 20 }, { key: "taxonomies", route: -> { spree.admin_taxonomies_path }, position: 30 }, { key: "taxons", route: -> { spree.admin_taxons_path }, position: 40 } ] }, { key: "promotions", route: -> { spree.admin_promotions_path }, icon: "megaphone-line", position: 30, }, { key: "stock", route: -> { spree.admin_stock_items_path }, icon: "stack-line", position: 40 }, { key: "users", route: -> { spree.admin_users_path }, icon: "user-line", position: 50 }, { key: "settings", route: -> { spree.admin_stores_path }, icon: "settings-line", position: 60, } ] end |
#storefront_product_path(product) ⇒ Object
100 101 102 |
# File 'lib/solidus_admin/configuration.rb', line 100 def storefront_product_path(product) storefront_product_path_proc.call(product) end |