[Jifty-commit] r2738 - in jifty: .
branches/virtual-models/lib/Jifty/Action
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Jan 30 18:50:08 EST 2007
Author: sterling
Date: Tue Jan 30 18:50:07 2007
New Revision: 2738
Added:
jifty/branches/virtual-models/lib/Jifty/Action/CreateModelClass.pm
jifty/branches/virtual-models/lib/Jifty/Action/DeleteModelClass.pm
jifty/branches/virtual-models/lib/Jifty/Action/UpdateModelClass.pm
Modified:
jifty/ (props changed)
jifty/branches/virtual-models/lib/Jifty/Model/ModelClass.pm
jifty/branches/virtual-models/lib/Jifty/Model/ModelClassColumn.pm
Log:
r2747 at riddle: andrew | 2007-01-30 17:48:51 -0600
Added create/delete/update actions for ModelClass and improved the schema declaration for models and columns.
Added: jifty/branches/virtual-models/lib/Jifty/Action/CreateModelClass.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Action/CreateModelClass.pm Tue Jan 30 18:50:07 2007
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+
+package Jifty::Action::CreateModelClass;
+use base qw/ Jifty::Action::Record::Create /;
+
+sub record_class { 'Jifty::Model::ModelClass' }
+
+1;
Added: jifty/branches/virtual-models/lib/Jifty/Action/DeleteModelClass.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Action/DeleteModelClass.pm Tue Jan 30 18:50:07 2007
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+
+package Jifty::Action::DeleteModelClass;
+use base qw/ Jifty::Action::Record::Delete /;
+
+sub record_class { 'Jifty::Model::ModelClass' }
+
+1;
Added: jifty/branches/virtual-models/lib/Jifty/Action/UpdateModelClass.pm
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/lib/Jifty/Action/UpdateModelClass.pm Tue Jan 30 18:50:07 2007
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+
+package Jifty::Action::UpdateModelClass;
+use base qw/ Jifty::Action::Record::Update /;
+
+sub record_class { 'Jifty::Model::ModelClass' }
+
+1;
Modified: jifty/branches/virtual-models/lib/Jifty/Model/ModelClass.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Model/ModelClass.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Model/ModelClass.pm Tue Jan 30 18:50:07 2007
@@ -24,9 +24,17 @@
use Jifty::DBI::Schema;
use Jifty::Record schema {
- column name => type is 'text';
- column description => type is 'text';
- column included_columns => refers_to Jifty::Model::ModelClassColumnCollection by 'model_class';
+ column name =>
+ type is 'text',
+ label is 'Model name',
+ is distinct,
+ is mandatory;
+ column description =>
+ type is 'text',
+ label is 'Description',
+ render_as 'Textarea';
+ column included_columns =>
+ refers_to Jifty::Model::ModelClassColumnCollection by 'model_class';
};
Modified: jifty/branches/virtual-models/lib/Jifty/Model/ModelClassColumn.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Model/ModelClassColumn.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Model/ModelClassColumn.pm Tue Jan 30 18:50:07 2007
@@ -25,25 +25,123 @@
use Scalar::Defer;
use Jifty::Record schema {
- column name => type is 'text';
- column model_class => refers_to Jifty::Model::ModelClass;
- column label => type is 'text';
- column hints => type is 'text';
- column storage_type => type is 'text'; # should be a ref to a list
- column max_length => type is 'int';
- column sort_order => type is 'int';
- column validator => type is 'text'; # should be a ref to a list. or maybe take code
- column valid_values => type is 'text'; # should be a ref to a list. or maybe take code
- column canonicalizer => type is 'text'; # ditto
- column autocompleter => type is 'text'; # ditto
- column mandatory => type is 'boolean';
- column render_as => type is 'text'; # should actually be a reference to a list
- column filters => type is 'text'; # should actually be a reference to a list
- column description => type is 'text';
- column indexed => type is 'boolean';
- column readable => type is 'boolean', default is 'true';
- column writable => type is 'boolean', default is 'true';
- column default_value => type is 'text';
+ column name =>
+ type is 'text',
+ label is 'Column name',
+ is mandatory;
+
+ column model_class =>
+ refers_to Jifty::Model::ModelClass,
+ label is 'Model',
+ is mandatory;
+
+ column label =>
+ type is 'text',
+ label is 'Label';
+
+ column hints =>
+ type is 'text',
+ label is 'Hints',
+ hints is 'Additional hint to give with the label as to what kind of information is expected in this column.';
+
+ # FIXME should be a ref to a list of storage types
+ column storage_type =>
+ type is 'text',
+ label is 'type',
+ hints is 'The kind of data that is being stored. Use "text" if you are not sure.';
+
+ column max_length =>
+ type is 'int',
+ label is 'Max. length',
+ hints is 'If set, any text greater than this length will be cut off before saving to the database.';
+
+ column sort_order =>
+ type is 'int',
+ label is 'Sort order',
+ hints is 'The order this column should be listed in relationship to the other columns.';
+
+ # TODO How to handle code refs and such?
+ column validator =>
+ type is 'text',
+ label is 'Validator',
+ render_as 'Textarea';
+
+ # TODO How to handle code or list refs and such?
+ column valid_values =>
+ type is 'text',
+ label is 'Valid values',
+ render_as 'Textarea';
+
+ # TODO How to handle code refs and such?
+ column canonicalizer =>
+ type is 'text',
+ label is 'Canonicalizer',
+ render_as 'Textarea';
+
+ # TODO How to handle code refs and such?
+ column autocompleter =>
+ type is 'text',
+ label is 'Autocompleter',
+ render_as 'Textarea';
+
+ column mandatory =>
+ type is 'boolean',
+ label is 'Mandatory?',
+ hints is 'If checked, a value must be given in this column in every row.';
+
+ # FIXME should actually be a reference to a list
+ column render_as =>
+ type is 'text',
+ label is 'Render as',
+ hints is 'The kind of widget to use to edit the information.';
+
+ # FIXME should actually be a reference to a list
+ column filters =>
+ type is 'text',
+ label is 'Filters',
+ hints is 'A list of Jifty::DBI filters to modify the data before going into or coming out of the database.';
+
+ column description =>
+ type is 'text',
+ label is 'Description',
+ render_as 'Textarea';
+
+ column indexed =>
+ type is 'boolean',
+ label is 'Indexed?',
+ hints is 'Should the database index this column for faster searching.';
+
+ column readable =>
+ type is 'boolean',
+ label is 'Readable?',
+ hints is 'Can the value of this column be read directly? For example, passwords should not normally be readable.',
+ default is 'true';
+
+ column writable =>
+ type is 'boolean',
+ label is 'Writable?',
+ hints is 'Can the value of this column be changed after created?',
+ default is 'true';
+
+ column default_value =>
+ type is 'text',
+ label is 'Default value',
+ hints is 'What value should be set for this column if none is given?';
+
+ column distinct_value =>
+ type is 'boolean',
+ label is 'Distinct?',
+ hints is 'Dinstinct columns require a unique value in every row.';
+
+ # TODO Should be a list of models or collections
+ column refers_to =>
+ type is 'text',
+ label is 'Refers to';
+
+ # TODO Should pull a list of columns from the refesr_to record_class
+ column refer_to_by =>
+ type is 'text',
+ label is 'By';
};
=head2 after_create
More information about the Jifty-commit
mailing list