mirror of
https://github.com/internetee/registry.git
synced 2025-08-12 20:49:36 +02:00
Fix domain history ordering and current state display
- Ensure "Current state" (pending/current domain) is always shown as the first row in domain history. - Sort post-update domain states by updated_at descending for correct chronological order. - Fix version navigation and sidebar highlighting for current state in domain version show view. - Unify logic for displaying domain and contact data in both history and single version views. - Remove legacy ObjectVersionsParser usage and handle nil @version cases gracefully. - Refactor partials and controller logic to ensure all rows in history reflect the correct post-update state.
This commit is contained in:
parent
0b13cfbe0f
commit
9e5b2743a3
6 changed files with 74 additions and 45 deletions
|
@ -54,10 +54,22 @@ module Admin
|
|||
def versions
|
||||
@domain = Domain.where(id: params[:domain_id]).includes({ versions: :item }).first
|
||||
@versions = @domain.versions
|
||||
@last_version = @versions.last
|
||||
@old_versions = Kaminari.paginate_array(@versions.not_creates.reverse)
|
||||
.page(params[:page])
|
||||
.per(DEFAULT_VERSIONS_PER_PAGE)
|
||||
|
||||
@post_update_domains = []
|
||||
old_versions_arr = @old_versions.to_a
|
||||
old_versions_arr.each_with_index do |version, idx|
|
||||
next_version = old_versions_arr[idx - 1] # reverse order!
|
||||
if next_version
|
||||
@post_update_domains << (next_version.reify || @domain)
|
||||
else
|
||||
@post_update_domains << @domain
|
||||
end
|
||||
end
|
||||
|
||||
@post_update_domains.sort_by! { |d| -d.updated_at.to_i }
|
||||
end
|
||||
|
||||
def download
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue