From f486ef2666dacbcb6fcd26e371bb5e945369dcfe Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 7 Oct 2017 20:00:35 +0200 Subject: Redesign public hashtag pages (#5237) --- app/views/about/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/about') diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index 0d311b895..ef27d07a1 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -62,7 +62,7 @@ .about-mastodon %h3= t 'about.what_is_mastodon' %p= t 'about.about_mastodon_html' - %a.button.button-secondary{ href: 'https://joinmastodon.org/' }= t 'about.learn_more' + = link_to t('about.learn_more'), 'https://joinmastodon.org/', class: 'button button-secondary' = render 'features' .footer-links .container -- cgit From 552d22bec9602a64616538f7df0bdac13140c7f8 Mon Sep 17 00:00:00 2001 From: takayamaki Date: Wed, 11 Oct 2017 07:52:25 +0900 Subject: sign_in and sign_up views present og meta infos (#5308) --- app/controllers/auth/registrations_controller.rb | 5 +++++ app/controllers/auth/sessions_controller.rb | 5 +++++ app/views/about/_og.html.haml | 10 ---------- app/views/about/more.html.haml | 2 +- app/views/about/show.html.haml | 2 +- app/views/auth/registrations/new.html.haml | 3 +++ app/views/auth/sessions/new.html.haml | 3 +++ app/views/shared/_og.html.haml | 10 ++++++++++ 8 files changed, 28 insertions(+), 12 deletions(-) delete mode 100644 app/views/about/_og.html.haml create mode 100644 app/views/shared/_og.html.haml (limited to 'app/views/about') diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb index 60ace04d7..aac3c31ff 100644 --- a/app/controllers/auth/registrations_controller.rb +++ b/app/controllers/auth/registrations_controller.rb @@ -6,6 +6,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController before_action :check_enabled_registrations, only: [:new, :create] before_action :configure_sign_up_params, only: [:create] before_action :set_sessions, only: [:edit, :update] + before_action :set_instance_presenter, only: [:new, :update] def destroy not_found @@ -39,6 +40,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController private + def set_instance_presenter + @instance_presenter = InstancePresenter.new + end + def determine_layout %w(edit update).include?(action_name) ? 'admin' : 'auth' end diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index bc3bd2f4b..463a183e4 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -8,6 +8,7 @@ class Auth::SessionsController < Devise::SessionsController skip_before_action :require_no_authentication, only: [:create] skip_before_action :check_suspension, only: [:destroy] prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create] + before_action :set_instance_presenter, only: [:new] def create super do |resource| @@ -84,6 +85,10 @@ class Auth::SessionsController < Devise::SessionsController private + def set_instance_presenter + @instance_presenter = InstancePresenter.new + end + def home_paths(resource) paths = [about_path] if single_user_mode? && resource.is_a?(User) diff --git a/app/views/about/_og.html.haml b/app/views/about/_og.html.haml deleted file mode 100644 index dbd476915..000000000 --- a/app/views/about/_og.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -- thumbnail = @instance_presenter.thumbnail -= opengraph 'og:site_name', t('about.hosted_on', domain: site_hostname) -= opengraph 'og:url', about_url -= opengraph 'og:type', 'website' -= opengraph 'og:title', @instance_presenter.site_title -= opengraph 'og:description', strip_tags(@instance_presenter.site_description.presence || t('about.about_mastodon_html')) -= opengraph 'og:image', full_asset_url(thumbnail&.file&.url || asset_pack_path('preview.jpg', protocol: :request)) -= opengraph 'og:image:width', thumbnail ? thumbnail.meta['width'] : '1200' -= opengraph 'og:image:height', thumbnail ? thumbnail.meta['height'] : '630' -= opengraph 'twitter:card', 'summary_large_image' diff --git a/app/views/about/more.html.haml b/app/views/about/more.html.haml index 1a4e74643..b012606ce 100644 --- a/app/views/about/more.html.haml +++ b/app/views/about/more.html.haml @@ -3,7 +3,7 @@ - content_for :header_tags do = javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous' - = render partial: 'og' + = render partial: 'shared/og' .landing-page .header-wrapper.compact diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml index ef27d07a1..f8f90ce24 100644 --- a/app/views/about/show.html.haml +++ b/app/views/about/show.html.haml @@ -4,7 +4,7 @@ - content_for :header_tags do %script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json) = javascript_pack_tag 'about', integrity: true, crossorigin: 'anonymous' - = render partial: 'og' + = render partial: 'shared/og' .landing-page .header-wrapper diff --git a/app/views/auth/registrations/new.html.haml b/app/views/auth/registrations/new.html.haml index 807020310..f71675df0 100644 --- a/app/views/auth/registrations/new.html.haml +++ b/app/views/auth/registrations/new.html.haml @@ -1,6 +1,9 @@ - content_for :page_title do = t('auth.register') +- content_for :header_tags do + = render partial: 'shared/og' + = simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| = render 'shared/error_messages', object: resource diff --git a/app/views/auth/sessions/new.html.haml b/app/views/auth/sessions/new.html.haml index e589377bf..a52b0053b 100644 --- a/app/views/auth/sessions/new.html.haml +++ b/app/views/auth/sessions/new.html.haml @@ -1,6 +1,9 @@ - content_for :page_title do = t('auth.login') +- content_for :header_tags do + = render partial: 'shared/og' + = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| = f.input :email, autofocus: true, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') } = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' } diff --git a/app/views/shared/_og.html.haml b/app/views/shared/_og.html.haml new file mode 100644 index 000000000..dbd476915 --- /dev/null +++ b/app/views/shared/_og.html.haml @@ -0,0 +1,10 @@ +- thumbnail = @instance_presenter.thumbnail += opengraph 'og:site_name', t('about.hosted_on', domain: site_hostname) += opengraph 'og:url', about_url += opengraph 'og:type', 'website' += opengraph 'og:title', @instance_presenter.site_title += opengraph 'og:description', strip_tags(@instance_presenter.site_description.presence || t('about.about_mastodon_html')) += opengraph 'og:image', full_asset_url(thumbnail&.file&.url || asset_pack_path('preview.jpg', protocol: :request)) += opengraph 'og:image:width', thumbnail ? thumbnail.meta['width'] : '1200' += opengraph 'og:image:height', thumbnail ? thumbnail.meta['height'] : '630' += opengraph 'twitter:card', 'summary_large_image' -- cgit