GithubHelp home page GithubHelp logo

Comments (4)

jstayton avatar jstayton commented on August 15, 2024

Hey Nick,

I'm not quite sure I understand. Are you saying you'd like to render HTML like...

<ol>
  <li>The Title of Something</li>
  <li>Something Else</li>
  <li>And a Third</li>
</ol>

...and have Marco Polo automatically search through those?

An example of what you're doing would be helpful. Thanks!

from jquery-marcopolo.

firedev avatar firedev commented on August 15, 2024

Well generally speaking yes. I would like something like this. You see it's really easy to render list of partials but having 2 set of templates is quickly becomes tiresome especially when you have complex objects to render.

Instead of, say:

[
  {
    "id": 1,
    "title": "Whatever",
    "body": "Text goes here"
    ...
    "nested": { }
  }, 
  {...},
  {...},
]

I would like to be able to accept an html collection like this (since Marcopolo expects JSON without a root node I think flat list would be more appropriate, plus it's more convenient to render).

<div id="object_1" class="object">
   Complex output here
</div>
<div id="object_2" class="object">
   ...
</div>

So I don't have to render each item in Javascript. Is there any clever trick to do so?

from jquery-marcopolo.

jstayton avatar jstayton commented on August 15, 2024

I don't think there's a clever trick to get that working right now. Since Marco Polo expects the response from the url endpoint to be JSON, it'll error out with anything like XML or HTML. Support for those could probably be built in, but it's not something on the horizon.

My suggestion for now would be to use something like ActiveModel::Serializers to output the JSON, rather than templates/partials. That should be a bit easier to maintain.

from jquery-marcopolo.

firedev avatar firedev commented on August 15, 2024

Thanks. Thats what I do, I don't have problems with rendering models to JSON. The tricky part is rendering them back to HTML in Marcopolo.

from jquery-marcopolo.

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.