mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Whodunnit helper to distinguish user from epp_user
This commit is contained in:
parent
af97dadfca
commit
b5608c1394
6 changed files with 23 additions and 5 deletions
|
@ -3,6 +3,7 @@ class Epp::CommandsController < ApplicationController
|
|||
include Epp::DomainsHelper
|
||||
include Epp::ContactsHelper
|
||||
include Shared::UserStamper
|
||||
helper WhodunnitHelper
|
||||
|
||||
layout false
|
||||
|
||||
|
@ -35,4 +36,8 @@ class Epp::CommandsController < ApplicationController
|
|||
def update
|
||||
send("update_#{OBJECT_TYPES[params_hash['epp']['xmlns:ns2']]}")
|
||||
end
|
||||
|
||||
def user_for_paper_trail
|
||||
current_epp_user ? "#{current_epp_user.id}-EppUser" : nil
|
||||
end
|
||||
end
|
||||
|
|
13
app/helpers/whodunnit_helper.rb
Normal file
13
app/helpers/whodunnit_helper.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module WhodunnitHelper
|
||||
def link_to_whodunnit(whodunnit)
|
||||
return nil unless whodunnit
|
||||
if whodunnit.include?('-EppUser')
|
||||
user = EppUser.find(whodunnit)
|
||||
return link_to(user.username, admin_epp_user_path(user))
|
||||
end
|
||||
user = User.find(whodunnit)
|
||||
return link_to(user.username, admin_user_path(user))
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
return nil
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
%th{class: 'col-xs-2'}
|
||||
= t('shared.name')
|
||||
%th{class: 'col-xs-1'}
|
||||
= t('shared.contact_id')
|
||||
= t('shared.code')
|
||||
%th{class: 'col-xs-1'}
|
||||
= sort_link(@q, 'whodunnit', t('shared.whodunnit'))
|
||||
%th{class: 'col-xs-2'}
|
||||
|
@ -23,7 +23,7 @@
|
|||
%tr
|
||||
%td= contact.name #link_to(x, admin_contact_path(x))
|
||||
%td= contact.code #link_to(x, admin_contact_path(x))
|
||||
%td= version.whodunnit if version
|
||||
%td= link_to_whodunnit(version.whodunnit) if version
|
||||
%td= l(version.created_at, format: :short) if version
|
||||
.row
|
||||
.col-md-12
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
%tr
|
||||
%td= x.name #link_to(x, admin_contact_path(x))
|
||||
%td= x.code #link_to(x, admin_contact_path(x))
|
||||
%td= x.versions.last.whodunnit if x.versions.last
|
||||
%td= link_to_whodunnit(x.versions.last.whodunnit) if x.versions.last
|
||||
%td= x.versions.last.event if x.versions.last
|
||||
%td= l(x.versions.last.created_at, format: :short) if x.versions.last
|
||||
%td= link_to(t('shared.history'), admin_contact_version_path(x), class: 'btn btn-primary btn-xs')
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
%tr
|
||||
%td= domain.name #link_to(x, admin_contact_path(x))
|
||||
%td= domain.status #link_to(x, admin_contact_path(x))
|
||||
%td= version.whodunnit if version
|
||||
%td= link_to_whodunnit(version.whodunnit) if version
|
||||
%td= l(version.created_at, format: :short) if version
|
||||
.row
|
||||
.col-md-12
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
%td= domain.name
|
||||
%td= domain.registrar.name if domain.registrar
|
||||
%td= domain.owner_contact.name if domain.owner_contact
|
||||
%td= domain.versions.last.whodunnit if domain.versions.last
|
||||
%td= link_to_whodunnit(domain.versions.last.whodunnit) if domain.versions.last
|
||||
%td= domain.versions.last.event if domain.versions.last
|
||||
%td= l(domain.versions.last.created_at, format: :short) if domain.versions.last
|
||||
%td= link_to(t('shared.history'), admin_domain_version_path(domain), class: 'btn btn-primary btn-xs')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue