Pagination links are broken in asset-field-modal


(Matthew Ager) #1

Hi,

Thanks for making this open source - its a really nice idea.

The major issue I’m having is upon clicking “Pick media” in an asset field, if there are more than 12 images in the resultant popup the pagination links are visible. Clicking one of the page numbers (> 1) or “next” sends the request to the server, but the page param doesn’t arrive so the page is not updated (leaving the contents of page 1 still showing).

I see that in the assets_controller it is expecting a page param: PushType::Asset.not_trash.page(params[:page]).per(12)

To contrast, the pagination links on the Media#Index page work fine.

Thanks!


(Aaron Russell) #2

Thanks for reporting this. I’ll take a look and see what’s going on.


(Aaron Russell) #3

Hey @mat2maa I’ve tried to recreate this but everything seems to be working ok. At least on our production sites where we have a load of images.

Can you confirm what version of PushType and what browser your are using? Thanks


(Matthew Ager) #4

Hi @aaron,

  • PushType version 0.9.5
  • Ruby Version 2.3.1
  • Rails Version 5.0.0.1
  • OS X Version 10.11.6
  • Chrome Version 54.0.2840.98 (64-bit)
  • Safari Version 10.0.1

Just tested my code at the commit immediately following adding PushType and getting the same issue. At that point, there’s really not much in there that might interfere…

Are there any known conflicts or would it not make any difference anyway as PushType is an engine?

Cheers!


(Matthew Ager) #5

Just to show what’s happening:


(Aaron Russell) #6

Weird one. Looks like page 2 is momentarily selected but it immediately reverts to page one.

I’ve got a vague feeling that I have actually seen this before but I can’t remember when or what was up. I’ll try and dig through the commits. In the meantime are you able to take a look at the web browser console and confirm a few things:

  • Any javascript errors?
  • Is the request being sent to the server? - what is the path of the request?
  • Are there any parameters in the request? (I think you said not, but I wasn’t sure if you meant Rails doesnt get the page param or if no params get sent at all)

Cheers


(Aaron Russell) #7

Hey just to update you I have managed to recreate this now. I was testing on an older version before. Something is up with 0.9.5.

I’ll keep you posted on this.


(Aaron Russell) #8

Hey @mat2maa

The good news. This issue is fixed:

The bad news. The master branch is not stable at the moment as I’m gearing up for v0.10.0. There is a beta version you can try (0.10.0.beta.3), but I’ve had a few issues with some of the changes in this release and there are a few breaking changes. You might want to hold fire upgrading until I’ve had chance to document the upgrade and tested things a bit more thoroughly.


(Matthew Ager) #9

Hi @aaron,

Thanks for the updates and the fix.

Usually I’d like to fork the repo and then cherry pick this commit, however I would then need to reference the git repo in the Gemfile and fall into this hole: https://discuss.pushtype.org/t/getting-couldnt-find-file-webpack-admin-bundle-when-i-run-dev-server/138.

How would you recommend I proceed? There are a few bits I would like to customise anyway (SVG support, Dragonfly up-front-processing to name a couple) that might not be priorities on your roadmap (or on it at all) - so its well worth me maintaining a fork, rather than filling up my app with decorators.

Just a note on the SVG issue above, they upload fine, but links sources of the form src="/media/2016/11/17/4ws32cd79b_Filename.svg?style=push_type_thumb" are broken. Removing the ?style=push_type_thumb shows it.

Cheers!


(Aaron Russell) #10

Hi @mat2maa

If you’d like to make changes to PushType and maintain a fork, the main thing is you need to have a Node.js environment for the admin front end assets.

I’m working on some contribution guidelines currently, but a quick setup to get up and running:

> git clone git@github.com:pushtype/push_type.git
> cd push_type
> for d in core admin api auth; do cd $d && bundle install && cd ..; done
> bundle install
> cd admin && npm install && rake webpack

Note the rake webpack task at the end - that’s what builds the JavaScript assets for the admin engine. The compiled assets currently aren’t committed to the repo - this is what’s causing people problems. In future I’ll change that - they’ll have to be committed.

Let me know if you hit any stumbling blocks or need any help working with the code :thumbsup:

Re the SVG issue, that’s a bug. It looks like the Dragonfly endpoint is trying to resize SVGs like it would a bitmap. I’ll raise a bug for that - thanks.