Skip to content

Commit

Permalink
Branding: Improved Defaults & Internationalization (#381)
Browse files Browse the repository at this point in the history
* Better defaults & i8ln with branding

* Move layout icons into partial
  • Loading branch information
pglombardo authored Aug 14, 2022
1 parent b39c079 commit cbfe393
Show file tree
Hide file tree
Showing 44 changed files with 728 additions and 350 deletions.
6 changes: 5 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module ApplicationHelper
# Set the HTML title for the page with a trailing site identifier.
def title(content)
content_for(:html_title) { "#{content} | #{_(Settings.brand.title)}" }
if Settings.brand.title
return content_for(:html_title) { "#{content} | #{Settings.brand.title}" }
else
return content_for(:html_title) { "#{content} | #{_('Password Pusher')}" }
end
end

# Set the HTML title for the page _without_ the trailing site identifier.
Expand Down
11 changes: 9 additions & 2 deletions app/models/feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ class Feedback < MailForm::Base
# Declare the e-mail headers. It accepts anything the mail method
# in ActionMailer accepts.
def headers
{
subject: _(Settings.brand.title + ' Feedback'),
headers = {
to: Settings.feedback.email,
from: Settings.mail.mailer_sender
}

if Settings.brand.title
headers[:subject] = Settings.brand.title + ' Feedback'
else
headers[:subject] = _('Password Pusher Feedback')
end

headers
end
end
8 changes: 6 additions & 2 deletions app/views/devise/mailer/email_changed.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<p><%= _('Hello') %>,</p>

<p>
<%= _('We\'re contacting you to notify you that your email at') %>
<%= link_to _(Settings.brand.title), root_url %>
<%= _('We\'re contacting you to notify you that your email at') %>
<% if Settings.brand.title %>
<%= link_to Settings.brand.title, root_url %>
<% else %>
<%= link_to _('Password Pusher'), root_url %>
<% end %>

<% if @resource.try(:unconfirmed_email?) %>
<%= sprintf(_('is being changed to %s', @resource.unconfirmed_email) %>.
Expand Down
6 changes: 5 additions & 1 deletion app/views/devise/mailer/password_change.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<p>
<%= _('We\'re contacting you to notify you that your password has been changed on') %>
<%= link_to _(Settings.brand.title), root_url %>.
<% if Settings.brand.title %>
<%= link_to Settings.brand.title, root_url %>.
<% else %>
<%= link_to _('Password Pusher'), root_url %>.
<% end %>
</p>
<%= render 'shared/email_footer' %>
25 changes: 7 additions & 18 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title><%= content_for?(:html_title) ? yield(:html_title) : _(Settings.brand.title) %></title>
<% if Settings.brand.title %>
<title><%= content_for?(:html_title) ? yield(:html_title) : Settings.brand.title %></title>
<% else %>
<title><%= content_for?(:html_title) ? yield(:html_title) : _('Password Pusher') %></title>
<% end %>

<%= render :partial => "layouts/ga" if Rails.env == "production" %>
<%= render partial: "layouts/ga" if Rails.env == "production" %>

<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand All @@ -16,22 +20,7 @@
<meta content="<%= _('Password Pusher is an application to securely send passwords over the web. Links to passwords expire after a certain number of views and/or time has passed.') %>" name='description'>
<meta content='width=device-width, initial-scale=1' name='viewport'>

<link rel="apple-touch-icon" sizes="57x57" href="<%=asset_pack_path(Settings.brand.icon_57x57)%>">
<link rel="apple-touch-icon" sizes="60x60" href="<%=asset_pack_path(Settings.brand.icon_60x60)%>">
<link rel="apple-touch-icon" sizes="72x72" href="<%=asset_pack_path(Settings.brand.icon_72x72)%>">
<link rel="apple-touch-icon" sizes="76x76" href="<%=asset_pack_path(Settings.brand.icon_76x76)%>">
<link rel="apple-touch-icon" sizes="114x114" href="<%=asset_pack_path(Settings.brand.icon_114x114)%>">
<link rel="apple-touch-icon" sizes="120x120" href="<%=asset_pack_path(Settings.brand.icon_120x120)%>">
<link rel="apple-touch-icon" sizes="144x144" href="<%=asset_pack_path(Settings.brand.icon_144x144)%>">
<link rel="apple-touch-icon" sizes="152x152" href="<%=asset_pack_path(Settings.brand.icon_152x152)%>">
<link rel="apple-touch-icon" sizes="180x180" href="<%=asset_pack_path(Settings.brand.icon_180x180)%>">
<link rel="icon" type="image/png" sizes="192x192" href="<%=asset_pack_path(Settings.brand.icon_192x192)%>">
<link rel="icon" type="image/png" sizes="32x32" href="<%=asset_pack_path(Settings.brand.icon_32x32)%>">
<link rel="icon" type="image/png" sizes="96x96" href="<%=asset_pack_path(Settings.brand.icon_96x96)%>">
<link rel="icon" type="image/png" sizes="16x16" href="<%=asset_pack_path(Settings.brand.icon_16x16)%>">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="<%=asset_pack_path(Settings.brand.ms_icon_144x144)%>">
<meta name="theme-color" content="#ffffff">
<%= render partial: "shared/layout_icons" %>

</head>

Expand Down
25 changes: 7 additions & 18 deletions app/views/layouts/bare.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title><%= content_for?(:html_title) ? yield(:html_title) : _(Settings.brand.title) %></title>
<% if Settings.brand.title %>
<title><%= content_for?(:html_title) ? yield(:html_title) : Settings.brand.title %></title>
<% else %>
<title><%= content_for?(:html_title) ? yield(:html_title) : _('Password Pusher') %></title>
<% end %>

<%= render :partial => "layouts/ga" if Rails.env == "production" %>
<%= render partial: "layouts/ga" if Rails.env == "production" %>

<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand All @@ -16,22 +20,7 @@
<meta content="<%= _('Password Pusher is an application to securely send passwords over the web. Links to passwords expire after a certain number of views and/or time has passed.') %>" name='description'>
<meta content='width=device-width, initial-scale=1' name='viewport'>

<link rel="apple-touch-icon" sizes="57x57" href="<%=asset_pack_path('media/img/apple-icon-57x57.png')%>">
<link rel="apple-touch-icon" sizes="60x60" href="<%=asset_pack_path('media/img/apple-icon-60x60.png')%>">
<link rel="apple-touch-icon" sizes="72x72" href="<%=asset_pack_path('media/img/apple-icon-72x72.png')%>">
<link rel="apple-touch-icon" sizes="76x76" href="<%=asset_pack_path('media/img/apple-icon-76x76.png')%>">
<link rel="apple-touch-icon" sizes="114x114" href="<%=asset_pack_path('media/img/apple-icon-114x114.png')%>">
<link rel="apple-touch-icon" sizes="120x120" href="<%=asset_pack_path('media/img/apple-icon-120x120.png')%>">
<link rel="apple-touch-icon" sizes="144x144" href="<%=asset_pack_path('media/img/apple-icon-144x144.png')%>">
<link rel="apple-touch-icon" sizes="152x152" href="<%=asset_pack_path('media/img/apple-icon-152x152.png')%>">
<link rel="apple-touch-icon" sizes="180x180" href="<%=asset_pack_path('media/img/apple-icon-180x180.png')%>">
<link rel="icon" type="image/png" sizes="192x192" href="<%=asset_pack_path('media/img/android-icon-192x192.png')%>">
<link rel="icon" type="image/png" sizes="32x32" href="<%=asset_pack_path('media/img/favicon-32x32.png')%>">
<link rel="icon" type="image/png" sizes="96x96" href="<%=asset_pack_path('media/img/favicon-96x96.png')%>">
<link rel="icon" type="image/png" sizes="16x16" href="<%=asset_pack_path('media/img/favicon-16x16.png')%>">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="<%=asset_pack_path('media/img/ms-icon-144x144.png')%>">
<meta name="theme-color" content="#ffffff">
<%= render partial: "shared/layout_icons" %>

</head>

Expand Down
25 changes: 7 additions & 18 deletions app/views/layouts/login.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title><%= content_for?(:html_title) ? yield(:html_title) : _(Settings.brand.title) %></title>
<% if Settings.brand.title %>
<title><%= content_for?(:html_title) ? yield(:html_title) : Settings.brand.title %></title>
<% else %>
<title><%= content_for?(:html_title) ? yield(:html_title) : _('Password Pusher') %></title>
<% end %>

<%= render :partial => "layouts/ga" if Rails.env == "production" %>
<%= render partial: "layouts/ga" if Rails.env == "production" %>

<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand All @@ -16,22 +20,7 @@
<meta content="<%= _('Password Pusher is an application to securely send passwords over the web. Links to passwords expire after a certain number of views and/or time has passed.') %>" name='description'>
<meta content='width=device-width, initial-scale=1' name='viewport'>

<link rel="apple-touch-icon" sizes="57x57" href="<%=asset_pack_path('media/img/apple-icon-57x57.png')%>">
<link rel="apple-touch-icon" sizes="60x60" href="<%=asset_pack_path('media/img/apple-icon-60x60.png')%>">
<link rel="apple-touch-icon" sizes="72x72" href="<%=asset_pack_path('media/img/apple-icon-72x72.png')%>">
<link rel="apple-touch-icon" sizes="76x76" href="<%=asset_pack_path('media/img/apple-icon-76x76.png')%>">
<link rel="apple-touch-icon" sizes="114x114" href="<%=asset_pack_path('media/img/apple-icon-114x114.png')%>">
<link rel="apple-touch-icon" sizes="120x120" href="<%=asset_pack_path('media/img/apple-icon-120x120.png')%>">
<link rel="apple-touch-icon" sizes="144x144" href="<%=asset_pack_path('media/img/apple-icon-144x144.png')%>">
<link rel="apple-touch-icon" sizes="152x152" href="<%=asset_pack_path('media/img/apple-icon-152x152.png')%>">
<link rel="apple-touch-icon" sizes="180x180" href="<%=asset_pack_path('media/img/apple-icon-180x180.png')%>">
<link rel="icon" type="image/png" sizes="192x192" href="<%=asset_pack_path('media/img/android-icon-192x192.png')%>">
<link rel="icon" type="image/png" sizes="32x32" href="<%=asset_pack_path('media/img/favicon-32x32.png')%>">
<link rel="icon" type="image/png" sizes="96x96" href="<%=asset_pack_path('media/img/favicon-96x96.png')%>">
<link rel="icon" type="image/png" sizes="16x16" href="<%=asset_pack_path('media/img/favicon-16x16.png')%>">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="<%=asset_pack_path('media/img/ms-icon-144x144.png')%>">
<meta name="theme-color" content="#ffffff">
<%= render partial: "shared/layout_icons" %>

</head>

Expand Down
25 changes: 7 additions & 18 deletions app/views/layouts/naked.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title><%= content_for?(:html_title) ? yield(:html_title) : _(Settings.brand.title) %></title>
<% if Settings.brand.title %>
<title><%= content_for?(:html_title) ? yield(:html_title) : Settings.brand.title %></title>
<% else %>
<title><%= content_for?(:html_title) ? yield(:html_title) : _('Password Pusher') %></title>
<% end %>

<%= render :partial => "layouts/ga" if Rails.env == "production" %>
<%= render partial: "layouts/ga" if Rails.env == "production" %>

<%= csrf_meta_tags %>
<%= csp_meta_tag %>
Expand All @@ -16,22 +20,7 @@
<meta content="<%= _('Password Pusher is an application to securely send passwords over the web. Links to passwords expire after a certain number of views and/or time has passed.') %>" name='description'>
<meta content='width=device-width, initial-scale=1' name='viewport'>

<link rel="apple-touch-icon" sizes="57x57" href="<%=asset_pack_path('media/img/apple-icon-57x57.png')%>">
<link rel="apple-touch-icon" sizes="60x60" href="<%=asset_pack_path('media/img/apple-icon-60x60.png')%>">
<link rel="apple-touch-icon" sizes="72x72" href="<%=asset_pack_path('media/img/apple-icon-72x72.png')%>">
<link rel="apple-touch-icon" sizes="76x76" href="<%=asset_pack_path('media/img/apple-icon-76x76.png')%>">
<link rel="apple-touch-icon" sizes="114x114" href="<%=asset_pack_path('media/img/apple-icon-114x114.png')%>">
<link rel="apple-touch-icon" sizes="120x120" href="<%=asset_pack_path('media/img/apple-icon-120x120.png')%>">
<link rel="apple-touch-icon" sizes="144x144" href="<%=asset_pack_path('media/img/apple-icon-144x144.png')%>">
<link rel="apple-touch-icon" sizes="152x152" href="<%=asset_pack_path('media/img/apple-icon-152x152.png')%>">
<link rel="apple-touch-icon" sizes="180x180" href="<%=asset_pack_path('media/img/apple-icon-180x180.png')%>">
<link rel="icon" type="image/png" sizes="192x192" href="<%=asset_pack_path('media/img/android-icon-192x192.png')%>">
<link rel="icon" type="image/png" sizes="32x32" href="<%=asset_pack_path('media/img/favicon-32x32.png')%>">
<link rel="icon" type="image/png" sizes="96x96" href="<%=asset_pack_path('media/img/favicon-96x96.png')%>">
<link rel="icon" type="image/png" sizes="16x16" href="<%=asset_pack_path('media/img/favicon-16x16.png')%>">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="<%=asset_pack_path('media/img/ms-icon-144x144.png')%>">
<meta name="theme-color" content="#ffffff">
<%= render partial: "shared/layout_icons" %>

</head>

Expand Down
6 changes: 5 additions & 1 deletion app/views/shared/_email_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
<p>
-- <br/>
<%= _('Your Friendly Neighborhood') %>
<%= link_to _(Settings.brand.title), root_url %>
<% if Settings.brand.title %>
<%= link_to Settings.brand.title, root_url %>
<% else %>
<%= link_to _('Password Pusher'), root_url %>
<% end %>
</p>
12 changes: 10 additions & 2 deletions app/views/shared/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@
</picture>
</div>
<div>
<span class="fs-4 display-1"><%= _(Settings.brand.title) %></span>
<% if Settings.brand.title %>
<span class="fs-4 display-1"><%= Settings.brand.title %></span>
<% else %>
<span class="fs-4 display-1"><%= _('Password Pusher') %></span>
<% end %>
<br/>
<span class="fs-6 text-muted"><%= _(Settings.brand.tagline) %></span>
<% if Settings.brand.tagline%>
<span class="fs-6 text-muted"><%= Settings.brand.tagline %></span>
<% else %>
<span class="fs-6 text-muted"><%= _('Go Ahead. Email Another Password.') %></span>
<% end %>
</div>
<% end %>

Expand Down
36 changes: 36 additions & 0 deletions app/views/shared/_layout_icons.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

<% if Settings.brand.icon_57x57 %>
<link rel="apple-touch-icon" sizes="57x57" href="<%=asset_pack_path(Settings.brand.icon_57x57)%>">
<link rel="apple-touch-icon" sizes="60x60" href="<%=asset_pack_path(Settings.brand.icon_60x60)%>">
<link rel="apple-touch-icon" sizes="72x72" href="<%=asset_pack_path(Settings.brand.icon_72x72)%>">
<link rel="apple-touch-icon" sizes="76x76" href="<%=asset_pack_path(Settings.brand.icon_76x76)%>">
<link rel="apple-touch-icon" sizes="114x114" href="<%=asset_pack_path(Settings.brand.icon_114x114)%>">
<link rel="apple-touch-icon" sizes="120x120" href="<%=asset_pack_path(Settings.brand.icon_120x120)%>">
<link rel="apple-touch-icon" sizes="144x144" href="<%=asset_pack_path(Settings.brand.icon_144x144)%>">
<link rel="apple-touch-icon" sizes="152x152" href="<%=asset_pack_path(Settings.brand.icon_152x152)%>">
<link rel="apple-touch-icon" sizes="180x180" href="<%=asset_pack_path(Settings.brand.icon_180x180)%>">
<link rel="icon" type="image/png" sizes="192x192" href="<%=asset_pack_path(Settings.brand.icon_192x192)%>">
<link rel="icon" type="image/png" sizes="32x32" href="<%=asset_pack_path(Settings.brand.icon_32x32)%>">
<link rel="icon" type="image/png" sizes="96x96" href="<%=asset_pack_path(Settings.brand.icon_96x96)%>">
<link rel="icon" type="image/png" sizes="16x16" href="<%=asset_pack_path(Settings.brand.icon_16x16)%>">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="<%=asset_pack_path(Settings.brand.ms_icon_144x144)%>">
<meta name="theme-color" content="#ffffff">
<% else %>
<link rel="apple-touch-icon" sizes="57x57" href="<%=asset_pack_path('media/img/apple-icon-57x57.png')%>">
<link rel="apple-touch-icon" sizes="60x60" href="<%=asset_pack_path('media/img/apple-icon-60x60.png')%>">
<link rel="apple-touch-icon" sizes="72x72" href="<%=asset_pack_path('media/img/apple-icon-72x72.png')%>">
<link rel="apple-touch-icon" sizes="76x76" href="<%=asset_pack_path('media/img/apple-icon-76x76.png')%>">
<link rel="apple-touch-icon" sizes="114x114" href="<%=asset_pack_path('media/img/apple-icon-114x114.png')%>">
<link rel="apple-touch-icon" sizes="120x120" href="<%=asset_pack_path('media/img/apple-icon-120x120.png')%>">
<link rel="apple-touch-icon" sizes="144x144" href="<%=asset_pack_path('media/img/apple-icon-144x144.png')%>">
<link rel="apple-touch-icon" sizes="152x152" href="<%=asset_pack_path('media/img/apple-icon-152x152.png')%>">
<link rel="apple-touch-icon" sizes="180x180" href="<%=asset_pack_path('media/img/apple-icon-180x180.png')%>">
<link rel="icon" type="image/png" sizes="192x192" href="<%=asset_pack_path('media/img/android-icon-192x192.png')%>">
<link rel="icon" type="image/png" sizes="32x32" href="<%=asset_pack_path('media/img/favicon-32x32.png')%>">
<link rel="icon" type="image/png" sizes="96x96" href="<%=asset_pack_path('media/img/favicon-96x96.png')%>">
<link rel="icon" type="image/png" sizes="16x16" href="<%=asset_pack_path('media/img/favicon-16x16.png')%>">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="<%=asset_pack_path('media/img/ms-icon-144x144.png')%>">
<meta name="theme-color" content="#ffffff">
<% end %>
2 changes: 1 addition & 1 deletion config/locales/.translation_io
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# ignore the conflicts and "sync" again, it will fix this file for you.

---
timestamp: 1660467170
timestamp: 1660470140
Loading

0 comments on commit cbfe393

Please sign in to comment.