forked from cybrespace/mastodon
Improve embeds (#7919)
* Make embeds cacheable by reverse proxy * Make follow button on embeds open remote follow modal Instead of web+mastodon://, also, turn the button blue, and add a sign up prompt to the remote follow modal
This commit is contained in:
parent
8fea9cc311
commit
2092d5c0ad
|
@ -5,6 +5,7 @@ class RemoteFollowController < ApplicationController
|
||||||
|
|
||||||
before_action :set_account
|
before_action :set_account
|
||||||
before_action :gone, if: :suspended_account?
|
before_action :gone, if: :suspended_account?
|
||||||
|
before_action :set_body_classes
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@remote_follow = RemoteFollow.new(session_params)
|
@remote_follow = RemoteFollow.new(session_params)
|
||||||
|
|
|
@ -46,7 +46,12 @@ class StatusesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def embed
|
def embed
|
||||||
|
raise ActiveRecord::RecordNotFound if @status.hidden?
|
||||||
|
|
||||||
|
skip_session!
|
||||||
|
expires_in 180, public: true
|
||||||
response.headers['X-Frame-Options'] = 'ALLOWALL'
|
response.headers['X-Frame-Options'] = 'ALLOWALL'
|
||||||
|
|
||||||
render 'stream_entries/embed', layout: 'embedded'
|
render 'stream_entries/embed', layout: 'embedded'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ function main() {
|
||||||
[].forEach.call(document.querySelectorAll('.logo-button'), (content) => {
|
[].forEach.call(document.querySelectorAll('.logo-button'), (content) => {
|
||||||
content.addEventListener('click', (e) => {
|
content.addEventListener('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.open(e.target.href, 'mastodon-intent', 'width=400,height=400,resizable=no,menubar=no,status=no,scrollbars=yes');
|
window.open(e.target.href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -464,6 +464,7 @@
|
||||||
background: $simple-background-color;
|
background: $simple-background-color;
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
|
background: $base-shadow-color;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
height: 90px;
|
height: 90px;
|
||||||
|
|
|
@ -324,6 +324,9 @@
|
||||||
.button.button-secondary.logo-button {
|
.button.button-secondary.logo-button {
|
||||||
flex: 0 auto;
|
flex: 0 auto;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
background: $ui-highlight-color;
|
||||||
|
color: $primary-text-color;
|
||||||
|
border: 0;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
@ -332,19 +335,21 @@
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
|
|
||||||
path:first-child {
|
path:first-child {
|
||||||
fill: $ui-primary-color;
|
fill: $primary-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
path:last-child {
|
path:last-child {
|
||||||
fill: $simple-background-color;
|
fill: $ui-highlight-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active,
|
&:active,
|
||||||
&:focus,
|
&:focus,
|
||||||
&:hover {
|
&:hover {
|
||||||
svg path:first-child {
|
background: lighten($ui-highlight-color, 10%);
|
||||||
fill: lighten($ui-primary-color, 4%);
|
|
||||||
|
svg path:last-child {
|
||||||
|
fill: lighten($ui-highlight-color, 10%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,3 +11,5 @@
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= f.button :button, t('remote_follow.proceed'), type: :submit
|
= f.button :button, t('remote_follow.proceed'), type: :submit
|
||||||
|
|
||||||
|
%p.hint.subtle-hint= t('remote_follow.no_account_html', sign_up_path: open_registrations? ? new_user_registration_path : 'https://joinmastodon.org')
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
%span= acct(status.account)
|
%span= acct(status.account)
|
||||||
|
|
||||||
- if embedded_view?
|
- if embedded_view?
|
||||||
= link_to "web+mastodon://follow?uri=#{status.account.local_username_and_domain}", class: 'button button-secondary logo-button', target: '_new' do
|
= link_to account_remote_follow_path(status.account), class: 'button button-secondary logo-button', target: '_new' do
|
||||||
= render file: Rails.root.join('app', 'javascript', 'images', 'logo.svg')
|
= render file: Rails.root.join('app', 'javascript', 'images', 'logo.svg')
|
||||||
= t('accounts.follow')
|
= t('accounts.follow')
|
||||||
|
|
||||||
|
|
|
@ -615,6 +615,7 @@ en:
|
||||||
remote_follow:
|
remote_follow:
|
||||||
acct: Enter your username@domain you want to follow from
|
acct: Enter your username@domain you want to follow from
|
||||||
missing_resource: Could not find the required redirect URL for your account
|
missing_resource: Could not find the required redirect URL for your account
|
||||||
|
no_account_html: Don't have an account? You can <a href='%{sign_up_path}' target='_blank'>sign up here</a>
|
||||||
proceed: Proceed to follow
|
proceed: Proceed to follow
|
||||||
prompt: 'You are going to follow:'
|
prompt: 'You are going to follow:'
|
||||||
remote_unfollow:
|
remote_unfollow:
|
||||||
|
|
Loading…
Reference in New Issue