Skip to content

Paginate wishlist items #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

mcshakes
Copy link

Resolves #141

Description

Adds pagination.

Type of change

  • New feature (non-breaking change which adds functionality)

@mcshakes
Copy link
Author

While making the changes, I was tempted to add some data within the seeds to further test and edit the UI, but realized that is out of scope. So, I wanted to put in a request add more seeds for items, wishlist_items and some tests to fully flesh out functionality.

@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 October 22, 2017 20:35 Inactive
@leesharma
Copy link
Collaborator

@mcshakes That's a good idea; I made an issue (#157), and if we don't get a PR for it shortly, I'll make the change myself.

For now, I went onto your review app and added a bunch of items; that'll show you the current state of your PR. You can add items locally too by doing something similar to this in bin/rails console:

wishlist_item = WishlistItem.last
50.times do |n|
  new_item = wishlist_item.dup
  new_item.staff_message = "This is newly-added item ##{n+1}."
  new_item.save!
end

That'll add 50 new corgi plushes to your local app.

@mcshakes
Copy link
Author

@leesharma Sweet! Taking another look to correct some of the UI before pushing again

@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 October 26, 2017 22:14 Inactive
@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 October 26, 2017 22:54 Inactive
@mcshakes
Copy link
Author

@leesharma Ready to be merged, but looking at the conflicts; are those changes ones you wanted to keep?

@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 October 27, 2017 19:13 Inactive
@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 October 27, 2017 19:14 Inactive
Copy link
Collaborator

@invacuo invacuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of minor nits.

Can you push it up to the staging box again? Or include screenshots?

Thanks for your help!

@@ -3,7 +3,7 @@ class WishlistItemsController < ApplicationController

def index
skip_authorization
@wishlist_items = WishlistItem.includes(:item, :wishlist).priority_order
@wishlist_items = WishlistItem.includes(:item, :wishlist).page(params[:page]).per(10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work if we specify default_per_page = 10 in the config file and remove .per(10)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the .per(10) and using the config.yml instead for this

<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| %>
<% if page.left_outer? || page.right_outer? || page.inside_window? %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the auto generated files, right?

The indentation looks a little off. Is it possible to fix it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. It looks to be centered to the content div, but let me check and play around with it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

center

So, I'm pretty sure it is horizontally centered. I did add some top margins so it's uniform to the bottom and not hugging the line below the item

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was referring to code indentation not the alignment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, my mistake. Fixed with latest push

@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 November 21, 2017 03:07 Inactive
@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 November 24, 2017 19:23 Inactive
@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 November 24, 2017 21:33 Inactive
@micahbales micahbales temporarily deployed to project-playtime-stagin-pr-154 December 7, 2017 23:21 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants