Display error if non existant conference's versions are queried
This commit is contained in:
parent
7cff5e0da6
commit
614da6003b
2 changed files with 6 additions and 8 deletions
|
|
@ -8,9 +8,12 @@ module Admin
|
||||||
@conference_id = params[:conference_id].to_i unless params[:conference_id].nil?
|
@conference_id = params[:conference_id].to_i unless params[:conference_id].nil?
|
||||||
if @conference_id.nil?
|
if @conference_id.nil?
|
||||||
@versions = PaperTrail::Version.where(["conference_id IN (?) OR item_type = 'User'", @conf_ids_for_organizer])
|
@versions = PaperTrail::Version.where(["conference_id IN (?) OR item_type = 'User'", @conf_ids_for_organizer])
|
||||||
|
elsif !Conference.exists?(id: @conference_id)
|
||||||
|
redirect_to admin_revision_history_path, error: "Conference with ID #{@conference_id} does not exist!"
|
||||||
|
return
|
||||||
else
|
else
|
||||||
@versions = PaperTrail::Version.where(['conference_id IN (?)', (@conf_ids_for_organizer & [@conference_id])]).
|
authorize! :index, PaperTrail::Version.new(conference_id: @conference_id)
|
||||||
where.not(item_type: 'User')
|
@versions = PaperTrail::Version.where(conference_id: @conference_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,7 @@
|
||||||
|
|
||||||
.dropdown.pull-right
|
.dropdown.pull-right
|
||||||
%button.btn.btn-success.dropdown-toggle{'data-toggle' => 'dropdown', type: 'button'}
|
%button.btn.btn-success.dropdown-toggle{'data-toggle' => 'dropdown', type: 'button'}
|
||||||
- if @conference_id.nil?
|
= @conference_id.nil? ? 'All Conferences & Users' : Conference.find(@conference_id).short_title
|
||||||
All Conferences & Users
|
|
||||||
- elsif @conf_ids_for_organizer.include?(@conference_id)
|
|
||||||
= Conference.find(@conference_id).short_title
|
|
||||||
- else
|
|
||||||
Filter By Conference
|
|
||||||
%span.caret
|
%span.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
%li= link_to 'All Conferences & Users', admin_revision_history_path
|
%li= link_to 'All Conferences & Users', admin_revision_history_path
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue