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

Extend the environment #156

Merged
merged 16 commits into from
Jan 10, 2025
Merged

Extend the environment #156

merged 16 commits into from
Jan 10, 2025

Conversation

mattesmohr
Copy link
Member

@mattesmohr mattesmohr commented Oct 28, 2024

This pull request adds statements to the environment allowing views to be shown based on conditional terms or to loop over a sequence within an environment context, while it is unfortunately not feasible with native statements.

Environment.check(user.loggedIn) {
   Paragraph {
      "True"
   }
}

Environment.check(user.lastName == "Polo" && user.firstName == "Marco") {
   Paragraph {
      "True"
   }
} then: {
   Paragraph {
      "False"
   }
}

Environment.loop(user.roles) { role in
   Paragraph {
      role
   }
}

Environment.unwrap(user.avatar) { avatar in
   Image()
      .source(avatar)
} then: {
   Paragraph {
      "No image found"
   }
}

I also want to state that I am not completely satisfied with the naming yet and may change it in the future.

@mattesmohr mattesmohr marked this pull request as ready for review January 10, 2025 19:18
@mattesmohr mattesmohr merged commit 8d87959 into main Jan 10, 2025
1 check passed
@mattesmohr mattesmohr deleted the extend-the-environment branch January 10, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant