Skip to content

Commit

Permalink
Move angular-templates route and controller into Web engine
Browse files Browse the repository at this point in the history
The route and controller were in the main app and the views in the engine, with this commit they stay all inside the engine
This is done to keep it simple and remove the unnecessary dependency between main app and engine
If we use this mechanism in the future for other things in the main app or other engines, we can find a way to extract/abstract this
  • Loading branch information
luisramos0 committed Sep 26, 2018
1 parent b1c7e6c commit 9211053
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
5 changes: 0 additions & 5 deletions app/controllers/angular_templates_controller.rb

This file was deleted.

2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@
get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop'
get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL

get "/angular-templates/:id", to: "angular_templates#show", constraints: { name: %r{[\/\w\.]+} }

namespace :api do
resources :enterprises do
post :update_image, on: :member
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Web
class AngularTemplatesController < ApplicationController
helper Web::Engine.helpers

def show
render params[:id].to_s, layout: nil
end
end
end
2 changes: 2 additions & 0 deletions engines/web/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
resource :consent, only: [:show, :create, :destroy], controller: "cookies_consent"
end
end

get "/angular-templates/:id", to: "angular_templates#show", constraints: { name: %r{[\/\w\.]+} }
end

0 comments on commit 9211053

Please sign in to comment.