diff --git a/app/views/layouts/user/profile.haml b/app/views/layouts/user/profile.haml index c551a4c3..51a553a2 100644 --- a/app/views/layouts/user/profile.haml +++ b/app/views/layouts/user/profile.haml @@ -3,7 +3,7 @@ .container .row .col-md-3.col-xs-12.col-sm-4 - = render 'user/profile' + = render 'user/profile', user: @user .d-none.d-sm-block= render 'shared/links' .col-md-9.col-xs-12.col-sm-8 = render "questionbox" @@ -13,4 +13,4 @@ = render 'modal/group' - if current_user.mod? and @user != current_user = render 'modal/privileges' - = render 'modal/ban' \ No newline at end of file + = render 'modal/ban' diff --git a/app/views/user/_actions.haml b/app/views/user/_actions.haml index f257fb09..f03e1db4 100644 --- a/app/views/user/_actions.haml +++ b/app/views/user/_actions.haml @@ -1,32 +1,30 @@ .profile__actions - - if user_signed_in? - - type ||= :nil - - if user == current_user - %a.btn.btn-dark.btn-block{href: edit_user_profile_path} Edit profile + - type ||= :nil + - if user_signed_in? && user == current_user + %a.btn.btn-dark.btn-block{ href: edit_user_profile_path } Edit profile + - elsif user_signed_in? + - if current_user.following? user + %button.btn.btn-primary.btn-block{ type: :button, name: 'user-action', data: { action: :unfollow, type: type, target: user.screen_name } } + = t 'views.actions.unfollow' - else - - if current_user.following? user - %button#editprofile.btn.btn-primary.btn-block{type: :button, name: 'user-action', data: { action: :unfollow, type: type, target: user.screen_name }} - = t 'views.actions.unfollow' - - else - %button#editprofile.btn.btn-primary.btn-block{type: :button, name: 'user-action', data: { action: :follow, type: type, target: user.screen_name }} - = t 'views.actions.follow' - - unless user == current_user - .btn-group.btn-block - %button.btn.btn-light.btn-block.btn-sm.dropdown-toggle{data: { toggle: :dropdown }, aria: { expanded: :false }} - = t 'views.actions.title' - %span.caret - .dropdown-menu - %a.dropdown-item.d-block.d-sm-none{href: '#', data: { target: "#modal-group-memberships", toggle: :modal }} - %i.fa.fa-users - = t 'views.actions.group' - %a.dropdown-item{href: '#', data: { action: 'report-user', target: user.screen_name }} - %i.fa.fa-exclamation-triangle - = t 'views.actions.report' - - if current_user.mod? - %a.dropdown-item{href: '#', data: { target: "#modal-privileges", toggle: :modal }} - %i.fa.fa-wrench - = raw t('views.actions.privilege', user: user.screen_name) - - unless user.has_role?(:administrator) - %a.dropdown-item{href: '#', data: { target: "#modal-ban", toggle: :modal }} - %i.fa.fa-ban - = t 'views.actions.ban' + %button.btn.btn-primary.btn-block{ type: :button, name: 'user-action', data: { action: :follow, type: type, target: user.screen_name } } + = t 'views.actions.follow' + .btn-group.btn-block + %button.btn.btn-light.btn-block.btn-sm.dropdown-toggle{ data: { toggle: :dropdown }, aria: { expanded: false } } + = t 'views.actions.title' + %span.caret + .dropdown-menu + %a.dropdown-item.d-block.d-sm-none{ href: '#', data: { target: '#modal-group-memberships', toggle: :modal } } + %i.fa.fa-users + = t 'views.actions.group' + %a.dropdown-item{ href: '#', data: { action: 'report-user', target: user.screen_name } } + %i.fa.fa-exclamation-triangle + = t 'views.actions.report' + - if current_user.mod? + %a.dropdown-item{ href: '#', data: { target: '#modal-privileges', toggle: :modal } } + %i.fa.fa-wrench + = raw t('views.actions.privilege', user: user.screen_name) + - unless user.has_role?(:administrator) + %a.dropdown-item{ href: '#', data: { target: '#modal-ban', toggle: :modal } } + %i.fa.fa-ban + = t 'views.actions.ban' diff --git a/app/views/user/_profile.haml b/app/views/user/_profile.haml index 55783cd2..235fe788 100644 --- a/app/views/user/_profile.haml +++ b/app/views/user/_profile.haml @@ -1,38 +1,38 @@ .card#profile - %img.profile__avatar{src: @user.profile_picture.url(:large)} + %img.profile__avatar{ src: user.profile_picture.url(:large) } .card-body .profile__name - - unless @user.display_name.blank? + - unless user.display_name.blank? .profile__display-name - = @user.display_name + = user.display_name .profile__screen-name - = @user.screen_name + = user.screen_name .profile__badge-container - - if @user.banned? + - if user.banned? %span.badge.badge-dark %i.fa.fa-fw.fa-ban = t 'views.user.title.banned' - - if @user.following? current_user + - if user.following? current_user .badge.badge-light = t 'views.user.follows_you' - if user_signed_in? && current_user.has_role?(:administrator) - - if @user.has_role?(:administrator) + - if user.has_role?(:administrator) %span.badge.badge-danger %i.fa.fa-fw.fa-flask = t 'views.user.title.admin' - - if @user.has_role?(:moderator) + - if user.has_role?(:moderator) %span.badge.badge-success %i.fa.fa-fw.fa-users = t 'views.user.title.moderator' - - unless @user.bio.blank? + - unless user.bio.blank? .profile__biography - = markdown @user.bio - - unless @user.website.blank? + = markdown user.bio + - unless user.website.blank? .profile__website %i.fa.fa-fw.fa-globe - %a{href: @user.website}= @user.display_website - - unless @user.location.blank? + %a{ href: user.website }= user.display_website + - unless user.location.blank? .profile__location %i.fa.fa-fw.fa-location-arrow - = @user.location - = render 'user/actions', user: @user, type: :follower + = user.location + = render 'user/actions', user: user, type: :follower diff --git a/app/views/user/data.haml b/app/views/user/data.haml index f2093748..8672ac12 100644 --- a/app/views/user/data.haml +++ b/app/views/user/data.haml @@ -1,4 +1,4 @@ -= render "settings/data" += render 'settings/data' -- provide(:title, generate_title("Your Data")) -- parent_layout "user/settings" +- provide(:title, generate_title('Your Data')) +- parent_layout 'user/settings' diff --git a/app/views/user/edit.haml b/app/views/user/edit.haml index 43a76cb4..fd160c64 100644 --- a/app/views/user/edit.haml +++ b/app/views/user/edit.haml @@ -1,4 +1,4 @@ -= render "settings/profile" += render 'settings/profile' -- provide(:title, generate_title("Profile Settings")) -- parent_layout "user/settings" \ No newline at end of file +- provide(:title, generate_title('Profile Settings')) +- parent_layout 'user/settings' diff --git a/app/views/user/edit_privacy.haml b/app/views/user/edit_privacy.haml index c422fb37..d806ff57 100644 --- a/app/views/user/edit_privacy.haml +++ b/app/views/user/edit_privacy.haml @@ -1,4 +1,4 @@ -= render "settings/privacy" += render 'settings/privacy' -- provide(:title, generate_title("Privacy Settings")) -- parent_layout "user/settings" +- provide(:title, generate_title('Privacy Settings')) +- parent_layout 'user/settings' diff --git a/app/views/user/edit_theme.haml b/app/views/user/edit_theme.haml index 38fec528..e4060ce2 100644 --- a/app/views/user/edit_theme.haml +++ b/app/views/user/edit_theme.haml @@ -1,4 +1,4 @@ -= render "settings/theme" += render 'settings/theme' -- provide(:title, generate_title("Theme Settings")) -- parent_layout "user/settings" \ No newline at end of file +- provide(:title, generate_title('Theme Settings')) +- parent_layout 'user/settings' diff --git a/app/views/user/export.haml b/app/views/user/export.haml index bc025d90..7e3acde2 100644 --- a/app/views/user/export.haml +++ b/app/views/user/export.haml @@ -1,4 +1,4 @@ -= render "settings/export" += render 'settings/export' -- provide(:title, generate_title("Export")) -- parent_layout "user/settings" +- provide(:title, generate_title('Export')) +- parent_layout 'user/settings' diff --git a/app/views/user/groups.haml b/app/views/user/groups.haml index 0f08b0cf..41a8547d 100644 --- a/app/views/user/groups.haml +++ b/app/views/user/groups.haml @@ -5,5 +5,5 @@ %i.fa.fa-lock = group.display_name -- provide(:title, user_title(@user, "groups")) -- parent_layout "user/profile" +- provide(:title, user_title(@user, 'groups')) +- parent_layout 'user/profile' diff --git a/app/views/user/questions.haml b/app/views/user/questions.haml index f606d663..1be1b614 100644 --- a/app/views/user/questions.haml +++ b/app/views/user/questions.haml @@ -5,8 +5,8 @@ = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @questions_last_id - if @more_data_available - %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @questions_last_id }} + %button.btn.btn-default#load-more-btn{ type: :button, data: { last_id: @questions_last_id } } = t 'views.actions.load' - provide(:title, questions_title(@user)) -- parent_layout "user/profile" \ No newline at end of file +- parent_layout 'user/profile' diff --git a/app/views/user/show.haml b/app/views/user/show.haml index 486b25e7..8acf7d31 100644 --- a/app/views/user/show.haml +++ b/app/views/user/show.haml @@ -1,4 +1,3 @@ -.profile--panel-push-inner.hidden-xs - unless @user.banned? #answers - @answers.each do |a| @@ -7,8 +6,8 @@ = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @answers_last_id - if @more_data_available - %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @answers_last_id }} + %button.btn.btn-default#load-more-btn{ type: :button, data: { last_id: @answers_last_id } } = t 'views.actions.load' - provide(:title, user_title(@user)) -- parent_layout "user/profile" +- parent_layout 'user/profile' diff --git a/app/views/user/show_follow.haml b/app/views/user/show_follow.haml index 15cf82e6..a0817101 100644 --- a/app/views/user/show_follow.haml +++ b/app/views/user/show_follow.haml @@ -1,4 +1,4 @@ -#users.row.row-cols-1.row-cols-sm-2.row-cols-md-3 +.row.row-cols-1.row-cols-sm-2.row-cols-md-3#users - @users.each do |user| .col = render 'shared/userbox', user: user @@ -6,8 +6,8 @@ = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @users_last_id - if @more_data_available - %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @users_last_id }} + %button.btn.btn-default#load-more-btn{ type: :button, data: { last_id: @users_last_id } } = t 'views.actions.load' -- provide(:title, user_title(@user, "friends and followers")) -- parent_layout "user/profile" +- provide(:title, user_title(@user, 'friends and followers')) +- parent_layout 'user/profile'