Struct mas_templates::Templates
source · pub struct Templates { /* private fields */ }
Expand description
Wrapper around minijinja::Environment
helping rendering the various
templates
Implementations§
source§impl Templates
impl Templates
sourcepub async fn load(
path: Utf8PathBuf,
url_builder: UrlBuilder,
vite_manifest_path: Utf8PathBuf,
translations_path: Utf8PathBuf,
branding: SiteBranding,
features: SiteFeatures,
) -> Result<Self, TemplateLoadingError>
pub async fn load( path: Utf8PathBuf, url_builder: UrlBuilder, vite_manifest_path: Utf8PathBuf, translations_path: Utf8PathBuf, branding: SiteBranding, features: SiteFeatures, ) -> Result<Self, TemplateLoadingError>
Load the templates from the given config
sourcepub async fn reload(&self) -> Result<(), TemplateLoadingError>
pub async fn reload(&self) -> Result<(), TemplateLoadingError>
Reload the templates on disk
sourcepub fn translator(&self) -> Arc<Translator>
pub fn translator(&self) -> Arc<Translator>
Get the translator
source§impl Templates
impl Templates
sourcepub fn render_not_found(
&self,
context: &WithLanguage<NotFoundContext>,
) -> Result<String, TemplateError>
pub fn render_not_found( &self, context: &WithLanguage<NotFoundContext>, ) -> Result<String, TemplateError>
sourcepub fn render_app(
&self,
context: &WithLanguage<AppContext>,
) -> Result<String, TemplateError>
pub fn render_app( &self, context: &WithLanguage<AppContext>, ) -> Result<String, TemplateError>
sourcepub fn render_swagger(
&self,
context: &ApiDocContext,
) -> Result<String, TemplateError>
pub fn render_swagger( &self, context: &ApiDocContext, ) -> Result<String, TemplateError>
sourcepub fn render_swagger_callback(
&self,
context: &ApiDocContext,
) -> Result<String, TemplateError>
pub fn render_swagger_callback( &self, context: &ApiDocContext, ) -> Result<String, TemplateError>
sourcepub fn render_login(
&self,
context: &WithLanguage<WithCsrf<LoginContext>>,
) -> Result<String, TemplateError>
pub fn render_login( &self, context: &WithLanguage<WithCsrf<LoginContext>>, ) -> Result<String, TemplateError>
sourcepub fn render_register(
&self,
context: &WithLanguage<WithCsrf<WithCaptcha<RegisterContext>>>,
) -> Result<String, TemplateError>
pub fn render_register( &self, context: &WithLanguage<WithCsrf<WithCaptcha<RegisterContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_consent(
&self,
context: &WithLanguage<WithCsrf<WithSession<ConsentContext>>>,
) -> Result<String, TemplateError>
pub fn render_consent( &self, context: &WithLanguage<WithCsrf<WithSession<ConsentContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_policy_violation(
&self,
context: &WithLanguage<WithCsrf<WithSession<PolicyViolationContext>>>,
) -> Result<String, TemplateError>
pub fn render_policy_violation( &self, context: &WithLanguage<WithCsrf<WithSession<PolicyViolationContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_sso_login(
&self,
context: &WithLanguage<WithCsrf<WithSession<CompatSsoContext>>>,
) -> Result<String, TemplateError>
pub fn render_sso_login( &self, context: &WithLanguage<WithCsrf<WithSession<CompatSsoContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_index(
&self,
context: &WithLanguage<WithCsrf<WithOptionalSession<IndexContext>>>,
) -> Result<String, TemplateError>
pub fn render_index( &self, context: &WithLanguage<WithCsrf<WithOptionalSession<IndexContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_account_verify_email(
&self,
context: &WithLanguage<WithCsrf<WithSession<EmailVerificationPageContext>>>,
) -> Result<String, TemplateError>
pub fn render_account_verify_email( &self, context: &WithLanguage<WithCsrf<WithSession<EmailVerificationPageContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_account_add_email(
&self,
context: &WithLanguage<WithCsrf<WithSession<EmailAddContext>>>,
) -> Result<String, TemplateError>
pub fn render_account_add_email( &self, context: &WithLanguage<WithCsrf<WithSession<EmailAddContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_recovery_start(
&self,
context: &WithLanguage<WithCsrf<RecoveryStartContext>>,
) -> Result<String, TemplateError>
pub fn render_recovery_start( &self, context: &WithLanguage<WithCsrf<RecoveryStartContext>>, ) -> Result<String, TemplateError>
sourcepub fn render_recovery_progress(
&self,
context: &WithLanguage<WithCsrf<RecoveryProgressContext>>,
) -> Result<String, TemplateError>
pub fn render_recovery_progress( &self, context: &WithLanguage<WithCsrf<RecoveryProgressContext>>, ) -> Result<String, TemplateError>
sourcepub fn render_recovery_finish(
&self,
context: &WithLanguage<WithCsrf<RecoveryFinishContext>>,
) -> Result<String, TemplateError>
pub fn render_recovery_finish( &self, context: &WithLanguage<WithCsrf<RecoveryFinishContext>>, ) -> Result<String, TemplateError>
sourcepub fn render_recovery_expired(
&self,
context: &WithLanguage<WithCsrf<RecoveryExpiredContext>>,
) -> Result<String, TemplateError>
pub fn render_recovery_expired( &self, context: &WithLanguage<WithCsrf<RecoveryExpiredContext>>, ) -> Result<String, TemplateError>
Render the account recovery link expired page
§Errors
Returns an error if the template fails to render.
sourcepub fn render_recovery_consumed(
&self,
context: &WithLanguage<EmptyContext>,
) -> Result<String, TemplateError>
pub fn render_recovery_consumed( &self, context: &WithLanguage<EmptyContext>, ) -> Result<String, TemplateError>
Render the account recovery link consumed page
§Errors
Returns an error if the template fails to render.
sourcepub fn render_recovery_disabled(
&self,
context: &WithLanguage<EmptyContext>,
) -> Result<String, TemplateError>
pub fn render_recovery_disabled( &self, context: &WithLanguage<EmptyContext>, ) -> Result<String, TemplateError>
sourcepub fn render_reauth(
&self,
context: &WithLanguage<WithCsrf<WithSession<ReauthContext>>>,
) -> Result<String, TemplateError>
pub fn render_reauth( &self, context: &WithLanguage<WithCsrf<WithSession<ReauthContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_form_post<T: Serialize>(
&self,
context: &FormPostContext<T>,
) -> Result<String, TemplateError>
pub fn render_form_post<T: Serialize>( &self, context: &FormPostContext<T>, ) -> Result<String, TemplateError>
Render the form used by the form_post response mode
§Errors
Returns an error if the template fails to render.
sourcepub fn render_error(
&self,
context: &ErrorContext,
) -> Result<String, TemplateError>
pub fn render_error( &self, context: &ErrorContext, ) -> Result<String, TemplateError>
sourcepub fn render_email_recovery_txt(
&self,
context: &WithLanguage<EmailRecoveryContext>,
) -> Result<String, TemplateError>
pub fn render_email_recovery_txt( &self, context: &WithLanguage<EmailRecoveryContext>, ) -> Result<String, TemplateError>
Render the email recovery email (plain text variant)
§Errors
Returns an error if the template fails to render.
sourcepub fn render_email_recovery_html(
&self,
context: &WithLanguage<EmailRecoveryContext>,
) -> Result<String, TemplateError>
pub fn render_email_recovery_html( &self, context: &WithLanguage<EmailRecoveryContext>, ) -> Result<String, TemplateError>
Render the email recovery email (HTML text variant)
§Errors
Returns an error if the template fails to render.
sourcepub fn render_email_recovery_subject(
&self,
context: &WithLanguage<EmailRecoveryContext>,
) -> Result<String, TemplateError>
pub fn render_email_recovery_subject( &self, context: &WithLanguage<EmailRecoveryContext>, ) -> Result<String, TemplateError>
sourcepub fn render_email_verification_txt(
&self,
context: &WithLanguage<EmailVerificationContext>,
) -> Result<String, TemplateError>
pub fn render_email_verification_txt( &self, context: &WithLanguage<EmailVerificationContext>, ) -> Result<String, TemplateError>
Render the email verification email (plain text variant)
§Errors
Returns an error if the template fails to render.
sourcepub fn render_email_verification_html(
&self,
context: &WithLanguage<EmailVerificationContext>,
) -> Result<String, TemplateError>
pub fn render_email_verification_html( &self, context: &WithLanguage<EmailVerificationContext>, ) -> Result<String, TemplateError>
Render the email verification email (HTML text variant)
§Errors
Returns an error if the template fails to render.
sourcepub fn render_email_verification_subject(
&self,
context: &WithLanguage<EmailVerificationContext>,
) -> Result<String, TemplateError>
pub fn render_email_verification_subject( &self, context: &WithLanguage<EmailVerificationContext>, ) -> Result<String, TemplateError>
sourcepub fn render_upstream_oauth2_link_mismatch(
&self,
context: &WithLanguage<WithCsrf<WithSession<UpstreamExistingLinkContext>>>,
) -> Result<String, TemplateError>
pub fn render_upstream_oauth2_link_mismatch( &self, context: &WithLanguage<WithCsrf<WithSession<UpstreamExistingLinkContext>>>, ) -> Result<String, TemplateError>
sourcepub fn render_upstream_oauth2_suggest_link(
&self,
context: &WithLanguage<WithCsrf<WithSession<UpstreamSuggestLink>>>,
) -> Result<String, TemplateError>
pub fn render_upstream_oauth2_suggest_link( &self, context: &WithLanguage<WithCsrf<WithSession<UpstreamSuggestLink>>>, ) -> Result<String, TemplateError>
sourcepub fn render_upstream_oauth2_do_register(
&self,
context: &WithLanguage<WithCsrf<UpstreamRegister>>,
) -> Result<String, TemplateError>
pub fn render_upstream_oauth2_do_register( &self, context: &WithLanguage<WithCsrf<UpstreamRegister>>, ) -> Result<String, TemplateError>
sourcepub fn render_device_link(
&self,
context: &WithLanguage<DeviceLinkContext>,
) -> Result<String, TemplateError>
pub fn render_device_link( &self, context: &WithLanguage<DeviceLinkContext>, ) -> Result<String, TemplateError>
sourcepub fn render_device_consent(
&self,
context: &WithLanguage<WithCsrf<WithSession<DeviceConsentContext>>>,
) -> Result<String, TemplateError>
pub fn render_device_consent( &self, context: &WithLanguage<WithCsrf<WithSession<DeviceConsentContext>>>, ) -> Result<String, TemplateError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Templates
impl !RefUnwindSafe for Templates
impl Send for Templates
impl Sync for Templates
impl Unpin for Templates
impl !UnwindSafe for Templates
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more