From de5795910fab345791d4a059553a133ee21d6be2 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 9 Oct 2016 05:20:46 +0300 Subject: [PATCH] Reimplement the personal profile UI --- app/views/management/events/_speaker.slim | 10 ++- .../personal_profiles/show.html.slim | 84 ++++++++++++------- config/locales/bg.yml | 3 + 3 files changed, 65 insertions(+), 32 deletions(-) diff --git a/app/views/management/events/_speaker.slim b/app/views/management/events/_speaker.slim index 78fb987..ddfb0ed 100644 --- a/app/views/management/events/_speaker.slim +++ b/app/views/management/events/_speaker.slim @@ -41,7 +41,7 @@ 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'] + =< link_to icon('user-plus', t('.create_profile')), new_management_conference_personal_profile_path(conference_id: @conference.id, user_id: speaker.id), class: ['btn', 'btn-primary', 'btn-xs'] - if speaker.events_participated_in.where.not(id: @event.id).any? h4 = t '.previous_event_propositions' @@ -74,4 +74,10 @@ .panel-footer .text-right .btn-group.btn-group-sm - = action_buttons @conference, personal_profile, [:show, :edit] + - if personal_profile.conference == @conference + = action_buttons @conference, personal_profile, [:show, :edit] + - else + = link_to [:management, @conference, :personal_profiles, {personal_profile: {user_id: speaker.id}}], class: ['btn', 'btn-primary'], title: t('actions.clone.title', model: PersonalProfile.model_name.human), method: :post do + => icon('clone') + = link_to [:new, :management, @conference, :personal_profile, {user_id: speaker.id}], class: ['btn', 'btn-primary'], title: t('actions.create.title', model: PersonalProfile.model_name.human) do + => icon('user-plus') diff --git a/app/views/management/personal_profiles/show.html.slim b/app/views/management/personal_profiles/show.html.slim index 303c3a6..19bf206 100644 --- a/app/views/management/personal_profiles/show.html.slim +++ b/app/views/management/personal_profiles/show.html.slim @@ -2,38 +2,62 @@ = @profile.name .row - .speaker-profile - .panel.panel-default - .panel-heading - h1.panel-title - = @profile.name - = link_to icon(:edit), [:edit, :management, @conference, @profile], class: 'btn btn-xs btn-danger pull-right' - .panel-body - .center + .col-lg-12 + h1.page-header + = PersonalProfile.model_name.human.mb_chars.capitalize + +.panel.panel-default + .panel-body + .media + .media-left.hidden-sm.hidden-xs = image_tag @profile.picture.medium.url, class: "profile-image" - - if @profile.organisation.present? - div - => icon :briefcase - = @profile.organisation - div.social - = link_to "mailto://#{@user.email}" - = icon :envelope - - if @profile.github.present? - = link_to "https://github.com/#{@profile.github}" - = icon :github - - if @profile.twitter.present? - = link_to "https://twitter.com/#{@profile.twitter}" - = icon :twitter - - hr - + .media-body + .text-center.visible-sm.visible-xs + = image_tag @profile.picture.medium.url, class: "profile-image img-thumbnail" + h4.media-heading + = @profile.name + hr h4 = PersonalProfile.human_attribute_name(:biography) = simple_format @profile.biography - - h4 = t :contacts + h4 = t '.contacts' + - if @profile.organisation.present? + p = icon :briefcase, @profile.organisation - if @profile.twitter.present? - p #{icon :twitter} @#{@profile.twitter} + p = icon :twitter, "@#{@profile.twitter}" + - if @profile.github.present? + p = icon :github, @profile.github - if @profile.public_email.present? - p #{icon :envelope} #{@profile.public_email} (#{t(:public)}) - p #{icon :envelope} #{@user.email} (#{t(:private)}) - p #{glyph :phone} #{Phony.format(@profile.mobile_phone, format: :international)} + p = icon :envelope, "#{@profile.public_email} (#{PersonalProfile.human_attribute_name(:public_email).mb_chars.downcase})" + p = icon :envelope, "#{@user.email} (#{User.human_attribute_name(:email).mb_chars.downcase})" + + - if @user.events_participated_in.any? + h4 = t '.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 + - @user.events_participated_in.order(created_at: :desc).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] + + + .panel-footer + .text-right + .btn-group.btn-group-sm + = action_buttons @conference, @profile, [:edit, :destroy] diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 54fa11d..e10e63a 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -6,6 +6,9 @@ bg: total: "%{current} от общо %{total}" create: successfully_created: "Профилът беше създаден успешно." + show: + contacts: "Данни за контакт" + event_propositions: "Предложения за събития" conferences: show: summary: 'Обобщение'