Skip to content

Commit

Permalink
Refactor page_display_options
Browse files Browse the repository at this point in the history
  • Loading branch information
tumido committed Jan 22, 2018
1 parent 35485ed commit 95b4525
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions app/controllers/miq_request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,11 @@ def request_copy
end

def page_display_options
resource_type = request_tab_type
time_period = 7
if is_approver && (!@sb[:prov_options] || (@sb[:prov_options] && !@sb[:prov_options].key?(resource_type.to_sym)))
gv_options = {:named_scope => prov_scope(:resource_type => resource_type, :time_period => time_period)}
elsif @sb[:prov_options] && @sb[:prov_options].key?(resource_type.to_sym) # added this here so grid can be drawn when page redraws, when there were no records on initial load.
prov_set_default_options if @sb[:def_prov_options][:applied_states].blank? && !params[:button] == "apply" # no filter statuses selected, setting to default
gv_options = {:named_scope => prov_scope(@sb[:def_prov_options][resource_type.to_sym])}
if @sb[:prov_options] && @sb[:prov_options].key?(request_tab_type.to_sym)
{:named_scope => prov_scope(@sb[:def_prov_options][request_tab_type.to_sym])}
else
gv_options = {:named_scope => prov_scope(:resource_type => resource_type,
:time_period => time_period,
:requester_id => current_user.try(:id))}
{}
end
gv_options
end

# Show the main Requests list view
Expand Down

0 comments on commit 95b4525

Please sign in to comment.