Skip to content

Commit

Permalink
allow record_revision(s)_path methods to accept params that can be pa…
Browse files Browse the repository at this point in the history
…ssed to the routes
  • Loading branch information
caitmich committed Oct 18, 2024
1 parent 91c4718 commit e734f92
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/helpers/revisions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module RevisionsHelper
# any month (because the specs will look for e.g. "Jul 9", with two spaces,
# but the whitespace in the browser will be collapsed so the actual page
# will say "Jul 9" with one space.)
DATE_FORMAT = "%b %-d %Y, %-l:%M%P"
DATE_FORMAT = '%b %-d %Y, %-l:%M%P'

def record_revisions_path(record)
def record_revisions_path(record, params = {})
# Note - 'when Issue' must go ABOVE 'when Note', or all Issues will match
# 'Note' before they can reach 'Issue' FIXME - ISSUE/NOTE INHERITANCE
case record
Expand All @@ -21,7 +21,7 @@ def record_revisions_path(record)
end
end

def record_revision_path(record, revision)
def record_revision_path(record, revision, params = {})
# Note - 'when Issue' must go ABOVE 'when Note', or all Issues will match
# 'Note' before they can reach 'Issue' FIXME - ISSUE/NOTE INHERITANCE
case record
Expand All @@ -39,14 +39,14 @@ def record_revision_path(record, revision)
def link_to_conflicting_revision(record, revision)
time = revision.created_at.strftime(DATE_FORMAT)
text = if revision.whodunnit
if revision.whodunnit == user_for_paper_trail
"Your update at #{time}"
else
"Update by #{revision.whodunnit} at #{time}"
end
else
"Update by unknown user at #{time}"
end
if revision.whodunnit == user_for_paper_trail
"Your update at #{time}"
else
"Update by #{revision.whodunnit} at #{time}"
end
else
"Update by unknown user at #{time}"
end
link_to text, record_revision_path(record, revision)
end
end

0 comments on commit e734f92

Please sign in to comment.