Skip to content

Commit

Permalink
pagination for academic groups list and localization for pages switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
mpugach committed Sep 10, 2022
1 parent 6f46729 commit ff1697d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/academic_groups_controller.rb
Expand Up @@ -8,7 +8,7 @@ class AcademicGroupsController < ApplicationController
after_action :refresh_class_schedules_mv, only: %i[destroy update graduate]

def index
@academic_groups = policy_scope(AcademicGroup).by_active_title
@academic_groups = policy_scope(AcademicGroup).by_active_title.page(params[:page])

authorize AcademicGroup
end
Expand Down
2 changes: 2 additions & 0 deletions app/views/academic_groups/index.html.haml
Expand Up @@ -40,3 +40,5 @@
edit_academic_group_path(academic_group)
= link_to_destroy policy(academic_group).destroy?, academic_group

.col-xs-12.text-center
= paginate @academic_groups
21 changes: 21 additions & 0 deletions config/locales/kaminari.ru.yml
@@ -0,0 +1,21 @@
ru:
views:
pagination:
first: "&laquo; Первая"
last: "Последняя &raquo;"
previous: "&lsaquo; Предыдущая"
next: "Следующая &rsaquo;"
truncate: "&hellip;"
helpers:
page_entries_info:
entry:
zero: "entries"
one: "entry"
other: "entries"
one_page:
display_entries:
zero: "No %{entry_name} found"
one: "Displaying <b>1</b> %{entry_name}"
other: "Displaying <b>all %{count}</b> %{entry_name}"
more_pages:
display_entries: "Displaying %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> of <b>%{total}</b> in total"
21 changes: 21 additions & 0 deletions config/locales/kaminari.uk.yml
@@ -0,0 +1,21 @@
uk:
views:
pagination:
first: "&laquo; Перша"
last: "Остання &raquo;"
previous: "&lsaquo; Попередня"
next: "Наступна &rsaquo;"
truncate: "&hellip;"
helpers:
page_entries_info:
entry:
zero: "entries"
one: "entry"
other: "entries"
one_page:
display_entries:
zero: "No %{entry_name} found"
one: "Displaying <b>1</b> %{entry_name}"
other: "Displaying <b>all %{count}</b> %{entry_name}"
more_pages:
display_entries: "Displaying %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> of <b>%{total}</b> in total"
2 changes: 1 addition & 1 deletion spec/controllers/academic_groups_controller_spec.rb
Expand Up @@ -80,7 +80,7 @@
end

context 'get: :index with ["academic_group:index"]' do
Given { allow(AcademicGroup).to receive_message_chain(:all, :by_active_title).and_return('some records') }
Given { allow(AcademicGroup).to receive_message_chain(:all, :by_active_title, :page).and_return('some records') }

Given(:action) { get :index }
Given(:expectation) do
Expand Down

0 comments on commit ff1697d

Please sign in to comment.