Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

jifty::plugin::comment::mixin::model::commented(3pm) [debian man page]

Jifty::Plugin::Comment::Mixin::Model::Commented(3pm)	User Contributed Perl Documentation   Jifty::Plugin::Comment::Mixin::Model::Commented(3pm)

NAME
Jifty::Plugin::Comment::Mixin::Model::Commented - add comments to a model SYNOPSIS
package App::Model::Fooble; use Jifty::DBI::Schema; use App::Record schema { column scribble => type is 'text'; column wobble => type is 'int'; }; use Jifty::Plugin::Comment::Mixin::Model::Commented; DESCRIPTION
Add this mixin to a model if you'd like to attach comments to it. Comments can be used to allow users of your system to comment upon and discuss the record to which they are attached. METHODS
import This method performs some rather devious magic to make everything work easily. It automatically generates an additional model for your application. This model will look something like this: use strict; use warnings; package App::Model::FoobleComment; use Jifty::DBI::Schema; use Jifty::Record schema { column commented_upon => references App::Model::Fooble, label is 'Commented upon', is mandatory, is immutable, ; column the_comment => references App::Model::Comment, label is 'Comment', is mandatory, is immutable, is distinct, ; }; App::Model::FoobleComment->add_trigger( before_access => sub { my $self = shift; my ($right, %args) = @_; if ($right eq 'create') { return 'allow' if $self->current_user->id; } if ($right eq 'read') { return 'allow'; } return $self->App::Model::FoobleComment::current_user_can(@_); }); You will need to define an "before_access" trigger for this class if you want it to be useful. for_commenting Returns a value to be used with the comment views. It's basically just a string identifying the class name and ID of the record. comments Returns a collection of Jifty::Plugin::Comment::Model::Comment objects that have been attached to the current record. (Actually, it returns the a collection of the local application class, e.g. "App::Model::CommentCollection".) comment_record_class This is the name of the linking class that was created during "import". AUTHOR
Andrew Sterling Hanenkamp "<hanenkamp@cpan.com>" COPYRIGHT AND LICENSE
Copyright 2007 Boomer Consulting, Inc. All Rights Reserved. This program is free software and may be modified and distributed under the same terms as Perl itself. perl v5.12.4 2009-03-09 Jifty::Plugin::Comment::Mixin::Model::Commented(3pm)

Check Out this Related Man Page

Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadatUsermContributed Perl DocumeJifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata(3pm)

NAME
Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata - ActorMetadata mixin SYNOPSIS
package MyApp::Model::CoffeeShop; use Jifty::DBI::Schema; use MyApp::Record schema { # custom column definitions }; use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on and updated_by DESCRIPTION
SCHEMA
This mixin adds the following columns to the model schema: created_by created_on updated_on updated_by METHODS
# XXX: pod coverage should count parent classes. this pod is useless register_triggers Adds the triggers to the model this mixin is added to. register_triggers_for_column before_create Sets "created_by", "created_on", "updated_on" and "updated_by" based on the current user and time. after_set update "updated_on" and "updated_by" based on the current user and current time. current_user_can Rejects creation unless there's a current_user. current_user_is_owner import to be more flexible, we allow some configurations like: e.g. use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata user_class => 'Foo::Model::Principal', map => { created_by => 'creator', created_on => 'created' } current valid args are: user_class => 'Foo::Model::User' class that you want created_by and updated_by to be refers_to map => { created_by => 'creator', ... } the real column name you want to use. this also controls whether a column will be added or not. i.e. if the hashref is { created_by => 'creator', created_on => 'created' }, then columns 'updated_by' and 'updated_on' will not be added. perl v5.14.2 2011-02-08 Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata(3pm)
Man Page