Commit 3a96c8d1 by Mykhailo Makohin

finish to translate activeadmin

parent 939584b5
...@@ -9,6 +9,8 @@ ActiveAdmin.register_page "Dashboard" do ...@@ -9,6 +9,8 @@ ActiveAdmin.register_page "Dashboard" do
end end
end end
# menu priority: 2, label: proc { I18n.t("active_admin.models.user.other") }
# Here is an example of a simple dashboard with columns and panels. # Here is an example of a simple dashboard with columns and panels.
# #
# columns do # columns do
......
ActiveAdmin.register User do ActiveAdmin.register User do
menu label: proc{ I18n.t "active_admin.models.user.other" }
filter :email filter :email, label: I18n.t("active_admin.attributes.user.email")
filter :name filter :name, label: I18n.t("active_admin.attributes.user.name")
filter :location filter :location, label: I18n.t("active_admin.attributes.user.location")
filter :created_at filter :created_at, label: I18n.t("active_admin.attributes.user.created_at")
filter :updated_at filter :updated_at, label: I18n.t("active_admin.attributes.user.updated_at")
filter :role filter :role, label: I18n.t("active_admin.attributes.user.role")
permit_params :email, :role, :name, :location, :avatar permit_params :email, :role, :name, :location, :avatar, :password, :password_confirmation, :role
index do index title: proc{ I18n.t "active_admin.models.user.other" } do
selectable_column selectable_column
id_column id_column
column :email column I18n.t "active_admin.attributes.user.avatar" do |u|
column :name if u.avatar?
column :location image_tag u.avatar_url, height: '50'
column :created_at end
column :updated_at end
column :role column I18n.t "active_admin.attributes.user.name" do |u|
u.name
end
column I18n.t "active_admin.attributes.user.email" do |u|
u.email
end
column I18n.t "active_admin.attributes.user.location" do |u|
u.location
end
column I18n.t "active_admin.attributes.user.created_at" do |u|
u.created_at
end
column I18n.t "active_admin.attributes.user.updated_at" do |u|
u.updated_at
end
column I18n.t "active_admin.attributes.user.role" do |u|
(t "active_admin.attributes.user/role.#{u.role}")
end
actions actions
end end
show do
show title: :name do attributes_table do
panel "User Details" do row :id
attributes_table_for user, :email, :name, :location, :created_at, row I18n.t "active_admin.attributes.user.name" do |u|
:updated_at, :role u.name
end
row I18n.t "active_admin.attributes.user.email" do |u|
u.email
end
row I18n.t "active_admin.attributes.user.location" do |u|
u.location
end
row I18n.t "active_admin.attributes.user.role" do |u|
(t "active_admin.attributes.user/role.#{u.role}")
end
row I18n.t "active_admin.attributes.user.created_at" do |u|
u.created_at
end
row I18n.t "active_admin.attributes.user.updated_at" do |u|
u.updated_at
end
end end
end end
form do |f| form do |f|
f.inputs do f.inputs do
f.input :email f.input :email, label: "#{t "active_admin.attributes.user.email"}"
f.input :name f.input :name, label: "#{t "active_admin.attributes.user.name"}"
f.input :location f.input :location, label: "#{t "active_admin.attributes.user.location"}"
f.input :password f.input :password, label: "#{t "active_admin.attributes.user.password"}"
f.input :password_confirmation f.input :password_confirmation, label: "#{t "active_admin.attributes.user.password_confirmation"}"
f.input :role f.input :role, as: :select, collection: User.roles.map { |role| [I18n.t("active_admin.user/role.#{role[0]}"), role[0]] },
f.input :avatar label: (t "active_admin.attributes.user.role")
f.input :avatar, label: "#{t "active_admin.attributes.user.avatar"}"
end end
f.actions f.actions
end end
......
...@@ -30,6 +30,7 @@ class UsersController < ApplicationController ...@@ -30,6 +30,7 @@ class UsersController < ApplicationController
def update def update
@user = resource @user = resource
if @user.update(user_params) if @user.update(user_params)
sign_in @user
redirect_to user_path(user: @user) redirect_to user_path(user: @user)
else else
render :edit render :edit
...@@ -53,7 +54,7 @@ class UsersController < ApplicationController ...@@ -53,7 +54,7 @@ class UsersController < ApplicationController
end end
def user_params def user_params
params.require(:user).permit(:email, :name, :location, :picture, :avatar) params.require(:user).permit(:email, :name, :location, :picture, :avatar, :role)
end end
end end
\ No newline at end of file
en: en:
activerecord: user: "User"
admin: "Admin"
formtastic:
actions:
create: "Create my %{model}"
update: "Save changes"
reset: "Reset form"
cancel: "Cancel and go back"
dummie: "Launch!"
active_admin:
user/role:
admin: "Admin"
user: "User"
models: models:
comment: user:
one: "Comment" one: "User"
other: "Comments" other: "Users"
active_admin/comment:
one: "Comment"
other: "Comments"
attributes: attributes:
active_admin/comment: user:
author_type: "Author type" email: "Email"
body: "Body" name: "Name"
location: "Location"
created_at: "Created" created_at: "Created"
namespace: "Namespace"
resource_type: "Resource type"
updated_at: "Updated" updated_at: "Updated"
active_admin: role: "Role"
dashboard: "Dashboard" password: "Password"
password_confirmation: "Password confirmation"
avatar: "Avatar"
dashboard: Dashboard
dashboard_welcome: dashboard_welcome:
welcome: "Welcome to Active Admin. This is the default dashboard page." welcome: "Welcome to Active Admin. This is the default dashboard page."
call_to_action: "To add dashboard sections, checkout 'app/admin/dashboard.rb'" call_to_action: "To add dashboard sections, checkout 'app/admin/dashboards.rb'"
view: "View" view: "View"
edit: "Edit" edit: "Edit"
delete: "Delete" delete: "Delete"
...@@ -37,7 +48,6 @@ en: ...@@ -37,7 +48,6 @@ en:
has_many_new: "Add New %{model}" has_many_new: "Add New %{model}"
has_many_delete: "Delete" has_many_delete: "Delete"
has_many_remove: "Remove" has_many_remove: "Remove"
move: "Move"
filters: filters:
buttons: buttons:
filter: "Filter" filter: "Filter"
...@@ -49,12 +59,6 @@ en: ...@@ -49,12 +59,6 @@ en:
ends_with: "Ends with" ends_with: "Ends with"
greater_than: "Greater than" greater_than: "Greater than"
less_than: "Less than" less_than: "Less than"
gteq_datetime: "Greater or equal to"
lteq_datetime: "Lesser or equal to"
from: "From"
to: "To"
scopes:
all: "All"
search_status: search_status:
headline: "Search status:" headline: "Search status:"
current_scope: "Scope:" current_scope: "Scope:"
...@@ -151,10 +155,10 @@ en: ...@@ -151,10 +155,10 @@ en:
resend_confirmation_instructions: "Resend confirmation instructions" resend_confirmation_instructions: "Resend confirmation instructions"
unsupported_browser: unsupported_browser:
headline: "Please note that ActiveAdmin no longer supports Internet Explorer versions 8 or less." headline: "Please note that ActiveAdmin no longer supports Internet Explorer versions 8 or less."
recommendation: "We recommend that you <a href=\"http://browsehappy.com/\">upgrade your browser</a> to improve your experience." recommendation: "We recommend upgrading to the latest <a href=\"http://windows.microsoft.com/ie\">Internet Explorer</a>, <a href=\"https://chrome.google.com/\">Google Chrome</a>, or <a href=\"https://mozilla.org/firefox/\">Firefox</a>."
turn_off_compatibility_view: "If you are using IE 9 or later, make sure you <a href=\"https://support.microsoft.com/en-us/help/17471\">turn off \"Compatibility View\"</a>." turn_off_compatibility_view: "If you are using IE 9 or later, make sure you <a href=\"https://support.microsoft.com/en-gb/help/17471\">turn off \"Compatibility View\"</a>."
access_denied: access_denied:
message: "You are not authorized to perform this action." message: "You are not authorised to perform this action."
index_list: index_list:
table: "Table" table: "Table"
block: "List" block: "List"
......
uk: uk:
user: "Користувач"
admin: "Адмін"
formtastic:
actions:
create: "Створити"
update: "Зберегти зміни"
reset: "Очистити форму"
cancel: "Назад"
dummie: "Launch!"
time:
formats:
long: "%Y-%m-%d %H:%M:%S"
active_admin: active_admin:
models:
user:
one: "Користувач"
other: "Користувачі"
user/role:
admin: "Адмін"
user: "Користувач"
attributes:
user:
email: "Email"
name: "Ім'я"
location: "Місце проживання"
created_at: "Створений"
updated_at: "Оновлений"
role: "Роль"
password: "Пароль"
password_confirmation: "Підтвердження паролю"
avatar: "Аватар"
dashboard: "Панель керування" dashboard: "Панель керування"
dashboard_welcome: dashboard_welcome:
welcome: "Ласкаво просимо до Active Admin. Це стандартна сторінка керування сайтом." welcome: "Ласкаво просимо до Active Admin. Це стандартна сторінка керування сайтом."
...@@ -8,9 +38,9 @@ uk: ...@@ -8,9 +38,9 @@ uk:
edit: "Змінити" edit: "Змінити"
delete: "Видалити" delete: "Видалити"
delete_confirmation: "Ви впевнені, що хочете це видалити?" delete_confirmation: "Ви впевнені, що хочете це видалити?"
new_model: "Створити %{model}" new_model: "Створити"
edit_model: "Змінити %{model}" edit_model: "Змінити"
delete_model: "Видалити %{model}" delete_model: "Видалити"
details: "%{model} детальніше" details: "%{model} детальніше"
cancel: "Скасувати" cancel: "Скасувати"
empty: "Пусто" empty: "Пусто"
......
uk: uk:
# header:
# platfform: 'про платформу'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment