Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic example documentation #77

Open
gregjohnsonsaltaire opened this issue May 8, 2022 · 1 comment
Open

Basic example documentation #77

gregjohnsonsaltaire opened this issue May 8, 2022 · 1 comment
Labels

Comments

@gregjohnsonsaltaire
Copy link
Contributor

Hi @bartblast, would it be possible to update the README.md "Basic example" documentation?

Maybe I'm missing something obvious, but in the example ...

  • How is command ":save_to_db" called?
  • How is ":counter_saved" used?
  • Is "Repo.update" commented out because it's yet to be implemented or should it work?

Also ...

  • What would an example that rendered say a list of todo items with data sourced from the server look like (or is planned to look like)?
  • What would an example that dynamically added/removed fields, say similar to LiveView/EEX <%= ... => look like (or is planned to look like)?

Many thanks ...

@bartblast
Copy link
Owner

  • How is command ":save_to_db" called?
  • How is ":counter_saved" used?
  • Is "Repo.update" commented out because it's yet to be implemented or should it work?

Hey @gregjohnsonsaltaire,
:save_to_db is just an example of some command that you would trigger either through action or directy from the DOM. I didn't show it in the README example.
For example you would have a form which would be pre-validated on client, and if it was valid :save_to_db command would be triggered (which would validate the data again on the backend) and insert the data to DB.
Same with :counter_saved - it justs shows that a command could return another action. For example you couldn't have some progress or loader running, and you want to notify the client that the command you requested finished successfully.
You can use anything inside the command and it should work - commands are not transpiled to JS and are run only on the server.

  • What would an example that rendered say a list of todo items with data sourced from the server look like (or is planned to look like)?

There will be "for" directive similar to the one used by Surface: https://surface-ui.org/template_syntax#{#for-...} . It's not done yet, but is in v0.2.0 roadmap.

  • What would an example that dynamically added/removed fields, say similar to LiveView/EEX <%= ... => look like (or is planned to look like)?

Can you elaborate? Do you mean interpolation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants