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?
|
||||
if @conference_id.nil?
|
||||
@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
|
||||
@versions = PaperTrail::Version.where(['conference_id IN (?)', (@conf_ids_for_organizer & [@conference_id])]).
|
||||
where.not(item_type: 'User')
|
||||
authorize! :index, PaperTrail::Version.new(conference_id: @conference_id)
|
||||
@versions = PaperTrail::Version.where(conference_id: @conference_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,7 @@
|
|||
|
||||
.dropdown.pull-right
|
||||
%button.btn.btn-success.dropdown-toggle{'data-toggle' => 'dropdown', type: 'button'}
|
||||
- if @conference_id.nil?
|
||||
All Conferences & Users
|
||||
- elsif @conf_ids_for_organizer.include?(@conference_id)
|
||||
= Conference.find(@conference_id).short_title
|
||||
- else
|
||||
Filter By Conference
|
||||
= @conference_id.nil? ? 'All Conferences & Users' : Conference.find(@conference_id).short_title
|
||||
%span.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to 'All Conferences & Users', admin_revision_history_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue