{% macro news_moderation_alert(news, user, alpineState = None) %} {# An alert to display on top of unpublished news, with actions to either publish or delete them. The current state of the alert is accessible through the given `alpineState` variable. This state is a `AlertState`, as defined in `moderation-alert-index.ts` This comes in three flavours : - You can pass the `News` object itself to the macro. In this case, if `request.user` can publish news, it will perform an additional db query to know if it is a recurring event. - You can also give only the news id. In this case, a server request will be issued to know if it is a recurring event. - Finally, you can pass the name of an alpine variable, which value is the id. In this case, a server request will be issued to know if it is a recurring event. Example with full `News` object : ```jinja
{{ news_moderation_alert(news, user, "state") }}
``` With an id : ```jinja
{{ news_moderation_alert(news.id, user, "state") }}
``` An with an alpine variable ```jinja
{{ news_moderation_alert("newsId", user, "state") }}
``` Args: news: (News | int | string) Either the `News` object to which this alert is related, or its id, or the name of an Alpine which value is its id user: The request.user alpineState: An alpine variable name Warning: If you use this macro, you must also include `moderation-alert-index.ts` in your template. #}
{% endmacro %}