Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lazy translation lookups for the user_blocks partials #1827

Merged
merged 1 commit into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions app/views/user_blocks/_block.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<td class="<%= c1 %>"><%=h block_status(block) %></td>
<td class="<%= c1 %>">
<% if block.revoker_id.nil? %>
<%= t('user_block.partial.not_revoked') %>
<%= t('.not_revoked') %>
<% else %>
<%= link_to h(block.revoker.display_name), user_path(block.revoker) %>
<% end %>
</td>
<td class="<%= c1 %>"><%= link_to t('user_block.partial.show'), block %></td>
<td class="<%= c1 %>"><% if current_user and current_user.id == block.creator_id and block.active? %><%= link_to t('user_block.partial.edit'), edit_user_block_path(block) %><% end %></td>
<td class="<%= c1 %>"><%= link_to t('.show'), block %></td>
<td class="<%= c1 %>"><% if current_user and current_user.id == block.creator_id and block.active? %><%= link_to t('.edit'), edit_user_block_path(block) %><% end %></td>
<% if show_revoke_link %>
<td class="<%= c1 %>"><% if block.active? %><%= link_to t('user_block.partial.revoke'), :controller => 'user_blocks', :action => 'revoke', :id => block.id %><% end %></td>
<td class="<%= c1 %>"><% if block.active? %><%= link_to t('.revoke'), :controller => 'user_blocks', :action => 'revoke', :id => block.id %><% end %></td>
<% end %>
</tr>
20 changes: 10 additions & 10 deletions app/views/user_blocks/_blocks.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<table id="block_list" cellpadding="3">
<tr>
<% if show_user_name %>
<th><%= t'user_block.partial.display_name' %></th>
<th><%= t '.display_name' %></th>
<% end %>
<% if show_creator_name %>
<th><%= t'user_block.partial.creator_name' %></th>
<th><%= t '.creator_name' %></th>
<% end %>
<th><%= t'user_block.partial.reason' %></th>
<th><%= t'user_block.partial.status' %></th>
<th><%= t'user_block.partial.revoker_name' %></th>
<th><%= t '.reason' %></th>
<th><%= t '.status' %></th>
<th><%= t '.revoker_name' %></th>
<th></th>
<th></th>
<% if show_revoke_link %>
Expand All @@ -20,16 +20,16 @@

<ul class='secondary-actions'>
<% if @user_blocks_pages.current_page.number > 1 -%>
<li><%= link_to t('user_block.partial.previous'), @params.merge({ :page => @user_blocks_pages.current_page.number - 1 }) %></li>
<li><%= link_to t('.previous'), @params.merge({ :page => @user_blocks_pages.current_page.number - 1 }) %></li>
<% else -%>
<li><%= t('user_block.partial.previous') %></li>
<li><%= t('.previous') %></li>
<% end -%>

<li><%= t('user_block.partial.showing_page', :page => @user_blocks_pages.current_page.number) %></li>
<li><%= t('.showing_page', :page => @user_blocks_pages.current_page.number) %></li>

<% if @user_blocks_pages.current_page.number < @user_blocks_pages.page_count -%>
<li><%= link_to t('user_block.partial.next'), @params.merge({ :page => @user_blocks_pages.current_page.number + 1 }) %></li>
<li><%= link_to t('.next'), @params.merge({ :page => @user_blocks_pages.current_page.number + 1 }) %></li>
<% else -%>
<li><%= t('user_block.partial.next') %></li>
<li><%= t('.next') %></li>
<% end -%>
</ul>
29 changes: 15 additions & 14 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2159,20 +2159,6 @@ en:
period:
one: "1 hour"
other: "%{count} hours"
partial:
show: "Show"
edit: "Edit"
revoke: "Revoke!"
confirm: "Are you sure?"
display_name: "Blocked User"
creator_name: "Creator"
reason: "Reason for block"
status: "Status"
revoker_name: "Revoked by"
not_revoked: "(not revoked)"
showing_page: "Page %{page}"
next: "Next »"
previous: "« Previous"
helper:
time_future: "Ends in %{time}."
until_login: "Active until the user logs in."
Expand Down Expand Up @@ -2202,6 +2188,21 @@ en:
back: "View all blocks"
revoker: "Revoker:"
needs_view: "The user needs to log in before this block will be cleared."
user_blocks:
block:
not_revoked: "(not revoked)"
show: "Show"
edit: "Edit"
revoke: "Revoke!"
blocks:
display_name: "Blocked User"
creator_name: "Creator"
reason: "Reason for block"
status: "Status"
revoker_name: "Revoked by"
showing_page: "Page %{page}"
next: "Next »"
previous: "« Previous"
note:
description:
opened_at_html: "Created %{when} ago"
Expand Down