| 1234567891011121314151617181920 |
- // This file demonstrates the spry-mkconst workflow:
- // 1. The HTML template (UserContentComponent.vala.html) is converted to a const using spry-mkconst
- // 2. The generated const (USER_CONTENT_COMPONENT_VALA_HTML) is referenced in the markup property
- // 3. This allows the Vala language server to still recognize this file as valid Vala code
- class UserContentComponent : Component {
- public override string markup { get { return USER_CONTENT_COMPONENT_VALA_HTML; } }
- private HttpContext http_context = inject<HttpContext>();
- public async override void handle_action(string action) throws Error {
- this["message"].text_content = http_context.request.query_params.get_any_or_default("message") ?? "No message provided!";
- this["action"].text_content = action;
- }
- }
- // Generated by spry-mkconst (would be in a separate file or included via build system):
- // const string USER_CONTENT_COMPONENT_VALA_HTML = """
- // <p>You said: <strong sid="message"></strong> <em>(via <span sid="action"></span>)</em></p>
- // """;
|