Giter VIP home page Giter VIP logo

Comments (7)

pointlessone avatar pointlessone commented on July 29, 2024

@jaryl you may be interested in my branch.

Specifically this two commits:

  • cheba@357dcf18f385a20c16061e60bb5df0ca31be5fa0
  • cheba@4c8ae3250db263080b77c94a88c8628a56b9e317

from nested_form.

modsaid avatar modsaid commented on July 29, 2024

I needed something similar. but listing those in a TR tags in a table. had to modify the blueprint and the way it is handled

https://github.com/modsaid/nested_form

from nested_form.

nhocki avatar nhocki commented on July 29, 2024

Maybe having a selector option that jQuery would use will help. You may have something like:

link_to_add "Add Task", :tasks, :selector => "tr .task .fields"

from nested_form.

eostrom avatar eostrom commented on July 29, 2024

I ported cheba's basic change over to the latest code. I couldn't easily port the code that supported wrapper procs, and I didn't need it, so I let it go.

from nested_form.

elmatou avatar elmatou commented on July 29, 2024

@modsaid storing the blueprint in textarea is not a good idea, if you have a textarea in your form the <textarea> tag will respond with the </textarea> from the form, and give some strange results.
I also want to store table rows, and I'm facing this issue.
my first thought was to store the blueprint in a javascript variable... but I'm torn

For the record, I escaped the HTML with a rails helper, and then I sent it to javascript variable.

Server side :

  @template.after_nested_form(association) do
    model_object = object.class.reflect_on_association(association).klass.new
    "<script>window['#{association}_fields_blueprint']=\"#{@template.escape_javascript(fields_for(association, model_object, :child_index => "new_#{association}", &@fields[association]))}\";</script>"
  end

And then browser side :

  var content = window[assoc+'_fields_blueprint']; // Fields template

Works great !

from nested_form.

modsaid avatar modsaid commented on July 29, 2024

Thanks for the note @elmatou, this will be more generic of course..

from nested_form.

lest avatar lest commented on July 29, 2024

The original issue was fixed in e866f4f. I'm going to write a "How to" about using nested_form with tables. Thanks everyone!

from nested_form.

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.