app/views/admin/versions/_object_desc_and_link.html.haml
:ruby
object = current_or_last_object_state(version.item_type, version.item_id)
unless version.item_type == 'Role' || version.item_type == 'UsersRole'
conference = Conference.find_by(id: version.conference_id)
conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
end
- case version.item_type
- when 'UsersRole'
- role = current_or_last_object_state('Role', object.role_id)
- role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: object.role_id).last.changeset[:name].second
role
- conference = Conference.find_by(id: version.conference_id)
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
= link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference
= version.event == 'create' ? 'to' : 'from'
user
= link_to_user(object.user_id)
- when 'Subscription', 'Registration'
conference
= link_to_conference(version.conference_id)
- when 'Commercial'
- commercialable = current_or_last_object_state(object.commercialable_type, object.commercialable_id)
- case object.commercialable_type
- when 'Event'
commercial in event
- if commercialable && conference
= link_to commercialable.title,
admin_conference_program_event_path(conference, commercialable.id)
- else
= commercialable.title
= "with ID #{commercialable.id}"
- when 'Venue'
commercial in venue
- if commercialable && conference
= link_to commercialable.name,
edit_admin_conference_venue_path(conference_short_title,
commercialable.id, anchor: 'commercials-content')
- else
= commercialable.name
= "with ID #{commercialable.id}"
- when 'Conference'
commercial in conference
- if commercialable
= link_to commercialable.short_title,
admin_conference_commercials_path(commercialable.short_title)
- else
= commercialable.short_title
= "with ID #{commercialable.id}"
- when 'EventsRegistration', 'Comment', 'Vote', 'Event'
event
- event_id = object.try(:event_id) || object.try(:commentable_id) || object.id
= link_to (current_or_last_object_state('Event', event_id).try(:title) || 'deleted event'),
admin_conference_program_event_path(conference_short_title, event_id)
- when 'EventSchedule'
event
= link_to (current_or_last_object_state('Event', object.event_id).try(:title) || 'deleted'),
admin_conference_program_event_path(conference_short_title, object.event_id)
in
= link_to "Schedule #{version.item.schedule_id}",
admin_conference_schedule_path(conference_short_title, version.item.schedule_id)
- when 'Schedule'
= link_if_alive version, "Schedule #{version.item_id}",
admin_conference_schedule_path(conference_short_title, version.item_id),
conference
- when 'Conference'
conference
= link_to_conference(version.item_id)
- when 'RegistrationPeriod'
= link_if_alive version, 'registration period',
admin_conference_registration_period_path(conference_short_title),
conference
- when 'Contact'
= link_if_alive version, 'contact details',
edit_admin_conference_contact_path(conference_short_title),
conference
- when 'Booth'
= t 'booth'
= link_if_alive version, object.title,
admin_conference_booth_path(conference_id: Conference.find(version.conference_id).short_title, id: version.item_id ),
conference
- when 'Program'
= link_if_alive version, 'program',
admin_conference_program_path(conference_short_title),
conference
- when 'Cfp'
cfp for
= link_if_alive version, object.cfp_type,
admin_conference_program_cfp_path(conference_short_title, version.item_id),
conference
- when 'Track'
track
= link_if_alive version, object.name,
admin_conference_program_track_path(conference_short_title, object.try(:short_name)),
conference
- when 'EventType'
event type
= link_if_alive version, object.title,
admin_conference_program_event_types_path(conference_short_title),
conference
- when 'Role'
role
- role_name = object.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: version.item_id).last.changeset[:name].second
- conference = Conference.find_by(id: version.conference_id)
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
= link_if_alive version, role_name,
admin_conference_role_path(conference_short_title, role_name), conference
- when 'Venue'
venue
= link_if_alive version, object.name,
admin_conference_venue_path(conference_short_title),
conference
- when 'Lodging'
lodging
= link_if_alive version, object.name,
admin_conference_lodgings_path(conference_short_title),
conference
- when 'Room'
room
= link_if_alive version, object.name,
admin_conference_venue_rooms_path(conference_short_title),
conference
- when 'Sponsor'
sponsor
= link_if_alive version, object.name,
admin_conference_sponsors_path(conference_short_title),
conference
- when 'SponsorshipLevel'
sponsorship level
= link_if_alive version, object.title,
admin_conference_sponsorship_levels_path(conference_short_title),
conference
- when 'Ticket'
ticket
= link_if_alive version, object.title,
admin_conference_ticket_path(conference_short_title, version.item_id),
conference
- when 'DifficultyLevel'
difficulty level
= link_if_alive version, object.title,admin_conference_program_difficulty_levels_path(conference_short_title), conference
- when 'Splashpage'
= link_if_alive version, 'splashpage',
admin_conference_splashpage_path(conference_short_title),
conference
- when 'EmailSettings'
= link_if_alive version, 'email settings',
admin_conference_emails_path(conference_short_title),
conference
- when 'User'
- if version.event == 'update'
user
= link_to_user(version.item_id)
- unless %w(Conference Subscription Registration User).include?(version.item_type)
- if version.item_type == 'Commercial'
- commercial = current_or_last_object_state(version.item_type, version.item_id)
- commercialable = current_or_last_object_state(commercial.commercialable_type, commercial.commercialable_id)
- unless commercial.commercialable_type == 'Conference'
in conference
= link_to_conference(version.conference_id)
- else
in conference
= link_to_conference(version.conference_id)