Giter VIP home page Giter VIP logo

bullet_train-sortable's Introduction

bullet_train-sortable's People

Contributors

andrewculver avatar pascallaliberte avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bullet_train-sortable's Issues

enableSortable doesn't run after turbo-frame updates

Using turbo streams, sortable does not re-initialize after a turbo update.

I'm using turbo frames and more specifically a turbo_stream.update to re-render a list page.

As a super hack I tried catching 'turbo:frame-load' and triggering 'sprinkles:update' so that the sortable hooks run. This worked, but it was pretty gross. Moreover, there is no turbo after-stream render event (and looks like there never will be hotwired/turbo#92 ) so I can't get sortable to re-initialize then.

The reason turbo isn't going to send that event is because they want everything to move to stimulus. AFAICT that makes sense here too and everything will work if we stimul-ify https://github.com/bullet-train-co/bullet_train-sortable/blob/main/app/javascript/concerns/sortable.js

I can try to PR that in if this sounds like the right approach to you.

saveSortOrder doesn't include csrf token

Steps to reproduce:

Step 1: Prepare a demo project

1.1 Start a new project from the starter repo
1.2 run bin/configure and name application to "Sortable Demo"
1.3. run bin/setup

Step 2: Add a sortable super scaffolded resource

2.1 Create a model: rails g model Book name:string team:references sort_order:integer
2.2 Make sure Team has_many :books
2.3 Super Scaffold a Books Resource with --sortable flag: bin/super-scaffold crud Book Team name:string --sortable

Step 3: Add books, re-order, check console, refresh the page

3.1 Run bin/dev, create an account and from the dashboard, add books
3.2 When a few books are added, attempt a re-order by dragging books into a different order
3.3 Check the console, you should see an 422 error logged into the console
3.4 Refresh the page. The order of books should not be the same as before the refresh

To fix:

  • Make sure that the $.post() request includes the csrf-token meta tag content. This should be in by default across the whole project, but for some reason @rails/ujs doesn't pick up jQuery's inclusion into the project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.