View

The abstract wrapper for views.

abstract
static if(!isWebApi)
class View {}

Constructors

this
this(HttpClient client, string name)

Creates a new view.

this
this(string name)

Creates a new view.

Public Imports

diamond.unittesting
public import diamond.unittesting;
CSRF
public import CSRF = diamond.security.csrf;
diamond.extensions
public import diamond.extensions;

Members

Enums

FlashMessageType
enum FlashMessageType
Undocumented in source.

Functions

action
string action(string actionName)

Gets a route that fits an action for the current route.

actionParams
string actionParams(string actionName, string[] params)

Gets a route that fits an action and parameters for the current route.

addPlaceHolder
void addPlaceHolder(string key, string value)

Adds a place holder to the view.

append
void append(T data)

Appends data to the view's result. This will append data to the current position. Generally this is not necessary, because of the template attributes such as @=

appendCSRFTokenField
void appendCSRFTokenField(string name, bool appendName)

Appends a hidden-field with a generated token that can be used for csrf protection.

asView
auto asView()

Gets th current view as a specific view.

asyncScript
void asyncScript(string file)

Inserts an asynchronous javascript file in a script tag.

clearCSRFToken
void clearCSRFToken()

Clears the current csrf token. This is recommended before generating CSRF token fields.

clearView
void clearView()

Clears the view result.

copyViewData
void copyViewData()
Undocumented in source. Be warned that the author may not have intended to support it.
deferScript
void deferScript(string file)

Inserts a javascript file in a script tag after the page has loaded.

escape
void escape(T data)

Appends html escaped data to the view's result. This will append data to the current position. Generally this is not necessary, because of the template attributes such as @(), @$= etc.

flashMessage
void flashMessage(string identifier, string message, FlashMessageType type, size_t displayTime)
Undocumented in source. Be warned that the author may not have intended to support it.
generate
string generate(string sectionName)

Generates the result of the view. This is override by each view implementation.

getPlaceHolder
string getPlaceHolder(string key)

Gets a place holder of the view.

prepare
string prepare()

Prepares the view with its layout, placeholders etc.

render
void render(string name, string sectionName)

Will render another view into this one.

render
void render(string sectionName)

Will render another view into this one.

renderModel
void renderModel(TModel model, string sectionName)

Will render another view into this one.

retrieve
string retrieve(string name, string sectionName)

Retrieves the generated result of a view. This should generally only be used to render partial views into another view.

retrieve
string retrieve(string sectionName)

Retrieves the generated result of a view. This should generally only be used to render partial views into another view.

retrieveModel
string retrieveModel(TModel model, string sectionName)

Retrieves the generated result of a view. This should generally only be used to render partial views into another view.

script
void script(string file)

Inserts a javascript file in a script tag.

view
auto view(string name, bool checkRoute)

Retrieves a view by name. This wraps around getView.

viewRaw
auto viewRaw(bool checkRoute)

Retrieves a raw view by name. This wraps around getView.

Mixins

__anonymous
mixin ExtensionEmit!(ExtensionType.viewExtension, q{ mixin {{extensionEntry}}.extensions; })
Undocumented in source.

Properties

cached
bool cached [@property setter]

Sets a boolean determining whether the view can be cached or not.

cached
bool cached [@property getter]

Gets a boolean determining whether the view can be cached or not.

client
HttpClient client [@property getter]

Gets the client.

delayRender
bool delayRender [@property getter]

Gets a boolean determining whether the rendering is delayed.

delayRender
bool delayRender [@property setter]

Sets a boolean determining whether the rendering is delayed.

httpMethod
HttpMethod httpMethod [@property getter]

Gets the method.

isDefaultRoute
bool isDefaultRoute [@property getter]

Gets a boolean determining whether the route is the default route or not.

layoutName
string layoutName [@property getter]

Gets the layout name.

layoutName
string layoutName [@property setter]

Sets the layout name.

name
string name [@property getter]

Gets the name.

name
string name [@property setter]

Sets the name.

rawGenerate
bool rawGenerate [@property getter]

Gets a boolean determining whether the view generation is raw or if it should call controllers etc.

rawGenerate
bool rawGenerate [@property setter]

Sets a boolean determining whether the view generation is raw or if it should call controllers etc.

renderView
View renderView [@property getter]

Gets the view that's currently rendering the layout view.

renderView
View renderView [@property setter]

Sets a new render view.

route
Route route [@property getter]

Gets the route.

testing
bool testing [@property getter]

Gets a boolean determnining whether the request is a test or not.

Meta