diff --git a/app/controllers/house_ads_controller.rb b/app/controllers/house_ads_controller.rb index b596180..510b62a 100644 --- a/app/controllers/house_ads_controller.rb +++ b/app/controllers/house_ads_controller.rb @@ -9,6 +9,10 @@ module ::AdPlugin ) end + def show + render_json_dump(house_ad: HouseAd.find(params[:id])&.to_hash) + end + def create ad = HouseAd.create(house_ad_params) if ad.valid? diff --git a/assets/javascripts/discourse/adplugin-route-map.js.es6 b/assets/javascripts/discourse/adplugin-route-map.js.es6 index bd72f49..e68edbc 100644 --- a/assets/javascripts/discourse/adplugin-route-map.js.es6 +++ b/assets/javascripts/discourse/adplugin-route-map.js.es6 @@ -2,7 +2,7 @@ export default { resource: "admin.adminPlugins", path: "/plugins", map() { - this.route("houseAds", { path: "/house-ads" }, function() { + this.route("houseAds", { path: "/adplugin/house_ads" }, function() { this.route("index", { path: "/" }); this.route("show", { path: "/:ad_id" }); }); diff --git a/plugin.rb b/plugin.rb index 2f6e622..20228d6 100755 --- a/plugin.rb +++ b/plugin.rb @@ -54,7 +54,7 @@ after_initialize do AdPlugin::Engine.routes.draw do root to: 'house_ads#index' - resources :house_ads, only: [:index, :create, :update, :destroy] + resources :house_ads, only: [:index, :show, :create, :update, :destroy] resources :house_ad_settings, only: [:update] end