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 :workshops
has_many :propositions, foreign_key: :proposer_id has_many :propositions, foreign_key: :proposer_id
has_many :events, through: :propositions, source: :proposable, source_type: 'Event' 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 has_many :volunteerships, foreign_key: :volunteer_id
def find_or_build_personal_profile(conference, params = {}) def find_or_build_personal_profile(conference, params = {})

View File

@ -1,26 +1,76 @@
- personal_profile = speaker.personal_profile(@conference) || speaker.personal_profiles.last - personal_profile = speaker.personal_profile(@conference) || speaker.personal_profiles.last
- if personal_profile.present? .panel.panel-default
.speaker-profile .panel-body
.panel.panel-default .media
.panel-heading .media-left.hidden-sm.hidden-xs
h1.panel-title - if personal_profile.present?
= personal_profile.name = image_tag personal_profile.picture.medium.url, class: "profile-image"
= link_to icon(:edit), [:edit, :management, @conference, personal_profile], class: 'btn btn-xs btn-danger pull-right' - else
.panel-body = icon :user, class: 'fa-5x'
.center .media-body
= image_tag personal_profile.picture.medium.url, class: "profile-image" .text-center.visible-sm.visible-xs
hr - if personal_profile.present?
- if personal_profile.organisation.present? = image_tag personal_profile.picture.medium.url, class: "profile-image img-thumbnail"
p #{icon :briefcase} @#{personal_profile.organisation} - 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
h4 = PersonalProfile.human_attribute_name(:biography)
= simple_format personal_profile.biography
h4 = PersonalProfile.human_attribute_name(:biography) h4 = t '.contacts'
= simple_format personal_profile.biography - 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 :contacts h4 = t '.previous_event_propositions'
- if personal_profile.twitter.present? table.table.table-striped.table-hover.record-table
p #{icon :twitter} @#{personal_profile.twitter} thead
- if personal_profile.public_email.present? tr
p #{icon :envelope} #{personal_profile.public_email} (#{t(:public)}) th
p #{icon :envelope} #{speaker.email} (#{t(:private)}) = Event.human_attribute_name :title
p #{glyph :phone} #{Phony.format(personal_profile.mobile_phone, format: :international)} 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,33 +1,38 @@
.row - content_for :title
h1.page-header = t('.review', event_type: @event.event_type.name.mb_chars.downcase, event_title: @event.title)
= @event.title
small<
= @event.subtitle
h4
= t 'events.metadata', type: @event.event_type.name, language: t("locales.#{@event.language}").mb_chars.downcase, length: @event.length
.pull-right.heading-actions
.dropdown>
button class="btn btn-sm dropdown-toggle btn-#{proposition_status_class(@event.status)}" type="button" data-toggle="dropdown" title="#{t "status.#{@event.status}"}"
= icon(proposition_status_glyph(@event.status))
span.caret<
ul.dropdown-menu
- Proposition.statuses.each do |(status, _)|
- next if status == @event.status
li
= link_to [:management, @conference, @event.proposition, proposition: {status: status}], method: :patch do
= proposition_status_icon(status)
=< t "status.#{status}"
div.btn-group.btn-group-sm
= action_buttons(@conference, @event, [:index, :edit])
h3 = Event.human_attribute_name :abstract
p = simple_format @event.abstract
h3 = Event.human_attribute_name :description
p = simple_format @event.description
- if @event.notes.present?
h3 = Event.human_attribute_name :notes
p = simple_format @event.notes
.row .row
.col-lg-12 .col-xs-12
h1.page-header
= @event.title
small<
= @event.subtitle
h4
= t 'events.metadata', type: @event.event_type.name, language: t("locales.#{@event.language}").mb_chars.downcase, length: @event.length
.pull-right.heading-actions
.dropdown>
button class="btn btn-sm dropdown-toggle btn-#{proposition_status_class(@event.status)}" type="button" data-toggle="dropdown" title="#{t "status.#{@event.status}"}"
= icon(proposition_status_glyph(@event.status))
span.caret<
ul.dropdown-menu
- Proposition.statuses.each do |(status, _)|
- next if status == @event.status
li
= link_to [:management, @conference, @event.proposition, proposition: {status: status}], method: :patch do
= proposition_status_icon(status)
=< 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
h3 = Event.human_attribute_name :description
p = simple_format @event.description
- if @event.notes.present?
h3 = Event.human_attribute_name :notes
p = simple_format @event.notes
.col-xs-12
h3 = Event.human_attribute_name :participants
= render partial: 'speaker', collection: @event.participants = render partial: 'speaker', collection: @event.participants

View File

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