From e09d3a2c6692fbc16cc6788cdc32b87e86f0b60f Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 21 Dec 2016 00:13:13 +0100 Subject: [PATCH] Fix #249 - use window.location hack to let people login from sandboxed iOS homescreen --- app/assets/javascripts/extras.jsx | 11 +++++++- app/assets/stylesheets/stream_entries.scss | 30 ++++++++++++++++++---- app/controllers/media_controller.rb | 2 +- app/views/about/index.html.haml | 5 ++-- app/views/home/index.html.haml | 1 - app/views/layouts/application.html.haml | 1 + app/views/stream_entries/_status.html.haml | 9 ++++--- config/locales/de.yml | 1 + config/locales/en.yml | 1 + 9 files changed, 48 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/extras.jsx b/app/assets/javascripts/extras.jsx index 9fd769c0b..b9f8e6842 100644 --- a/app/assets/javascripts/extras.jsx +++ b/app/assets/javascripts/extras.jsx @@ -1,7 +1,7 @@ import emojify from './components/emoji' $(() => { - $.each($('.entry .content, .entry .status__content, .display-name, .name, .account__header__content'), (_, content) => { + $.each($('.entry .content, .entry .status__content, .status__display-name, .display-name, .name, .account__header__content'), (_, content) => { const $content = $(content); $content.html(emojify($content.html())); }); @@ -17,4 +17,13 @@ $(() => { $('.media-spoiler').on('click', e => { $(e.target).hide(); }); + + $('.webapp-btn').on('click', e => { + console.log(e); + + if (e.button === 0) { + e.preventDefault(); + window.location.href = $(e.target).attr('href'); + } + }); }); diff --git a/app/assets/stylesheets/stream_entries.scss b/app/assets/stylesheets/stream_entries.scss index 5cd140aac..7624bbdc8 100644 --- a/app/assets/stylesheets/stream_entries.scss +++ b/app/assets/stylesheets/stream_entries.scss @@ -3,24 +3,26 @@ box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); .entry { - .status.light, .detailed-status.light { + background: lighten(#d9e1e8, 8%); + + &, .detailed-status.light { border-bottom: 1px solid #d9e1e8; } &:last-child { - .status.light, .detailed-status.light { + &, .detailed-status.light { border-bottom: 0; border-radius: 0 0 4px 4px; } } &:first-child { - .status.light, .detailed-status.light { + &, .detailed-status.light { border-radius: 4px 4px 0 0; } &:last-child { - .status.light, .detailed-status.light { + &, .detailed-status.light { border-radius: 4px; } } @@ -32,7 +34,6 @@ position: relative; min-height: 48px; cursor: default; - background: lighten(#d9e1e8, 8%); .status__header { font-size: 15px; @@ -280,6 +281,25 @@ } } } + + .pre-header { + padding: 14px 0px; + padding-left: (48px + 14px*2); + padding-bottom: 0; + margin-bottom: -4px; + color: #9baec8; + font-size: 14px; + position: relative; + + .pre-header__icon { + position: absolute; + left: (48px + 14px*2 - 30px); + } + + .status__display-name.muted strong { + color: #9baec8; + } + } } .embed { diff --git a/app/controllers/media_controller.rb b/app/controllers/media_controller.rb index 9832a91b4..6f1f7ec48 100644 --- a/app/controllers/media_controller.rb +++ b/app/controllers/media_controller.rb @@ -4,7 +4,7 @@ class MediaController < ApplicationController before_action :set_media_attachment def show - redirect_to TagManager.instance.url_for(@media_attachment.status) + redirect_to @media_attachment.file.url(:original) end private diff --git a/app/views/about/index.html.haml b/app/views/about/index.html.haml index 160a66710..fe13de837 100644 --- a/app/views/about/index.html.haml +++ b/app/views/about/index.html.haml @@ -2,6 +2,7 @@ = Rails.configuration.x.local_domain - content_for :header_tags do + = javascript_include_tag 'application_public' %meta{ property: 'og:site_name', content: 'Mastodon' }/ %meta{ property: 'og:type', content: 'website' }/ %meta{ property: 'og:title', content: Rails.configuration.x.local_domain }/ @@ -25,5 +26,5 @@ = link_to t('about.terms'), terms_path = link_to t('about.source_code'), 'https://github.com/Gargron/mastodon' - = link_to t('about.get_started'), new_user_registration_path, class: 'button' - = link_to t('auth.login'), new_user_session_path, class: 'button' + = link_to t('about.get_started'), new_user_registration_path, class: 'button webapp-btn' + = link_to t('auth.login'), new_user_session_path, class: 'button webapp-btn' diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 0adce05bf..498fae105 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -1,5 +1,4 @@ - content_for :header_tags do - %meta{:name => "apple-mobile-web-app-capable", :content => "yes"}/ = javascript_include_tag 'application' = react_component 'Mastodon', default_props, class: 'app-holder', prerender: false diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 7e28d27ec..87f98198c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -9,6 +9,7 @@ %link{:rel => "manifest", :href => "/manifest.json"}/ %meta{:name => "msapplication-config", :content => "/browserconfig.xml"}/ %meta{:name => "theme-color", :content => "#2b90d9"}/ + %meta{:name => "apple-mobile-web-app-capable", :content => "yes"}/ %title = "#{yield(:page_title)} - " if content_for?(:page_title) diff --git a/app/views/stream_entries/_status.html.haml b/app/views/stream_entries/_status.html.haml index 67cb06a83..f70e2c890 100644 --- a/app/views/stream_entries/_status.html.haml +++ b/app/views/stream_entries/_status.html.haml @@ -9,9 +9,12 @@ .entry{ class: entry_classes(status, is_predecessor, is_successor, include_threads) } - if status.reblog? .pre-header - %i.fa.fa-retweet - Shared by - = link_to display_name(status.account), TagManager.instance.url_for(status.account), class: 'name' + %div.pre-header__icon + = fa_icon('retweet fw') + %span + = link_to TagManager.instance.url_for(status.account), class: 'status__display-name muted' do + %strong= display_name(status.account) + = t('stream_entries.reblogged') = render partial: centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status', locals: { status: proper_status(status) } diff --git a/config/locales/de.yml b/config/locales/de.yml index 1285a11a1..ead3ae514 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -55,6 +55,7 @@ de: stream_entries: favourited: favorisierte einen Beitrag von is_now_following: folgt nun + reblogged: teilte users: invalid_email: Inkorrekte E-mail-Addresse will_paginate: diff --git a/config/locales/en.yml b/config/locales/en.yml index f58ce9a71..684c86f4a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -71,6 +71,7 @@ en: favourited: favourited a post by is_now_following: is now following sensitive_content: Sensitive content + reblogged: boosted time: formats: default: "%b %d, %Y, %H:%M"