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

Add example app #52

Merged
merged 4 commits into from
Jul 7, 2024
Merged

Add example app #52

merged 4 commits into from
Jul 7, 2024

Conversation

Kijewski
Copy link
Collaborator

@Kijewski Kijewski commented Jul 6, 2024

I thought: We explain a lot in the book, use all functions in the tests, but we have no real example application so you can see rinja in action in a half-way realistic setting.

Todo:

  • write a README
  • add some comments in the source
  • adding a french translation in the templates

If that is a good example, I don't know. I was too lazy to write the ubiquitous TODO-app example.

@GuillaumeGomez
Copy link
Contributor

It's a very good idea! And basically, any example is better than no examples. 😉

@Kijewski Kijewski marked this pull request as ready for review July 6, 2024 11:21
@Kijewski Kijewski marked this pull request as draft July 6, 2024 11:22
@Kijewski Kijewski force-pushed the pr-example-app branch 2 times, most recently from f96bb6f to 6638c33 Compare July 7, 2024 00:23
</h2>

<ul id="lang-select">
{%- if lang != Lang::en -%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question: shouldn't it be == and also else if following?


<ul id="lang-select">
{%- if lang != Lang::en -%}
<li><a href="{{ req.url_for("index_handler", [Lang::en])? }}">This page in English</a></li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<li><a href="{{ req.url_for("index_handler", [Lang::en])? }}">This page in English</a></li>
<li><a href="{{ req.url_for("index_handler", [Lang::en])? }}">This page is in English.</a></li>

@Kijewski
Copy link
Collaborator Author

Kijewski commented Jul 7, 2024

Thank you for the translations! :)

In the bottom line I wanted to list links to all languages that are currently not selected, that's why I used if != without an else:

@GuillaumeGomez
Copy link
Contributor

Why not using an array then?

@Kijewski
Copy link
Collaborator Author

Kijewski commented Jul 7, 2024

Why not using an array then?

Sorry, I don't follow. What array?

@Kijewski Kijewski marked this pull request as ready for review July 7, 2024 18:48
@GuillaumeGomez
Copy link
Contributor

Nevermind. However, there is duplicated code between index.html and greet.html. Why not putting them into a "footer.html" file or equivalent and include it?

@Kijewski
Copy link
Collaborator Author

Kijewski commented Jul 7, 2024

I made the language selection footer a macro, to show that we have macros and how to use them. An include would possibly be more conventional, but I thought the might be a good case to show another feature. What do you think?

@GuillaumeGomez
Copy link
Contributor

I think it's a good idea. Well done!

@GuillaumeGomez GuillaumeGomez merged commit 8c12f7e into rinja-rs:master Jul 7, 2024
18 checks passed
@Kijewski Kijewski deleted the pr-example-app branch July 7, 2024 20:47
@Kijewski
Copy link
Collaborator Author

Kijewski commented Jul 7, 2024

Thanks! And thank you for your reviews! :)

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

Successfully merging this pull request may close these issues.

2 participants