From 35aa246df4c2b1b2d36478b06e10481896759d84 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Wed, 1 May 2019 01:48:44 +0300 Subject: [PATCH] Overhaul speaker info in event show --- app/assets/images/user-secret-solid.svg | 37 ++++ app/assets/stylesheets/management/_users.scss | 2 + app/views/management/events/_speaker.slim | 201 ++++++++++-------- app/views/management/events/show.html.slim | 64 +++--- .../personal_profiles/show.html.slim | 5 +- config/locales/management.bg.yml | 7 + 6 files changed, 200 insertions(+), 116 deletions(-) create mode 100644 app/assets/images/user-secret-solid.svg diff --git a/app/assets/images/user-secret-solid.svg b/app/assets/images/user-secret-solid.svg new file mode 100644 index 0000000..026c4cb --- /dev/null +++ b/app/assets/images/user-secret-solid.svg @@ -0,0 +1,37 @@ + + diff --git a/app/assets/stylesheets/management/_users.scss b/app/assets/stylesheets/management/_users.scss index 3af1336..08e5ac6 100644 --- a/app/assets/stylesheets/management/_users.scss +++ b/app/assets/stylesheets/management/_users.scss @@ -1,8 +1,10 @@ .panel .panel-image img { display: block; max-width: 100%; + max-height: 250px; height: auto; margin-right: auto; margin-left: auto; width: 100%; + object-fit: cover; } diff --git a/app/views/management/events/_speaker.slim b/app/views/management/events/_speaker.slim index a849de4..534947f 100644 --- a/app/views/management/events/_speaker.slim +++ b/app/views/management/events/_speaker.slim @@ -1,96 +1,123 @@ - personal_profile = speaker.personal_profile(@conference) || speaker.personal_profiles.last -.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 = t '.contacts' +.row + .col-sm-4 + .panel.panel-default + - if personal_profile.present? + .panel-image + = image_tag personal_profile.picture.url + .panel-body + .media + .media-body + h4.media-heading + = personal_profile.name + hr + = simple_format(truncate(personal_profile.biography, omission: '... ', length: 300) { link_to(t('.continue'), [:management, @conference, personal_profile])}) + ul.list-group - if personal_profile.organisation.present? - p #{icon :briefcase} @#{personal_profile.organisation} + li.list-group-item + h5.list-group-item-heading = PersonalProfile.human_attribute_name :organisation + p.list-group-item-text = 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} (#{PersonalProfile.human_attribute_name(:public_email).mb_chars.downcase}) - p #{icon :envelope} #{speaker.email} (#{PersonalProfile.human_attribute_name(:email).mb_chars.downcase}) - 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('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'] + li.list-group-item + h5.list-group-item-heading = PersonalProfile.human_attribute_name :twitter + p.list-group-item-text + = link_to "@#{personal_profile.twitter}", "https://twitter.com/#{personal_profile.twitter}", target: '_blank' + - if personal_profile.github.present? + li.list-group-item + h5.list-group-item-heading = PersonalProfile.human_attribute_name :github + p.list-group-item-text + = link_to personal_profile.github, "https://github.com/#{personal_profile.github}", target: '_blank' + .panel-footer + .text-right + .btn-group.btn-group-sm + - 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') + - else + .panel-image + = image_tag 'user-secret-solid.svg' + .panel-body + .media + .media-body + h4.media-heading + speaker.email + hr + p = t '.the_participant_has_not_created_a_profile' + ul.list-group + li.list-group-item + h5.list-group-item-heading = t '.private_email' + p.list-group-item-text = speaker.email + .col-sm-8 + .row + .col-md-6 + .panel.panel-info + .panel-heading + .row + .col-xs-3 + = icon 'files-o', '', class: 'fa-5x' + .col-xs-9.text-right + .huge + = speaker.events_participated_in.size + div + = Event.model_name.human(count: speaker.events_participated_in.size) + .col-md-6 + .panel class="panel-#{rating_label_color(speaker.average_rating || 5)}" title=human_rating(speaker.average_rating) + .panel-heading + .row + .col-xs-3 + = icon 'star', '', class: 'fa-5x' + .col-xs-9.text-right + .huge + = number_with_precision(speaker.average_rating, precision: 2, strip_insignificant_zeros: true) || '–' + div + = User.human_attribute_name(:average_rating).downcase + + .row + .col-xs-12 + h4 = t '.other_event_propositions' - if speaker.events_participated_in.where.not(id: @event.id).any? - h4 = t '.previous_event_propositions' - table.table.table-striped.table-hover.record-table - thead - tr - th - = Event.human_attribute_name :title - th.text-center - = t '.rating' - th.text-center - = Event.human_attribute_name :rank - th - = Event.human_attribute_name :conference - th - = Event.human_attribute_name :status - th - - tbody - - speaker.events_participated_in.where.not(id: @event.id).order(created_at: :desc).each do |event| + .panel.panel-default + table.table.table-striped.table-hover.record-table + thead tr - td = event.title - td.text-center - - if event.rated? - .large - .label class="label-#{rating_label_color(event.average_rating)}" - = number_with_precision event.average_rating, precision: 2, strip_insignificant_zeros: true - td.text-center - - if event.ranked? + th.main + = Event.human_attribute_name :title + th.text-center + = Event.human_attribute_name :rating + th.text-center.hidden-md.hidden-sm.hidden-xs + = Event.human_attribute_name :rank + th.hidden-md.hidden-sm.hidden-xs + = Event.human_attribute_name :conference + th.hidden-md.hidden-sm.hidden-xs + = Event.human_attribute_name :status + th.hidden-md.hidden-sm.hidden-xs + + tbody + - speaker.events_participated_in.where.not(id: @event.id).order(created_at: :desc).each do |event| + tr + td = event.title + td.text-center + - if event.rated? .large - .label.label-info = event.rank - 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}")) + .label class="label-#{rating_label_color(event.average_rating)}" + = number_with_precision event.average_rating, precision: 2, strip_insignificant_zeros: true + td.text-center.hidden-md.hidden-sm.hidden-xs + - if event.ranked? + .large + .label.label-info = event.rank + td.hidden-md.hidden-sm.hidden-xs = event.conference.title + td.hidden-md.hidden-sm.hidden-xs + 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 - - 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') + td.actions + .btn-group.btn-group-sm + = action_buttons event.conference, event, [:show] + - else + p = t '.no_other_event_propositions' diff --git a/app/views/management/events/show.html.slim b/app/views/management/events/show.html.slim index 59a00bf..2b1afe0 100644 --- a/app/views/management/events/show.html.slim +++ b/app/views/management/events/show.html.slim @@ -65,38 +65,42 @@ h3 = Event.human_attribute_name :participants = render partial: 'speaker', collection: @event.participants -.row - .col-xs-12 - h3 = Event.human_attribute_name :feedbacks - - if @event.rated? - .row - .col-md-10 - .panel.panel-default - .panel-heading = t('.comments') - - if @event.feedbacks_with_comment.size > 0 - table.table.table-striped - tbody - = render partial: '/management/shared/feedback', collection: @event.feedbacks_with_comment - - else - .panel-body - = t ('.no_comments_received') - .col-md-2 - .panel.panel-info - .panel-heading - = t '.average_grade' - .panel-body.text-right - .huge - = number_with_precision(@event.average_rating, precision: 2, strip_insignificant_zeros: true) || '–' - = t('.total_feedback_grades', total_grades: @event.feedbacks.count, count: @event.feedbacks.count) - - else - p = t '.no_feedback_received' +- if @conference.start_date.past? || @event.rated? + .row + .col-xs-12 + h3 = Event.human_attribute_name :feedbacks + - if @event.rated? + .row + .col-md-10 + .panel.panel-default + .panel-heading = t('.comments') + - if @event.feedbacks_with_comment.size > 0 + table.table.table-striped + tbody + = render partial: '/management/shared/feedback', collection: @event.feedbacks_with_comment + - else + .panel-body + = t ('.no_comments_received') + .col-md-2 + .panel.panel-info + .panel-heading + = t '.average_grade' + .panel-body.text-right + .huge + = number_with_precision(@event.average_rating, precision: 2, strip_insignificant_zeros: true) || '–' + = t('.total_feedback_grades', total_grades: @event.feedbacks.count, count: @event.feedbacks.count) + - else + p = t '.no_feedback_received' - if @conference.has_vote_results? or @conference.has_voting_endpoint? .row .col-xs-12 h2 - = t '.conflicts' + - if @conference.start_date.future? + = t '.conflicts' + - else + = t '.top_conflicts' small< = t '.between_approved_events' .panel.panel-default table.table.table-striped.table-hover.record-table @@ -105,13 +109,17 @@ tr th.text-right = t '.percent' - th + th.main = Event.model_name.human.mb_chars.capitalize th tbody - if @conference.has_vote_results? - if @conference.approved_events.count > 2 - - @event.conflict_counts.where(right_id: @conference.approved_events.pluck(:id)).includes(:right).each do |conflict_count| + - if @conference.start_date.future? + - conflict_counts = @event.conflict_counts.where(right_id: @conference.approved_events.pluck(:id)).includes(:right) + - else + - conflict_counts = @event.conflict_counts.where(right_id: @conference.approved_events.pluck(:id)).includes(:right).limit(5) + - conflict_counts.each do |conflict_count| - conflict_percent = Rational(conflict_count.number_of_conflicts, @conference.number_of_ballots_cast) tr td.text-right diff --git a/app/views/management/personal_profiles/show.html.slim b/app/views/management/personal_profiles/show.html.slim index 81f6822..d5cd02a 100644 --- a/app/views/management/personal_profiles/show.html.slim +++ b/app/views/management/personal_profiles/show.html.slim @@ -11,7 +11,6 @@ .panel-image = image_tag @profile.picture.url .panel-body - .media .media-body h4.media-heading @@ -19,6 +18,10 @@ hr = simple_format @profile.biography ul.list-group + - if @profile.mobile_phone.present? + li.list-group-item + h5.list-group-item-heading = PersonalProfile.human_attribute_name :mobile_phone + p.list-group-item-text = Phony.format(@profile.mobile_phone, format: :international) - if @profile.organisation.present? li.list-group-item h5.list-group-item-heading = PersonalProfile.human_attribute_name :organisation diff --git a/config/locales/management.bg.yml b/config/locales/management.bg.yml index 9b7d2c2..62506e9 100644 --- a/config/locales/management.bg.yml +++ b/config/locales/management.bg.yml @@ -30,6 +30,13 @@ bg: no_feedback_received: Все още няма обратна връзка no_comments_received: Все още няма коментари comments: Коментари + top_conflicts: Топ 5 конфликти + speaker: + continue: Още... + other_event_propositions: Други предложени събития + the_participant_has_not_created_a_profile: Потребителят не си е създал профил в системата. + private_email: Личен e-mail + no_other_event_propositions: Няма други предложени събития ratings: poor: Слаб average: Среден