mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Show conference changelog
Use load_and_authorize_resource in versions controlller Add conference specifc route to revision history page Users with role can view revision_history only for the versions they have access to Handle versions where conference_id is not set (records before papertrail was introduced)
This commit is contained in:
parent
5985daf677
commit
68788ce9fc
13 changed files with 240 additions and 141 deletions
|
|
@ -98,25 +98,6 @@ module ApplicationHelper
|
|||
.reverse.sub(',', ' dna ').reverse
|
||||
end
|
||||
|
||||
# Recieves a model_name and id
|
||||
# Returns nil if model_name is invalid
|
||||
# Returns object in its current state if its alive
|
||||
# Otherwise Returns object state just before deletion
|
||||
def current_or_last_object_state(model_name, id)
|
||||
return nil unless id.present? && model_name.present?
|
||||
begin
|
||||
object = model_name.constantize.find_by(id: id)
|
||||
rescue NameError
|
||||
return nil
|
||||
end
|
||||
|
||||
if object.nil?
|
||||
object_last_version = PaperTrail::Version.where(item_type: model_name, item_id: id).last
|
||||
object = object_last_version.reify if object_last_version
|
||||
end
|
||||
object
|
||||
end
|
||||
|
||||
def normalize_array_length(hashmap, length)
|
||||
hashmap.each do |_, value|
|
||||
if value.length < length
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue