Add filters to SDG relations controller
We have three filters: "pending", "all" and "reviewed". Where "pending" is the default one. Now we are rendering the `shared/_filter_subnav` partial we need to stub helper methods defined at the controller and the helper methods that rely on the request parameters to test the component.
This commit is contained in:
@@ -2,8 +2,12 @@ class SDGManagement::RelationsController < SDGManagement::BaseController
|
||||
before_action :check_feature_flags
|
||||
before_action :load_record, only: [:edit, :update]
|
||||
|
||||
FILTERS = %w[pending_sdg_review all sdg_reviewed].freeze
|
||||
has_filters FILTERS, only: :index
|
||||
|
||||
def index
|
||||
@records = relatable_class
|
||||
.send(@current_filter)
|
||||
.accessible_by(current_ability)
|
||||
.by_goal(params[:goal_code])
|
||||
.by_target(params[:target_code])
|
||||
|
||||
Reference in New Issue
Block a user