Add "signed in as" header to some pages (#4523)

This commit is contained in:
Eugen Rochko
2017-08-05 04:24:58 +02:00
committed by GitHub
parent 029786442a
commit df605f0f8b
40 changed files with 105 additions and 57 deletions

View File

@ -43,6 +43,10 @@ class ApplicationController < ActionController::Base
forbidden if current_user.account.suspended?
end
def after_sign_out_path_for(_resource_or_scope)
new_user_session_path
end
protected
def forbidden

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class AuthorizeFollowsController < ApplicationController
layout 'public'
layout 'modal'
before_action :authenticate_user!

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class RemoteFollowController < ApplicationController
layout 'public'
layout 'modal'
before_action :set_account
before_action :gone, if: :suspended_account?

View File

@ -47,7 +47,7 @@ body {
padding: 0;
}
@media screen and (max-width: 360px) {
@media screen and (max-width: 400px) {
padding-bottom: 0;
}
}

View File

@ -13,8 +13,9 @@
margin: 100px auto;
margin-bottom: 50px;
@media screen and (max-width: 360px) {
@media screen and (max-width: 400px) {
margin: 30px auto;
margin-bottom: 20px;
}
h1 {
@ -42,3 +43,54 @@
}
}
}
.account-header {
width: 400px;
margin: 0 auto;
display: flex;
font-size: 13px;
line-height: 18px;
box-sizing: border-box;
padding: 20px 0;
padding-bottom: 0;
margin-bottom: -30px;
margin-top: 40px;
@media screen and (max-width: 400px) {
width: 100%;
margin: 0;
margin-bottom: 10px;
padding: 20px;
padding-bottom: 0;
}
.avatar {
width: 40px;
height: 40px;
margin-right: 8px;
img {
width: 100%;
height: 100%;
display: block;
margin: 0;
border-radius: 4px;
}
}
.name {
flex: 1 1 auto;
color: $ui-secondary-color;
.username {
display: block;
font-weight: 500;
}
}
.logout-link {
display: block;
font-size: 32px;
line-height: 40px;
}
}

View File

@ -317,7 +317,7 @@ code {
}
.flash-message {
background: $ui-base-color;
background: lighten($ui-base-color, 8%);
color: $ui-primary-color;
border-radius: 4px;
padding: 15px 10px;

View File

@ -3,10 +3,9 @@
.form-container
.follow-prompt
%h2= t('authorize_follow.prompt_html', self: current_account.username)
= render 'card', account: @account
= form_tag authorize_follow_path, method: :post, class: 'simple_form' do
= hidden_field_tag :acct, @account.acct
= button_tag t('authorize_follow.follow'), type: :submit
- unless current_account.following?(@account)
= form_tag authorize_follow_path, method: :post, class: 'simple_form' do
= hidden_field_tag :acct, @account.acct
= button_tag t('authorize_follow.follow'), type: :submit

View File

@ -0,0 +1,16 @@
- content_for :header_tags do
= javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous'
- content_for :content do
- if user_signed_in?
.account-header
.avatar= image_tag current_account.avatar.url(:original)
.name
= t 'users.signed_in_as'
%span.username @#{current_account.local_username_and_domain}
= link_to destroy_user_session_path, method: :delete, class: 'logout-link icon-button' do
= fa_icon 'sign-out'
.container= yield
= render template: 'layouts/application'