diff --git a/Changelog.md b/Changelog.md index ca72cd124..027dae42a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,7 @@ * Don't display mail-related view content if it is disabled in the pod's config [#7190](https://github.com/diaspora/diaspora/pull/7190) * Use typeahead.js from rails-assets.org [#7192](https://github.com/diaspora/diaspora/pull/7192) * Refactor ShareVisibilitesController to use PostService [#7196](https://github.com/diaspora/diaspora/pull/7196) +* Unify desktop and mobile head elements [#7194](https://github.com/diaspora/diaspora/pull/7194) ## Bug fixes * Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167) diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 7de3ad913..23be964ec 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -33,7 +33,7 @@ module LayoutHelper def current_user_atom_tag return unless @person.present? content_tag(:link, "", rel: "alternate", href: @person.atom_url, type: "application/atom+xml", - title: t(".public_feed", name: @person.name)) + title: t("layouts.application.public_feed", name: @person.name)) end def translation_missing_warnings diff --git a/app/views/application/_head.haml b/app/views/application/_head.haml new file mode 100644 index 000000000..8019030c8 --- /dev/null +++ b/app/views/application/_head.haml @@ -0,0 +1,30 @@ +%title + = page_title yield(:page_title) + +%meta{charset: "utf-8"}/ += content_for?(:meta_data) ? yield(:meta_data) : metas_tags + +/ favicon +/ For Apple devices +%link{rel: "apple-touch-icon", href: image_path("apple-touch-icon.png")} +/ For Nokia devices +%link{rel: "shortcut icon", href: image_path("apple-touch-icon.png")} +/ All others +%link{rel: "shortcut icon", href: image_path("favicon.png")} + += chartbeat_head_block += include_mixpanel + +- if rtl? + = stylesheet_link_tag :rtl, media: "all" + +- if Rails.env.test? + = stylesheet_link_tag :poltergeist_disable_transition, media: "all" + += jquery_include_tag += current_user_atom_tag + += yield(:head) + += csrf_meta_tag += include_gon(camel_case: true, nonce: content_security_policy_nonce(:script)) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 7903dd88b..0dbcaae99 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -3,47 +3,23 @@ -# the COPYRIGHT file. !!! -%html{lang: I18n.locale.to_s, dir: (rtl?) ? 'rtl' : 'ltr'} +%html{lang: I18n.locale.to_s, dir: (rtl? ? "rtl" : "ltr")} %head{prefix: og_prefix} - %title - = page_title yield(:page_title) - - %meta{charset: 'utf-8'}/ - %meta{name: "viewport", content: "width=device-width, initial-scale=1"}/ - = content_for?(:meta_data) ? yield(:meta_data) : metas_tags - - %link{rel: 'shortcut icon', href: "#{image_path('favicon.png')}" } - - = chartbeat_head_block - = include_mixpanel + = render "head" + %meta{name: "viewport", content: "width=device-width, initial-scale=1"}/ = include_color_theme - - - if rtl? - = stylesheet_link_tag :rtl, media: 'all' - - - if Rails.env.test? - = stylesheet_link_tag :poltergeist_disable_transition, media: "all" - = old_browser_js_support + - = jquery_include_tag = javascript_include_tag :main, :templates = load_javascript_locales - = translation_missing_warnings - = current_user_atom_tag - = yield(:head) - = csrf_meta_tag - - - = include_gon(camel_case: true, nonce: content_security_policy_nonce(:script)) - - %body{ class: "page-#{controller_name} action-#{action_name}" } + %body{class: "page-#{controller_name} action-#{action_name}"} = yield :before_content %noscript diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 819a215b2..e65f3f459 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -3,56 +3,21 @@ -# the COPYRIGHT file. !!! -%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'} - %head - %title - = pod_name +%html{lang: I18n.locale.to_s, dir: (rtl? ? "rtl" : "ltr")} + %head{prefix: og_prefix} + = render "head" + = include_color_theme "mobile" - %meta{:name => "description", :content => "diaspora* mobile"}/ - %meta{:name => "author", :content => "Diaspora, Inc."}/ - %meta{:charset => 'utf-8'}/ - - / Viewport scale - %meta{:name =>'viewport', :content => "width=device-width, minimum-scale=1 maximum-scale=1"}/ - %meta{:name => "HandheldFriendly", :content => "True"}/ - %meta{:name => "MobileOptimized", :content => "320"}/ - / Force cleartype on WP7 - %meta{'http-equiv' => "cleartype", :content => 'on'}/ - - / Home screen icon (sized for retina displays) - %link{rel: "apple-touch-icon", href: image_path("apple-touch-icon.png")} - / For Nokia devices - %link{rel: "shortcut icon", href: image_path("apple-touch-icon.png")} - / For desktop - %link{rel: 'shortcut icon', href: image_path("favicon.png")} + %meta{name: "viewport", content: "width=device-width, minimum-scale=1 maximum-scale=1"}/ + %meta{name: "HandheldFriendly", content: "True"}/ + %meta{name: "MobileOptimized", content: "320"}/ + %meta{"http-equiv" => "cleartype", :content => "on"}/ / iOS mobile web app indicator / NOTE(we will enable these once we don't have to rely on back/forward buttons anymore) /%meta{:name => "apple-mobile-web-app-capable", :content => "yes"} /%link{:rel => "apple-touch-startup-image", :href => "/images/apple-splash.png"} - = yield :meta_data - = chartbeat_head_block - - / Stylesheets - - = include_color_theme "mobile" - = yield(:custom_css) - - - = csrf_meta_tag - - - if rtl? - = stylesheet_link_tag :rtl, :media => 'all' - - - if Rails.env.test? - = stylesheet_link_tag :poltergeist_disable_transition, media: "all" - - = jquery_include_tag - - = yield(:head) - - = include_gon(camel_case: true, nonce: content_security_policy_nonce(:script)) %body #app = render "layouts/header" @@ -62,10 +27,10 @@ #main{:role => "main"} - if current_page?(:activity_stream) %h3 - = t('streams.activity.title') + = t("streams.activity.title") = yield - / javascripts at the bottom = javascript_include_tag "mobile/mobile" = load_javascript_locales = include_chartbeat + = include_mixpanel_guid