-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use correct translation scopes and add missing filtered route
- Loading branch information
Showing
11 changed files
with
78 additions
and
22 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
app/controllers/rosetta/locales/translations/missing_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Rosetta | ||
class Locales::Translations::MissingController < Locales::TranslationsController | ||
private | ||
|
||
def scope | ||
TranslationKey.with_missing_translation_in_locale(@locale) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
module Rosetta | ||
module ApplicationHelper | ||
include DialogHelper | ||
include Pagy::Frontend | ||
include DialogHelper | ||
include NavigationHelper | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Rosetta | ||
module NavigationHelper | ||
def tab_link_to(name = nil, options = nil, html_options = nil, &block) | ||
is_current_page = current_page?(block_given? ? name : options) | ||
|
||
css_classes = class_names( | ||
"flex group whitespace-nowrap border-b-2 px-1 py-4 text-sm font-medium", | ||
"active border-indigo-500 text-indigo-600": is_current_page, | ||
"border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700": !is_current_page | ||
) | ||
|
||
html_options = { class: css_classes, aria: { current: "page" } } | ||
|
||
if block_given? | ||
link_to(name, html_options, &block) | ||
else | ||
link_to(name, options, html_options) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/views/rosetta/locales/translations/_navigation.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="mt-6"> | ||
<div class="border-b border-gray-200 flex justify-between items-center"> | ||
<nav class="-mb-px flex space-x-8" aria-label="Tabs"> | ||
<%= tab_link_to "All", locale_translations_path(@locale) %> | ||
|
||
<%= tab_link_to locale_translations_missing_index_path(@locale) do %> | ||
Missing | ||
<span class="ml-3 hidden md:inline-block rounded-full px-2.5 py-0.5 text-xs font-medium bg-gray-100 text-gray-900 group-[.active]:bg-indigo-100 group-[.active]:text-indigo-600"> | ||
<%= Rosetta::TranslationKey.with_missing_translation_in_locale(@locale).size %> | ||
</span> | ||
<% end %> | ||
</nav> | ||
|
||
<input type="text" placeholder="Search translations" class="input w-60"> | ||
</div> | ||
</div> |
8 changes: 4 additions & 4 deletions
8
...es/translations/_translation_key.html.erb → ...translation_key_with_translation.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters