NAME

Rapi::Blog::DB::Result::Post - Post row object

DESCRIPTION

This is the default Post Result class/row object for Rapi::Blog. The list_posts() template directive returns an array of these objects (in the sub property rows), and when viewing a post via a view_wrapper the associated post is available as the template variable Post.

This is a DBIx::Class::Row.

COLUMNS

id

Auto-increment post id. Read-only.

name

The unique name of the Post. The name is used to generate the public URL for the post. Should contain only lower case alpha characters, dash and underscore.

title

Human-friendly Post title

image

CAS image column ('cas_img'). Contains the sha1 of a file within the SimpleCAS.

ts

The declared Date/Time of the Post. Defaults to the timestamp of when the Post is created but can be set to anything.

create_ts

The real Date/Time the Post is created, read-only.

update_ts

The Date/Time of the last modification of the Post, read-only.

author

The author of the Post, FK to Rapi::Blog::DB::Result::User object. author is a relationship, the underlying foreign-key column is author_id which is hidden.

The author defaults to the user creating the Post, but if the user is an admin they can select a different user.

creator

The creator of the Post, FK to Rapi::Blog::DB::Result::User object. creator is a relationship, the underlying foreign-key column is creator_id which is hidden. Read-only.

updater

The last user who modified the Post, FK to Rapi::Blog::DB::Result::User object. updater is a relationship, the underlying foreign-key column is updater_id which is hidden. Read-only.

published

True or false bool value. Posts which are not published will not be listed in list_posts() and will return a 404 not found except for admins and the author of the Post.

publish_ts

The Date/Time the Post was marked published or undef if the Post is not published. Read-only.

size

The size in bytes of the body. Read-only.

tag_names

List of tag names for the Post as a space-separated string, read-only. Tags are defined by specifying them in Twitter #hashtag format in the Post body.

summary

The summary for the Post which is either set from custom_summary or auto-generated from the body. Read-only.

custom_summary

Custom summary for the Post. Setting any nonzero-length value will populate as the summary, while an empty string will cause summary to be auto-generated.

The main content body of the Post in HTML/Markdown format.

section

The section of the Post, if one is set, or undef. FK to Rapi::Blog::DB::Result::Section object. section is a relationship, the underlying foreign-key column is section_id which is hidden.

METHODS

comments

Multi-relationship to all the Comments of this Post.

hits

Multi-relationship to all the Hits of this Post. Hits record details of the HTTP request when record_hit is called from the view template.

hits post_tags

Multi-relationship recording the tags of this Post.

tag_names_list

List of tag names. Like tag_names but returns a list of strings rather than a single string.

num_categories

Returns the number of Categories this Post is in, which can be zero.

category_list

List of Category names (strings).

section_name

Returns the text name of the Section or undef if the Post has no Section set.

section_name_or

Convenience method, works just like section_names, except when there is no Section, the value of the supplied argument is returned instead of undef.

image_url

URL which can be used to access the image for the active site/scaffold.

public_url_path

URL path prefix to access the default public view of all Posts.

public_url

URL path prefix to access the default public view of this Post. This is just the public_url_path plus the name

preview_url_path

URL path prefix to access the public preview of all Posts. By default this is the same as public_url_path unless the Scaffold has defined preview_path. The preview is used to display the post in an iframe on the internal post page. This is useful to be able to show the post without the full navigation of the site.

preview_url

URL path prefix to access the public preview of this Post. This is just the preview_url_path plus the name

open_url_path

URL path to access the Post internally within the password-protected area of the site. This is the same page that opens if you double-click a Post from the Posts grid and is how you can edit a post. If the user is not logged in they will automatically be prompted to login.

Supports an optional mode argument which can be 'direct' or 'navable'. These are full-screen modes which will open the Post page without the full navigation tree and header. The 'direct' mode will be totally full-screen, while 'navable' will load a full-screen tabpanel which allows following links to related objects.

record_hit

Called to record the current request in the Hits table for the post. Designed to be called from the default view path in the scaffold.

can_delete

Util method returns true if the current user can delete the post. Will be true if the user is either an admin or or the author of the post.

can_modify

Util method returns true if the current user can modify the post. Will be true if the user is either an admin or or the author of the post.

can_change_author

Util method returns true if the current user can change the author of the post. Will be true if the user is an admin.

SEE ALSO

AUTHOR

Henry Van Styn <vanstyn@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by IntelliTree Solutions llc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 545:

Unknown directive: =body