Code Monkey home page Code Monkey logo

Comments (6)

ain avatar ain commented on June 26, 2024 5

Any updates here? I'm facing the exact same challenge.

from rails_admin_nestable.

hainam8x avatar hainam8x commented on June 26, 2024 1

Hi, do you have any update on this issues, I having exact the same issues

from rails_admin_nestable.

gotjosh avatar gotjosh commented on June 26, 2024

I have managed to figure out a way this could work. I believe that by adding an additional action that attaches itself to a member and specifying the scope should be a viable option for when you want to add a member action to sort it's children.

Something along the lines of Team -> Players where:

class Team < ActiveRecord::Base
  nestable_member({
    scope: :players
  })
end

This would add a member action on each team that allows players to be sorted. Please let me know if this is a functionality you would like to have inside the gem.

I believe the most effort should be applied in extracting the re-usable parts of the controller Proc in order keep it as DRY as possible and nifty packed into objects.

from rails_admin_nestable.

dalpo avatar dalpo commented on June 26, 2024

Hi @gotjosh!
I was thinking to refactor the codebase and implement the same member action for a long time, but I never found the time to realize it.

I didn't understand if you want to realize the nestable_member as a model's class method or as a rails_admin DSL. For instance:

RailsAdmin.model 'Team' do
  nestable_member({
    scope: :players
  })
end

Personally I prefer the DSL approach.

Anyway I would really appreciate a PR with nestable_member implementation 😃

from rails_admin_nestable.

dalpo avatar dalpo commented on June 26, 2024

Moreover I was thinking that we could need to sort different kind of children by a single parent...

What do you think about to receive a nested set of hash in the nestable_member method?
For instance given Team with many Players and many Coaches, we could need the ability to sort the both children models by a single Team record.

So we could approach that with a something like this:

RailsAdmin.model 'Team' do
  nestable_member :players, coaches: {
    position_field: :ranking,
    live_update: true
  }
end

Let me know what do you think

from rails_admin_nestable.

JArmando avatar JArmando commented on June 26, 2024

Fantastic! I'll be working with @gotjosh on (by Friday) this one since we're pairing for the implementation of the client work that needed this.

We already have it up and running in our codebase, we would just need to extract it and open up the PR. Feel free to assign it to me.

from rails_admin_nestable.

Related Issues (20)

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.