diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b7e50e3..b040dd8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,6 +13,14 @@ module ApplicationHelper translate value, scope: [:enums, type] end + def open_action(url) + link_to url, role: :button, class: 'btn btn-light btn-sm' do + concat tag.i class: 'far fa-eye' + concat ' '.html_safe + concat translate :open_action + end + end + def bootstrap_class_for_flash(flash_type) case flash_type when 'success' diff --git a/app/views/federal_subjects/index.html.erb b/app/views/federal_subjects/index.html.erb index ee864e4..8ccc64f 100644 --- a/app/views/federal_subjects/index.html.erb +++ b/app/views/federal_subjects/index.html.erb @@ -39,11 +39,7 @@ <% if policy(federal_subject).show? %> - <%= link_to federal_subject, - role: :button, - class: 'btn btn-light btn-sm' do %> - - <% end %> + <%= open_action federal_subject %> <% end %> diff --git a/app/views/staffs/accounts/index.html.erb b/app/views/staffs/accounts/index.html.erb index 1f11033..61a2b77 100644 --- a/app/views/staffs/accounts/index.html.erb +++ b/app/views/staffs/accounts/index.html.erb @@ -36,10 +36,7 @@ <% if policy([:staff, account]).show? %> - <%= link_to [:staff, account], - role: :button, class: 'btn btn-light btn-sm' do %> - - <% end %> + <%= open_action [:staff, account] %> <% end %> diff --git a/app/views/staffs/people/index.html.erb b/app/views/staffs/people/index.html.erb index da9c153..f6eb829 100644 --- a/app/views/staffs/people/index.html.erb +++ b/app/views/staffs/people/index.html.erb @@ -46,10 +46,7 @@ <% if policy([:staff, person]).show? %> - <%= link_to [:staff, person], - role: :button, class: 'btn btn-light btn-sm' do %> - - <% end %> + <%= open_action [:staff, person] %> <% end %> diff --git a/config/locales/other/en.yml b/config/locales/other/en.yml index 9aa2198..fddbc44 100644 --- a/config/locales/other/en.yml +++ b/config/locales/other/en.yml @@ -6,3 +6,4 @@ en: :yes: Yes :no: No superuser: Administrator + open_action: Open diff --git a/config/locales/other/ru.yml b/config/locales/other/ru.yml index cf3feb6..41fdc6a 100644 --- a/config/locales/other/ru.yml +++ b/config/locales/other/ru.yml @@ -6,3 +6,4 @@ ru: :yes: Да :no: Нет superuser: Администратор + open_action: Открыть