osem-fcy/app/views/admin/versions/_object_desc_and_link.html.haml

200 lines
7.2 KiB
Text
Raw Normal View History

- conference = Conference.find_by(id: version.conference_id)
2017-07-13 21:33:02 +03:00
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
2016-08-18 01:28:40 +05:30
- case version.item_type
- when 'UsersRole'
- users_role = current_or_last_object_state(version.item_type, version.item_id)
2017-07-13 21:33:02 +03:00
- role = Role.find_by(id: users_role.role_id) if users_role
role
= link_if_alive version, role.try(:name), admin_conference_role_path(role.try(:name) || ' ', conference_short_title), conference
= version.event == 'create' ? 'to' : 'from'
2017-07-13 21:33:02 +03:00
user
= link_to_user(users_role.user_id)
2016-08-18 01:28:40 +05:30
- when 'Subscription', 'Registration'
2017-07-13 21:33:02 +03:00
conference
= link_to_conference(version.conference_id)
2016-08-18 01:28:40 +05:30
- when '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)
2016-08-18 01:28:40 +05:30
- case commercial.commercialable_type
- when 'Event'
2017-07-13 21:33:02 +03:00
commercial in event
- if commercialable && conference
= link_to commercialable.title,
2017-07-13 21:33:02 +03:00
admin_conference_program_event_path(conference, commercialable.id)
- else
= commercialable.title
= "with ID #{commercialable.id}"
- when 'Venue'
2017-07-13 21:33:02 +03:00
commercial in venue
- if commercialable && conference
= link_to commercialable.name,
2017-07-13 21:33:02 +03:00
edit_admin_conference_venue_path(conference_short_title,
commercialable.id, anchor: 'commercials-content')
- else
= commercialable.name
= "with ID #{commercialable.id}"
- when 'Conference'
2017-07-13 21:33:02 +03:00
commercial in conference
- if commercialable
= link_to commercialable.short_title,
2017-07-13 21:33:02 +03:00
admin_conference_commercials_path(commercialable.short_title)
- else
= commercialable.short_title
= "with ID #{commercialable.id}"
2016-08-18 01:28:40 +05:30
- when 'EventsRegistration', 'Comment', 'Vote', 'Event'
2017-07-13 21:33:02 +03:00
event
2016-08-18 01:28:40 +05:30
- object = current_or_last_object_state(version.item_type, version.item_id)
- 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'),
2017-07-13 21:33:02 +03:00
admin_conference_program_event_path(conference_short_title, event_id)
2016-08-18 01:28:40 +05:30
- when 'Target'
2017-07-13 21:33:02 +03:00
target
2016-08-18 01:28:40 +05:30
- target = current_or_last_object_state(version.item_type, version.item_id)
2017-07-13 21:33:02 +03:00
= link_if_alive version, target.to_s, admin_conference_targets_path(conference_short_title), conference
2016-08-18 01:28:40 +05:30
- when 'EventSchedule'
- event_schedule = current_or_last_object_state(version.item_type, version.item_id)
2016-08-18 00:32:16 +05:30
event
= link_to (current_or_last_object_state('Event', event_schedule.event_id).try(:title) || 'deleted'),
2017-07-13 21:33:02 +03:00
admin_conference_program_event_path(conference_short_title, event_schedule.event_id)
2016-08-18 00:32:16 +05:30
in
= link_to "Schedule #{event_schedule.schedule_id}",
2017-07-13 21:33:02 +03:00
admin_conference_schedule_path(conference_short_title, event_schedule.schedule_id)
2016-08-18 01:28:40 +05:30
- when 'Schedule'
= link_if_alive version, "Schedule #{version.item_id}",
2017-07-13 21:33:02 +03:00
admin_conference_schedule_path(conference_short_title, version.item_id),
conference
2016-08-18 01:28:40 +05:30
- when 'Conference'
2017-07-13 21:33:02 +03:00
conference
= link_to_conference(version.item_id)
2016-08-18 01:28:40 +05:30
- when 'RegistrationPeriod'
= link_if_alive version, 'registration period',
2017-07-13 21:33:02 +03:00
admin_conference_registration_period_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Contact'
= link_if_alive version, 'contact details',
2017-07-13 21:33:02 +03:00
edit_admin_conference_contact_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Program'
= link_if_alive version, 'program',
2017-07-13 21:33:02 +03:00
admin_conference_program_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Cfp'
2017-07-13 21:33:02 +03:00
cfp for
- cfp = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, cfp.cfp_type,
2017-07-13 21:33:02 +03:00
admin_conference_program_cfp_path(conference_short_title, version.item_id),
conference
2016-08-18 01:28:40 +05:30
- when 'Track'
2017-07-13 21:33:02 +03:00
track
2016-08-18 01:28:40 +05:30
- track = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, track.name,
2017-07-13 21:33:02 +03:00
admin_conference_program_track_path(conference_short_title, track.try(:short_name)),
conference
2016-08-18 01:28:40 +05:30
- when 'EventType'
2017-07-13 21:33:02 +03:00
event type
2016-08-18 01:28:40 +05:30
- event_type = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, event_type.title,
2017-07-13 21:33:02 +03:00
admin_conference_program_event_types_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Role'
2017-07-13 21:33:02 +03:00
role
2016-08-18 01:28:40 +05:30
- role = current_or_last_object_state(version.item_type, version.item_id)
2017-07-13 21:33:02 +03:00
- role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: version.item_id).last.changeset[:name].second
= link_if_alive version, role_name,
admin_conference_role_path(conference_short_title, role_name),
conference
2016-08-18 01:28:40 +05:30
- when 'Venue'
2017-07-13 21:33:02 +03:00
venue
2016-08-18 01:28:40 +05:30
- venue = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, venue.name,
2017-07-13 21:33:02 +03:00
admin_conference_venue_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Lodging'
2017-07-13 21:33:02 +03:00
lodging
2016-08-18 01:28:40 +05:30
- lodging = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, lodging.name,
2017-07-13 21:33:02 +03:00
admin_conference_lodgings_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Room'
2017-07-13 21:33:02 +03:00
room
2016-08-18 01:28:40 +05:30
- room = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, room.name,
2017-07-13 21:33:02 +03:00
admin_conference_venue_rooms_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Sponsor'
2017-07-13 21:33:02 +03:00
sponsor
2016-08-18 01:28:40 +05:30
- sponsor = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, sponsor.name,
2017-07-13 21:33:02 +03:00
admin_conference_sponsors_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'SponsorshipLevel'
2017-07-13 21:33:02 +03:00
sponsorship level
2016-08-18 01:28:40 +05:30
- sponsorship_level = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, sponsorship_level.title,
2017-07-13 21:33:02 +03:00
admin_conference_sponsorship_levels_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'Ticket'
2017-07-13 21:33:02 +03:00
ticket
2016-08-18 01:28:40 +05:30
- ticket = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, ticket.title,
2017-07-13 21:33:02 +03:00
admin_conference_ticket_path(conference_short_title, version.item_id),
conference
2016-08-18 01:28:40 +05:30
- when 'Campaign'
2017-07-13 21:33:02 +03:00
campaign
2016-08-18 01:28:40 +05:30
- campaign = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, campaign.name,
2017-07-13 21:33:02 +03:00
admin_conference_campaigns_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'DifficultyLevel'
2017-07-13 21:33:02 +03:00
difficulty level
2016-08-18 01:28:40 +05:30
- difficulty_level = current_or_last_object_state(version.item_type, version.item_id)
= link_if_alive version, difficulty_level.title,
2017-07-13 21:33:02 +03:00
admin_conference_program_difficulty_level_path(conference_short_title, version.item_id),
conference
2016-08-18 01:28:40 +05:30
- when 'Splashpage'
= link_if_alive version, 'splashpage',
2017-07-13 21:33:02 +03:00
admin_conference_splashpage_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'EmailSettings'
= link_if_alive version, 'email settings',
2017-07-13 21:33:02 +03:00
admin_conference_emails_path(conference_short_title),
conference
2016-08-18 01:28:40 +05:30
- when 'User'
- if version.event == 'update'
2017-07-13 21:33:02 +03:00
user
= link_to_user(version.item_id)
- unless %w(Conference Subscription Registration User).include?(version.item_type)
2017-07-13 21:33:02 +03:00
in conference
= link_to_conference(version.conference_id)