Extend Management::EventsController#show views

This commit is contained in:
Petko Bordjukov 2016-10-09 00:22:50 +03:00
parent a19efc6c50
commit 4721b6bcda
4 changed files with 121 additions and 52 deletions

View File

@ -9,6 +9,8 @@ class User < ActiveRecord::Base
has_many :workshops
has_many :propositions, foreign_key: :proposer_id
has_many :events, through: :propositions, source: :proposable, source_type: 'Event'
has_many :participations, foreign_key: :participant_id
has_many :events_participated_in, through: :participations, source: :event
has_many :volunteerships, foreign_key: :volunteer_id
def find_or_build_personal_profile(conference, params = {})

View File

@ -1,26 +1,76 @@
- personal_profile = speaker.personal_profile(@conference) || speaker.personal_profiles.last
- if personal_profile.present?
.speaker-profile
.panel.panel-default
.panel-heading
h1.panel-title
= personal_profile.name
= link_to icon(:edit), [:edit, :management, @conference, personal_profile], class: 'btn btn-xs btn-danger pull-right'
.panel.panel-default
.panel-body
.center
.media
.media-left.hidden-sm.hidden-xs
- if personal_profile.present?
= image_tag personal_profile.picture.medium.url, class: "profile-image"
- else
= icon :user, class: 'fa-5x'
.media-body
.text-center.visible-sm.visible-xs
- if personal_profile.present?
= image_tag personal_profile.picture.medium.url, class: "profile-image img-thumbnail"
- else
= icon :user, class: 'fa-5x'
- if personal_profile.present?
h4.media-heading
= personal_profile.name
- unless personal_profile.conference == @conference
small<
| (
= t('.profile_from', conference: personal_profile.conference.title)
| )
hr
- if personal_profile.organisation.present?
p #{icon :briefcase} @#{personal_profile.organisation}
h4 = PersonalProfile.human_attribute_name(:biography)
= simple_format personal_profile.biography
h4 = t :contacts
h4 = t '.contacts'
- if personal_profile.organisation.present?
p #{icon :briefcase} @#{personal_profile.organisation}
- if personal_profile.twitter.present?
p #{icon :twitter} @#{personal_profile.twitter}
- if personal_profile.public_email.present?
p #{icon :envelope} #{personal_profile.public_email} (#{t(:public)})
p #{icon :envelope} #{speaker.email} (#{t(:private)})
p #{glyph :phone} #{Phony.format(personal_profile.mobile_phone, format: :international)}
- else
h4.media-heading
= speaker.email
hr
p
= t('.no_profile')
=< link_to icon(:plus, t('.create_profile')), new_management_conference_personal_profile_path(conference_id: @conference.id, user_id: speaker.id), class: ['btn', 'btn-primary', 'btn-xs']
h4 = t '.previous_event_propositions'
table.table.table-striped.table-hover.record-table
thead
tr
th
= Event.human_attribute_name :title
th
= Event.human_attribute_name :conference
th
= Event.human_attribute_name :status
th
tbody
- speaker.events_participated_in.each do |event|
tr
td = event.title
td = event.conference.title
td
span class="label label-lg label-#{proposition_status_class(@event.status)}"
= icon(proposition_status_glyph(@event.status), t("activerecord.attributes.proposition.statuses.#{@event.status}"))
td.actions
.btn-group.btn-group-sm
= action_buttons event.conference, event, [:show]
- if personal_profile.present?
.panel-footer
.text-right
.btn-group.btn-group-sm
= action_buttons @conference, personal_profile, [:show, :edit]

View File

@ -1,4 +1,8 @@
- content_for :title
= t('.review', event_type: @event.event_type.name.mb_chars.downcase, event_title: @event.title)
.row
.col-xs-12
h1.page-header
= @event.title
small<
@ -19,7 +23,8 @@
=< t "status.#{status}"
div.btn-group.btn-group-sm
= action_buttons(@conference, @event, [:index, :edit])
.row
.col-xs-12
h3 = Event.human_attribute_name :abstract
p = simple_format @event.abstract
@ -28,6 +33,6 @@
- if @event.notes.present?
h3 = Event.human_attribute_name :notes
p = simple_format @event.notes
.row
.col-lg-12
.col-xs-12
h3 = Event.human_attribute_name :participants
= render partial: 'speaker', collection: @event.participants

View File

@ -2,8 +2,17 @@ bg:
management:
conferences:
show:
summary: 'Обобщение'
cfp_status: 'Състояние на CFP:'
events:
speaker:
no_profile: 'Този потребител няма въведени профили в системата.'
profile_from: "профил от %{conference}"
create_profile: "Създай нов профил"
previous_event_propositions: 'Предишни предложения за събития'
contacts: "Информация за контакт"
show:
review: "Преглед на %{event_type} „%{event_title}“"
index:
all: "Всички"
event:
@ -56,6 +65,8 @@ bg:
planned_cfp_end_date: "Планиран край на зова за лектори"
title: "Заглавие"
event:
conference: "Конференция"
status: "Състояние"
abstract: "Резюме"
agreement: "Съгласен(на) съм"
description: "Описание"
@ -66,6 +77,7 @@ bg:
title: "Заглавие"
track: "Поток от лекции"
user: "Лектор"
participants: "Участници"
event_type:
description: "Описание"
name: "Име"