class Marten::Template::Tag::CsrfInput

Overview

The csrf_input template tag.

The csrf_input template tag allows generating a hidden HTML input tag containing the CSRF token.

For example, using {% csrf_input %} in a template will generate the following HTML:

<input type="hidden" name="csrftoken" value="<csrfToken>" />

Where <csrfToken> is the actual CSRF token.

Optionally, the output of this tag can be assigned to a specific variable using the as keyword:

{% csrf_input as my_csrf_input %}

Included Modules

Defined in:

marten/template/tag/csrf_input.cr

Constructors

Instance Method Summary

Instance methods inherited from module Marten::Template::Tag::CanSplitSmartly

split_smartly(expression : String) : Array(String) split_smartly

Instance methods inherited from class Marten::Template::Tag::Base

render(context : Context) : String render

Constructor methods inherited from class Marten::Template::Tag::Base

new(parser : Parser, source : String) new

Constructor Detail

def self.new(_parser : Parser, source : String) #

[View source]

Instance Method Detail

def render(context : Context) : String #
Description copied from class Marten::Template::Tag::Base

Render the template tag for a given context.


[View source]