From 4721b6bcdad3f0a16e7ad8013aa64bceaf7277bd Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 9 Oct 2016 00:22:50 +0300 Subject: [PATCH] Extend Management::EventsController#show views --- app/models/user.rb | 2 + app/views/management/events/_speaker.slim | 94 +++++++++++++++++----- app/views/management/events/show.html.slim | 65 ++++++++------- config/locales/bg.yml | 12 +++ 4 files changed, 121 insertions(+), 52 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index f414e79..6734fe3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 = {}) diff --git a/app/views/management/events/_speaker.slim b/app/views/management/events/_speaker.slim index dd043c7..af1138d 100644 --- a/app/views/management/events/_speaker.slim +++ b/app/views/management/events/_speaker.slim @@ -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-body - .center - = image_tag personal_profile.picture.medium.url, class: "profile-image" - hr - - if personal_profile.organisation.present? - p #{icon :briefcase} @#{personal_profile.organisation} +.panel.panel-default + .panel-body + .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 + h4 = PersonalProfile.human_attribute_name(:biography) + = simple_format personal_profile.biography - h4 = PersonalProfile.human_attribute_name(:biography) - = simple_format personal_profile.biography + 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 :contacts - - 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)} + 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] diff --git a/app/views/management/events/show.html.slim b/app/views/management/events/show.html.slim index d5f79c6..ab19df0 100644 --- a/app/views/management/events/show.html.slim +++ b/app/views/management/events/show.html.slim @@ -1,33 +1,38 @@ -.row - 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]) +- content_for :title + = t('.review', event_type: @event.event_type.name.mb_chars.downcase, event_title: @event.title) - 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 - .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 diff --git a/config/locales/bg.yml b/config/locales/bg.yml index dc4ed06..02e0dfe 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -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: "Име"