diff --git a/app/controllers/signed_in_application_controller.rb b/app/controllers/signed_in_application_controller.rb
index 60036bc59..02d499183 100644
--- a/app/controllers/signed_in_application_controller.rb
+++ b/app/controllers/signed_in_application_controller.rb
@@ -16,6 +16,7 @@ class SignedInApplicationController < ApplicationController
before_action :require_login, unless: :authentication_controllers?
before_action :track_behaviour
before_action :set_app
+ before_action :set_page_name
helper_method :current_organization,
:current_user,
@@ -36,6 +37,27 @@ class SignedInApplicationController < ApplicationController
rescue_from NotAuthorizedError, with: :user_not_authorized
+ private
+
+ def set_page_name
+ user_facing_actions = %w[new index show edit]
+
+ if user_facing_actions.include?(params[:action])
+ controller_key = params[:controller].split("/").last
+ action = params[:action]
+ controller_name = I18n.t("page_titles.controllers.#{controller_key}.name", default: controller_key)
+ action_name = I18n.t("page_titles.controllers.#{controller_key}.actions.#{action}", default: action)
+ suffix = action_suffix?(action) ? action_name : controller_name
+ @page_name = suffix
+ else
+ @page_name = params[:action]
+ end
+ end
+
+ def action_suffix?(action)
+ %w[new edit].include?(action)
+ end
+
protected
def logout_path
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2df11a80c..e62098819 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -146,4 +146,16 @@ def duration_in_words(seconds)
return NOT_AVAILABLE unless seconds
distance_of_time_in_words(0, seconds, include_seconds: true)
end
+
+ def page_title(page_name, current_organization, app, release)
+ suffix = I18n.t("page_titles.default_suffix", default: "Tramline")
+ middle_section = app&.name || current_organization&.name
+ prefix = if release&.original_release_version.present?
+ release.original_release_version
+ else
+ page_name || middle_section
+ end
+
+ [prefix.titleize, middle_section.titleize, suffix.titleize].compact.join(" | ")
+ end
end
diff --git a/app/views/layouts/signed_in_application.html.erb b/app/views/layouts/signed_in_application.html.erb
index bbed2fea6..3967be36b 100644
--- a/app/views/layouts/signed_in_application.html.erb
+++ b/app/views/layouts/signed_in_application.html.erb
@@ -2,7 +2,7 @@
<%= render partial: "shared/favicon" %>
- <%= current_organization.name %> | Tramline
+ <%= page_title(@page_name, current_organization, @app, @release) %>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cc2b3dc0e..9effb3588 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1,4 +1,84 @@
en:
+ page_titles:
+ default_suffix: "Tramline"
+ controllers:
+ apps:
+ name: "Apps"
+ actions:
+ index: "Apps" # "Apps | Ueno | Tramline"
+ show: "App Details" # "App Details | Ueno | Tramline"
+ new: "App New" # "App New | Ueno | Tramline" (instead of "New App")
+ edit: "App Edit" # "App Edit | Ueno | Tramline" (instead of "Edit App")
+ # Releases Controller
+ releases:
+ name: "Releases"
+ actions:
+ index: "Releases" # "Releases | Ueno | Tramline"
+ show: "Release Details" # "Release Details | Ueno | Tramline"
+ new: "Release New" # "Release New | Ueno | Tramline" (instead of "New Release")
+ edit: "Release Edit" # "Release Edit | Ueno | Tramline" (instead of "Edit Release")
+ # Trains Controller
+ trains:
+ name: "Trains"
+ actions:
+ index: "Trains" # "Trains | Ueno | Tramline"
+ show: "Train Details" # "Train Details | Ueno | Tramline"
+ new: "Train New" # "Train New | Ueno | Tramline" (instead of "New Train")
+ edit: "Train Edit" # "Train Edit | Ueno | Tramline" (instead of "Edit Train")
+ # Organizations Controller (Accounts::Organizations)
+ organizations:
+ name: "Organizations"
+ actions:
+ index: "Organizations"
+ show: "Organization Details"
+ new: "Organization New"
+ edit: "Organization Edit"
+ # Users Controller (Accounts::Users)
+ users:
+ name: "Users"
+ actions:
+ index: "Users"
+ show: "User Details"
+ new: "User New"
+ edit: "User Edit"
+ # Admin::SettingsController
+ settings:
+ name: "Settings"
+ actions:
+ index: "Settings"
+ show: "Setting Details"
+ new: "Setting New"
+ edit: "Setting Edit"
+ # Integrations Controller
+ integrations:
+ name: "Integrations"
+ actions:
+ index: "Integrations"
+ show: "Integration Details"
+ new: "Integration New"
+ edit: "Integration Edit"
+ # ReleaseHealthRules Controller
+ release_health_rules:
+ name: "Release Health Rules"
+ actions:
+ index: "Rules"
+ show: "Rule Details"
+ new: "Rule New"
+ edit: "Rule Edit"
+ release_indices:
+ name: "Reldex"
+ actions:
+ index: "Reldex"
+ show: "Reldex Details"
+ edit: "Reldex Edit"
+ store_submissions:
+ name: "Submissions"
+ actions:
+ index: "Submissions"
+ show: "Submission Details"
+ new: "Submission New"
+ edit: "Submission Edit"
+
config:
release_platforms:
success: "Platform configuration was successfully updated."