Display who added commercial for event
Activate versioning for tests The tests were failing because of the lack of versioning.By default, versioning is off for tests. As a result, here (app/views/proposal/_form.html.haml L43) commercial,versions.last returns nil as there are no versions.
This commit is contained in:
parent
8335aa8b43
commit
48828f8930
5 changed files with 14 additions and 11 deletions
|
|
@ -383,7 +383,7 @@ module ApplicationHelper
|
|||
reverse.sub(',', ' dna ').reverse
|
||||
end
|
||||
|
||||
def change_creator_link(user_id)
|
||||
def link_to_user(user_id)
|
||||
user = User.find_by(id: user_id)
|
||||
if user
|
||||
link_to user.name, admin_user_path(id: user_id)
|
||||
|
|
@ -479,16 +479,16 @@ module ApplicationHelper
|
|||
|
||||
def user_change_description(version)
|
||||
if version.event == 'create'
|
||||
change_creator_link(version.item_id) + ' signed up'
|
||||
link_to_user(version.item_id) + ' signed up'
|
||||
elsif version.event == 'update'
|
||||
if version.changeset.keys.include?('reset_password_sent_at')
|
||||
'Someone requested password reset of'
|
||||
elsif version.changeset.keys.include?('confirmed_at') && version.changeset['confirmed_at'][0].nil?
|
||||
(version.whodunnit.nil? ? change_creator_link(version.item_id) : change_creator_link(version.whodunnit)) + ' confirmed account of'
|
||||
(version.whodunnit.nil? ? link_to_user(version.item_id) : link_to_user(version.whodunnit)) + ' confirmed account of'
|
||||
elsif version.changeset.keys.include?('confirmed_at') && version.changeset['confirmed_at'][1].nil?
|
||||
change_creator_link(version.whodunnit) + ' unconfirmed account of'
|
||||
link_to_user(version.whodunnit) + ' unconfirmed account of'
|
||||
else
|
||||
change_creator_link(version.whodunnit) + " updated #{updated_attributes(version)} of"
|
||||
link_to_user(version.whodunnit) + " updated #{updated_attributes(version)} of"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
= version.id
|
||||
%td
|
||||
%p
|
||||
= change_creator_link(version.whodunnit)
|
||||
= link_to_user(version.whodunnit)
|
||||
|
||||
- if version.item_type == 'Event'
|
||||
= event_change_description(version)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
= version.id
|
||||
%td.col-md-9
|
||||
%p
|
||||
= change_creator_link(version.whodunnit) unless version.item_type == 'User'
|
||||
= link_to_user(version.whodunnit) unless version.item_type == 'User'
|
||||
|
||||
- case version.item_type
|
||||
- when 'Event'
|
||||
|
|
|
|||
|
|
@ -40,3 +40,6 @@
|
|||
- if can? :destroy, commercial
|
||||
= link_to 'Delete', conference_program_proposal_commercial_path(@conference.short_title, @event.id, commercial.id),
|
||||
:method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger'
|
||||
.text-right
|
||||
= "added by "
|
||||
= link_to_user(commercial.versions.last.whodunnit)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue