From e13c3d92711704368920a05478864f9d5f307cdb Mon Sep 17 00:00:00 2001 From: Karan Kiri Date: Fri, 21 Jun 2024 21:34:40 +0530 Subject: [PATCH] feat: Transaction pagination Improvements (#873) * feat: make transaction container fixed height * feat: pagination per page query * fix: linting errors * Changelog page that pulls from Github Release notes (#867) * Changelog page that pulls from Github Release notes * Review changelog page styles * Move changelog page title to i18n translations * Bump to 0.1.0-alpha.6 Signed-off-by: Zach Gollwitzer * Bump aws-sdk-s3 from 1.152.0 to 1.152.3 (#880) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.152.0 to 1.152.3. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-s3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump mocha from 2.3.0 to 2.4.0 (#878) Bumps [mocha](https://github.com/freerange/mocha) from 2.3.0 to 2.4.0. - [Changelog](https://github.com/freerange/mocha/blob/main/RELEASE.md) - [Commits](https://github.com/freerange/mocha/compare/v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: mocha dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump octokit from 8.1.0 to 9.1.0 (#877) Bumps [octokit](https://github.com/octokit/octokit.rb) from 8.1.0 to 9.1.0. - [Release notes](https://github.com/octokit/octokit.rb/releases) - [Changelog](https://github.com/octokit/octokit.rb/blob/main/RELEASE.md) - [Commits](https://github.com/octokit/octokit.rb/compare/v8.1.0...v9.1.0) --- updated-dependencies: - dependency-name: octokit dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rails from `f9c847f` to `5d34172` (#879) Bumps [rails](https://github.com/rails/rails) from `f9c847f` to `5d34172`. - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/f9c847fac102039d9174106f44b59144da267751...5d34172ff44ec0c88ac03a979679b31e1ed78745) --- updated-dependencies: - dependency-name: rails dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Zach Gollwitzer * Update issue templates * Add merchant select when editing transaction (#885) * Transaction transfers, payments, and matching (#883) * Add transfer model and clean up family snapshot fixtures * Ignore transfers in income and expense snapshots * Add transfer validations * Implement basic transfer matching UI * Fix merge conflicts * Add missing translations * Tweak selection states for transfer types * Add missing i18n translation * Ensure correct form's hidden input for selectedIds (#891) * feat: make transaction container fixed height * feat: pagination per page query * fix: linting errors * Transaction transfers, payments, and matching (#883) * Add transfer model and clean up family snapshot fixtures * Ignore transfers in income and expense snapshots * Add transfer validations * Implement basic transfer matching UI * Fix merge conflicts * Add missing translations * Tweak selection states for transfer types * Add missing i18n translation * feat: make transaction container fixed height * feat: pagination per page query * fix: linting errors * revert unnecessary changes * revert unnecessary changes * code review changes * code review changes * code review changes * remove unused imports * fix: unit tests * remove border * fix: transaction padding * fix: transaction container height --------- Signed-off-by: Zach Gollwitzer Signed-off-by: dependabot[bot] Signed-off-by: Karan Kiri Co-authored-by: Mattia Co-authored-by: Zach Gollwitzer Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Zach Gollwitzer Co-authored-by: Jakub Kottnauer Co-authored-by: ziraq young --- app/controllers/transactions_controller.rb | 2 +- app/views/layouts/with_sidebar.html.erb | 2 +- app/views/transactions/_pagination.html.erb | 81 +++++++++++-------- app/views/transactions/index.html.erb | 45 ++++++----- .../transactions/searches/_search.html.erb | 2 + config/locales/views/transactions/en.yml | 2 + .../transactions_controller_test.rb | 4 +- 7 files changed, 82 insertions(+), 56 deletions(-) diff --git a/app/controllers/transactions_controller.rb b/app/controllers/transactions_controller.rb index 0c569d9654b..98be1c396ca 100644 --- a/app/controllers/transactions_controller.rb +++ b/app/controllers/transactions_controller.rb @@ -6,7 +6,7 @@ class TransactionsController < ApplicationController def index @q = search_params result = Current.family.transactions.search(@q).ordered - @pagy, @transactions = pagy(result, items: 50) + @pagy, @transactions = pagy(result, items: params[:per_page] || "10") @totals = { count: result.select { |t| t.currency == Current.family.currency }.count, diff --git a/app/views/layouts/with_sidebar.html.erb b/app/views/layouts/with_sidebar.html.erb index f014dd666d4..ca824d45f5c 100644 --- a/app/views/layouts/with_sidebar.html.erb +++ b/app/views/layouts/with_sidebar.html.erb @@ -7,7 +7,7 @@ <%= render "layouts/sidebar" %> <% end %> -
+
<%= yield %>
diff --git a/app/views/transactions/_pagination.html.erb b/app/views/transactions/_pagination.html.erb index 2ad3149ab56..a485ce7111e 100644 --- a/app/views/transactions/_pagination.html.erb +++ b/app/views/transactions/_pagination.html.erb @@ -1,39 +1,56 @@ -