Skip to content

Commit

Permalink
refactor i18n variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ElviaBth committed Apr 5, 2024
1 parent 3e6d477 commit c781002
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Decidim
module AnonymousCodes
module Admin
class CodeGroupsController < ApplicationController
helper_method :groups
helper_method :groups, :resource_path

def index; end

Expand Down Expand Up @@ -67,6 +67,10 @@ def groups
def code_group
@code_group ||= groups.find(params[:id])
end

def resource_path
"#"
end
end
end
end
Expand Down
24 changes: 12 additions & 12 deletions app/views/decidim/anonymous_codes/admin/code_groups/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="card">
<div class="card-divider">
<h2 class="card-title">
Access code groups
<a class="button tiny button--title new-access" href="<%= new_code_group_path %>"><%= t("decidim.anonymous_codes.admin.code_groups.index.new_access_code_group_button") %></a>
<%= t("code_groups.index.title", scope: "decidim.anonymous_codes.admin") %>
<a class="button tiny button--title new-access" href="<%= new_code_group_path %>"><%= t("code_groups.index.new_access_code_group_button", scope: "decidim.anonymous_codes.admin") %></a>
</h2>
</div>
<div class="card-section">
Expand All @@ -11,11 +11,11 @@
<table class="table-list">
<thead>
<tr>
<th><%= t("decidim.anonymous_codes.admin.code_groups.index.title") %></th>
<th><%= t("decidim.anonymous_codes.admin.code_groups.index.expires_at") %></th>
<th><%= t("decidim.anonymous_codes.admin.code_groups.index.active") %></th>
<th><%= t("decidim.anonymous_codes.admin.code_groups.index.num_of_tockens") %></th>
<th><%= t("decidim.anonymous_codes.admin.code_groups.index.max_reuses") %></th>
<th><%= t("code_groups.index.header_table_title", scope: "decidim.anonymous_codes.admin") %></th>
<th><%= t("code_groups.index.expires_at", scope: "decidim.anonymous_codes.admin") %></th>
<th><%= t("code_groups.index.active", scope: "decidim.anonymous_codes.admin") %></th>
<th><%= t("code_groups.index.num_of_tockens", scope: "decidim.anonymous_codes.admin") %></th>
<th><%= t("code_groups.index.max_reuses", scope: "decidim.anonymous_codes.admin") %></th>
<th></th>
</tr>
</thead>
Expand All @@ -28,9 +28,9 @@
<td><%= group.tokens.count %></td>
<td><%= group.max_reuses %></td>
<td class="table-list__actions">
<%= icon_link_to "circle-x", code_group_path(group.id), t("decidim.admin.actions.destroy"), method: :delete, class: "action-icon--remove", data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
<%= icon_link_to "pencil", edit_code_group_path(group.id), t("decidim.admin.actions.edit"), class: "action-icon--edit" %>
<%= icon_link_to "eye", t("decidim.admin.actions.preview"), class: "action-icon--preview" %>
<%= icon_link_to "circle-x", code_group_path(group.id), t("actions.destroy", scope: "decidim.anonymous_codes.admin"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.anonymous_codes.admin") } %>
<%= icon_link_to "pencil", edit_code_group_path(group.id), t("actions.edit", scope: "decidim.anonymous_codes.admin"), class: "action-icon--edit" %>
<%= icon_link_to "eye", t("actions.preview", scope: "decidim.anonymous_codes.admin"), class: "action-icon--preview" %>
</td>
</tr>
<% end %>
Expand All @@ -39,8 +39,8 @@
</div>
<% else %>
<div>
<p>No access code groups available.</p>
<p>Stert by adding an access code group from the "<a href="<%= new_code_group_path %>">New access code group</a>" button.</p>
<%= t("code_groups.index.no_access_code_groups_records", scope: "decidim.anonymous_codes.admin") %>
<p><%= t("code_groups.index.start_by", scope: "decidim.anonymous_codes.admin", button: link_to(t("code_groups.index.new_access_code_group_button", scope: "decidim.anonymous_codes.admin"), new_code_group_path)) %></p>
</div>
<% end %>
</div>
Expand Down
19 changes: 10 additions & 9 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
---
en:
decidim:
admin:
actions:
confirm_destroy: Are you sure you want to delete this %{name}?
destroy: Delete
edit: Edit
preview: Preview
menu:
anonymous_codes: Access Codes
anonymous_codes:
admin:
actions:
confirm_destroy: Are you sure you want to delete this access code group?
destroy: Delete
edit: Edit
preview: Preview
code_groups:
create:
invalid: There was a problem creating this access code group
Expand All @@ -27,15 +24,19 @@ en:
index:
active: Active
expires_at: Expires at
header_table_title: Title
max_reuses: Re-use max
new_access_code_group_button: New access code group
no_access_code_groups_records: No access code groups available.
num_of_tockens: Num. of Tockens
title: Title
start_by: Start by adding an access code group from the "%{button}" button.
title: Access code groups
new:
title: New access code group
update:
invalid: There was a problem updating this access code group
success: Access code group successfully updated
menu_title: Access Codes
surveys_component_settings:
callout:
group_locked: This survey can only be answered by using a valid code.
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/anonymous_codes/admin_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def load_seed
initializer "decidim-anonymous_codes.admin_menu" do
Decidim.menu :admin_menu do |menu|
menu.add_item :anonymous_codes_menu,
I18n.t("menu.anonymous_codes", scope: "decidim.admin"),
I18n.t("menu_title", scope: "decidim.anonymous_codes.admin"),
decidim_admin_anonymous_codes.code_groups_path,
icon_name: "hard-drive",
position: 7.5,
Expand Down

0 comments on commit c781002

Please sign in to comment.