Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
197a911
Split up en.yml into smaller yml files
veganstraightedge Aug 17, 2025
fa7ddc7
YAMLlint config
veganstraightedge Aug 17, 2025
f5baa14
Fix YAML lines
veganstraightedge Aug 17, 2025
f3ff51b
Add admin: parent to controllers
veganstraightedge Aug 17, 2025
e393048
Delete duplication
veganstraightedge Aug 17, 2025
cbe93b0
Move page titles to controllers
veganstraightedge Aug 17, 2025
e7d92be
Organize YAML conventionally
veganstraightedge Aug 17, 2025
2c6c8c8
Move admin yaml into en/ and es/
veganstraightedge Aug 17, 2025
6e434f2
Delete nested locale files that only contain english
veganstraightedge Aug 17, 2025
fc8093b
Move locale files into locale folders
veganstraightedge Aug 17, 2025
400288e
Undo ar changes
veganstraightedge Aug 17, 2025
dcc2d92
Fix tests for /admin page titles
veganstraightedge Aug 17, 2025
f780dd9
Merge branch 'main' into split_i18n_yaml_files
veganstraightedge Aug 17, 2025
f24e738
Merge branch 'main' into split_i18n_yaml_files
veganstraightedge Aug 17, 2025
df872c8
Merge branch 'main' into split_i18n_yaml_files
veganstraightedge Aug 17, 2025
1c14982
WIP
veganstraightedge Aug 17, 2025
5ba3fcc
WIP
veganstraightedge Aug 17, 2025
76f36e3
Core and tools
veganstraightedge Aug 17, 2025
15d1abf
Comment
veganstraightedge Aug 17, 2025
b31e1b0
Merge branch 'main' into split_i18n_yaml_files
veganstraightedge Aug 20, 2025
30f2b65
Update config/locales/es/2025.yml
veganstraightedge Aug 20, 2025
ee2af7b
Add title for /admin root dashboard
veganstraightedge Aug 20, 2025
4b13d77
Refactor YAML
veganstraightedge Aug 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions app/controllers/admin/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,29 @@ class AdminController < ApplicationController
layout 'admin'

def admin_title model = nil, keys = []
return PageTitle.new(['Admin', t(".#{action_name}_title")]).content if model.blank?
# controller_name is 'admin', controller_path is 'admin/articles'
# we need 'Article' for the title from models locale YAML
controller_name_space = :admin
nested_controller_name = controller_path.split('/').last

if model.blank?
subtitle = t :other, scope: [:activerecord, :models, nested_controller_name.singularize]
return PageTitle.new(['Admin', subtitle]).content
end

return '' unless keys.all? { |key| model.respond_to? key }

translation_vars = keys.index_with { |key| model.send(key) }

PageTitle.new(['Admin', t(".#{action_name}_title", **translation_vars)]).content
lookup_path = [
:views,
controller_name_space,
nested_controller_name,
action_name,
:title
].join('.')

PageTitle.new(['Admin', t(lookup_path, **translation_vars)]).content
end

def set_published_at
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Admin
class DashboardController < Admin::AdminController
# /admin/dashboard
def index
@title = admin_title
@title = admin_title :dashboard
end

# /admin/markdown
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/_danger_zone.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="col-12 col-lg-9 offset-lg-3 col-xl-6 offset-xl-6">

<div class="card text-white mb-5" style="margin-top: 10rem">
<div class="card-header h3 bg-danger">The Danger Zone™</div>
<div class="card-header h3 bg-danger"><%= t '.danger_zone' %></div>

<div class="card-body text-secondary">
<h2 class="card-title text-danger h5">
Expand Down
278 changes: 0 additions & 278 deletions config/locales/admin/en.yml

This file was deleted.

Loading
Loading