Use a different controller for investment audits
The same way we do for milestones. We also make the code more consistent since the view was already in a separate folder.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Admin::BudgetInvestmentAuditsController < Admin::BaseController
|
||||
def show
|
||||
investment = Budget::Investment.find(params[:budget_investment_id])
|
||||
@audit = investment.audits.find(params[:id])
|
||||
|
||||
render "admin/audits/show"
|
||||
end
|
||||
end
|
||||
@@ -9,7 +9,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
has_orders %w[oldest], only: [:show, :edit]
|
||||
has_filters %w[all], only: [:index, :toggle_selection]
|
||||
|
||||
before_action :load_budget, except: :audit
|
||||
before_action :load_budget
|
||||
before_action :load_investment, only: [:show, :edit, :update, :toggle_selection]
|
||||
before_action :load_ballot, only: [:show, :index]
|
||||
before_action :parse_valuation_filters
|
||||
@@ -60,11 +60,6 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
load_investments
|
||||
end
|
||||
|
||||
def audit
|
||||
@audit = Audited::Audit.find(params[:id])
|
||||
render "admin/audits/show"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_comments
|
||||
|
||||
2
app/models/audit.rb
Normal file
2
app/models/audit.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Audit < Audited::Audit
|
||||
end
|
||||
@@ -35,7 +35,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("shared.show"),
|
||||
admin_audit_path(audit),
|
||||
polymorphic_path([:admin, *resource_hierarchy_for(audit)]),
|
||||
class: "button hollow primary" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
3
config/initializers/audited.rb
Normal file
3
config/initializers/audited.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
Audited.config do |config|
|
||||
config.audit_class = ::Audit
|
||||
end
|
||||
@@ -13,6 +13,8 @@ module ActionDispatch::Routing::UrlFor
|
||||
[*resource_hierarchy_for(resource.milestoneable), resource]
|
||||
when "ProgressBar"
|
||||
[*resource_hierarchy_for(resource.progressable), resource]
|
||||
when "Audit"
|
||||
[*resource_hierarchy_for(resource.auditable), resource]
|
||||
when "Legislation::Annotation"
|
||||
[resource.draft_version.process, resource.draft_version, resource]
|
||||
when "Legislation::Proposal", "Legislation::Question", "Legislation::DraftVersion"
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace :admin do
|
||||
resources :budget_investments, only: [:index, :show, :edit, :update] do
|
||||
member { patch :toggle_selection }
|
||||
|
||||
resources :audits, only: :show, controller: "budget_investment_audits"
|
||||
resources :milestones, controller: "budget_investment_milestones"
|
||||
resources :progress_bars, except: :show, controller: "budget_investment_progress_bars"
|
||||
end
|
||||
@@ -250,8 +251,6 @@ namespace :admin do
|
||||
get "download_settings/:resource", to: "download_settings#edit", as: "edit_download_settings"
|
||||
put "download_settings/:resource", to: "download_settings#update", as: "update_download_settings"
|
||||
|
||||
get "/admin/audits/:id", to: "budget_investments#audit", as: "audit"
|
||||
|
||||
resources :local_census_records
|
||||
namespace :local_census_records do
|
||||
resources :imports, only: [:new, :create, :show]
|
||||
|
||||
Reference in New Issue
Block a user