Skip to content

Commit

Permalink
Namespace routes to our controllers
Browse files Browse the repository at this point in the history
For the transition process between the two promotion systems, we want
the admins to still have access to the legacy promotions. Prior to this
commit, this access was thwarted as we used the exact same paths as core
Solidus. This adds an extra `friendly/` to the path, so that the paths
can be distinguished. This in turn revealed we have to use the right
routing proxy for the promotions controller, otherwise we'd be sent to
actions in the Solidus world.
  • Loading branch information
mamhoff committed Oct 4, 2023
1 parent c516b62 commit c522cd6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def load_data
def location_after_save
solidus_friendly_promotions.edit_admin_promotion_url(@promotion)
end

def routes_proxy
solidus_friendly_promotions
end
end
end
end
16 changes: 9 additions & 7 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

SolidusFriendlyPromotions::Engine.routes.draw do
namespace :admin do
resources :promotion_categories, except: [:show]
scope :friendly do
resources :promotion_categories, except: [:show]

resources :promotions do
resources :promotion_rules
resources :promotion_actions
resources :promotion_codes, only: [:index, :new, :create]
resources :promotion_code_batches, only: [:index, :new, :create] do
get "/download", to: "promotion_code_batches#download", defaults: {format: "csv"}
resources :promotions do
resources :promotion_rules
resources :promotion_actions
resources :promotion_codes, only: [:index, :new, :create]
resources :promotion_code_batches, only: [:index, :new, :create] do
get "/download", to: "promotion_code_batches#download", defaults: {format: "csv"}
end
end
end
end
Expand Down

0 comments on commit c522cd6

Please sign in to comment.