sodal-project / cartographer

Cartographer version 1 is a complete rewrite adding the concept of modules.
1 stars 0 forks source link

Send view to client #17

Open tbenbow opened 1 month ago

tbenbow commented 1 month ago

Core will sometimes send a string back to the client that represents a piece of the interface. This has a few pieces to figure out...

  1. What post requests will return an interface string? What is a scenario where they would not send this back? TBD

  2. How do modules trigger this step? Perhaps a module triggers this or perhaps all post requests ask a module for the string. TBD

  3. This function is probably where handlbars templates are compiled. That will require a string from the module and a data object...

const markup = `
    <table border="1">
      <thead>
        <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Email</th>
            </tr>
        </thead>
        <tbody>
            {{#each users}}
                <tr>
                    <td>{{id}}</td>
                    <td>{{name}}</td>
                    <td>{{email}}</td>
                </tr>
            {{/each}}
        </tbody>
    </table>`

const data = {
  users: [
    { id: 1, name: 'John Doe', email: 'john@example.com' },
    { id: 2, name: 'Jane Smith', email: 'jane@example.com' },
    { id: 3, name: 'Sam Green', email: 'sam@example.com' }
  ]
};

const template = Handlebars.compile(markup)

const compiledMarkup = template(data)
  1. What area of the interface should the returned string go? There is probably a client side piece to this that is undetermined. TBD

This task has a number of unanswered questions!