From 650751e8757882117419c9221f64065e708e2e09 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Tue, 28 Apr 2020 15:03:51 +0200 Subject: [PATCH] Adjust profile statistics layout - Instead of being in the sidebar, they are now present as a tabbed navigation - The questionbox is now present on any layout --- app/views/layouts/user/profile.haml | 5 +++-- app/views/tabs/_profile.haml | 6 ++++++ app/views/user/_profile_info.html.haml | 1 - app/views/user/_stats.html.haml | 21 --------------------- app/views/user/questions.haml | 2 -- app/views/user/show.haml | 1 - app/views/user/show_follow.haml | 2 -- 7 files changed, 9 insertions(+), 29 deletions(-) create mode 100644 app/views/tabs/_profile.haml delete mode 100644 app/views/user/_stats.html.haml diff --git a/app/views/layouts/user/profile.haml b/app/views/layouts/user/profile.haml index de62b178..3c0edd84 100644 --- a/app/views/layouts/user/profile.haml +++ b/app/views/layouts/user/profile.haml @@ -5,10 +5,11 @@ .row #profile-info.col-md-3.col-xs-12.col-sm-4.j2-col-reset = render 'user/profile_info' - .hidden-xs= render 'shared/links' + .d-none.d-sm-block= render 'shared/links' .col-md-9.col-xs-12.col-sm-8.j2-col-reset + = render "questionbox" + = render "tabs/profile" = yield - .visible-xs= render 'shared/links' - if user_signed_in? = render 'modal/group' - if current_user.mod? and @user != current_user diff --git a/app/views/tabs/_profile.haml b/app/views/tabs/_profile.haml new file mode 100644 index 00000000..f49f17dd --- /dev/null +++ b/app/views/tabs/_profile.haml @@ -0,0 +1,6 @@ +.card + .list-group.list-group-horizontal-sm.text-center + = list_group_item "Answers", show_user_profile_path(@user.screen_name), badge: @user.answered_count + = list_group_item "Questions", show_user_questions_path(@user.screen_name), badge: @user.asked_count + = list_group_item "Followers", show_user_followers_path(@user.screen_name), badge: @user.follower_count + = list_group_item "Following", show_user_friends_path(@user.screen_name), badge: @user.friend_count \ No newline at end of file diff --git a/app/views/user/_profile_info.html.haml b/app/views/user/_profile_info.html.haml index ca00a8a3..29a833e7 100644 --- a/app/views/user/_profile_info.html.haml +++ b/app/views/user/_profile_info.html.haml @@ -37,4 +37,3 @@ %i.fa.fa-location-arrow = @user.location = render 'user/actions', user: @user, type: :follower -= render 'user/stats', user: @user diff --git a/app/views/user/_stats.html.haml b/app/views/user/_stats.html.haml deleted file mode 100644 index 3e2c81ca..00000000 --- a/app/views/user/_stats.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -.card.profile--panel#profile-stats - .card-header Stats - .card-body - .row - .col-md-6.col-sm-6.col-xs-6 - %a{href: show_user_followers_path(@user.screen_name)} - %h4.entry-text#follower-count= @user.follower_count - %h6.entry-subtext= t('views.general.follower').pluralize(@user.follower_count) - .col-md-6.col-sm-6.col-xs-6 - %a{href: show_user_friends_path(@user.screen_name)} - %h4.entry-text#friend-count= @user.friend_count - %h6.entry-subtext= t('views.general.following') - .row - .col-md-6.col-sm-6.col-xs-6 - %a{href: show_user_questions_path(@user.screen_name)} - %h4.entry-text#asked-count= @user.asked_count - %h6.entry-subtext= t('views.general.question').pluralize(@user.asked_count) - .col-md-6.col-sm-6.col-xs-6 - %a{href: show_user_profile_path(@user.screen_name)} - %h4.entry-text#answered-count= @user.answered_count - %h6.entry-subtext= t('views.general.answer').pluralize(@user.answered_count) diff --git a/app/views/user/questions.haml b/app/views/user/questions.haml index 17e137ef..f606d663 100644 --- a/app/views/user/questions.haml +++ b/app/views/user/questions.haml @@ -1,5 +1,3 @@ -%h1.j2-lh.hidden-xs= @title -%h1.visible-xs= @title #questions - @questions.each do |q| = render 'shared/question', q: q, type: nil diff --git a/app/views/user/show.haml b/app/views/user/show.haml index aaa34263..964e7918 100644 --- a/app/views/user/show.haml +++ b/app/views/user/show.haml @@ -1,6 +1,5 @@ - no_header = unless @user.profile_header.exists? then "profile--no-header" else "" end .profile--panel-push-inner.hidden-xs{class: no_header} -= render 'questionbox' - unless @user.banned? #answers - @answers.each do |a| diff --git a/app/views/user/show_follow.haml b/app/views/user/show_follow.haml index fe026028..19d0938a 100644 --- a/app/views/user/show_follow.haml +++ b/app/views/user/show_follow.haml @@ -1,5 +1,3 @@ -%h1.j2-lh.hidden-xs= @title -%h1.visible-xs= @title #users - @users.each do |user| .col-md-4.col-sm-6.col-xs-12