change the name attribute to aspect to denote asset level static attributes like tableName, et. al.

This commit is contained in:
Colin Kuskie 2010-01-25 19:16:05 -08:00
parent 5b24340994
commit d4f31870a3
12 changed files with 72 additions and 43 deletions

View file

@ -16,9 +16,9 @@ use Tie::IxHash;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset';
attribute assetName => ['assetName', 'Asset_Shortcut'];
attribute icon => 'shortcut.gif';
attribute tableName => 'Shortcut';
aspect assetName => ['assetName', 'Asset_Shortcut'];
aspect icon => 'shortcut.gif';
aspect tableName => 'Shortcut';
property shortcutToAssetId => (
noFormPost => 1,

View file

@ -23,9 +23,9 @@ use WebGUI::Inbox;
use WebGUI::Shop::Cart;
use JSON qw{ from_json to_json };
attribute assetName => ['assetName', 'Asset_Sku'];
attribute icon => 'Sku.gif';
attribute tableName => 'sku';
aspect assetName => ['assetName', 'Asset_Sku'];
aspect icon => 'Sku.gif';
aspect tableName => 'sku';
property description => (
tab => "properties",

View file

@ -22,9 +22,9 @@ use JSON;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset::Sku';
attribute assetName => ['assetName', 'Asset_Product'];
attribute icon => 'product.gif';
attribute tableName => 'Product';
aspect assetName => ['assetName', 'Asset_Product'];
aspect icon => 'product.gif';
aspect tableName => 'Product';
property cacheTimeout => (
tab => "display",

View file

@ -23,10 +23,10 @@ use HTML::Packer;
use JavaScript::Packer;
use CSS::Packer;
attribute assetName => ['assetName','Asset_Snippet'];
attribute uiLevel => 5;
attribute icon => 'snippet.gif';
attribute tableName => 'snippet';
aspect assetName => ['assetName','Asset_Snippet'];
aspect uiLevel => 5;
aspect icon => 'snippet.gif';
aspect tableName => 'snippet';
property snippet => (
fieldType => 'codearea',

View file

@ -19,9 +19,9 @@ use strict;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset';
attribute assetName => ['assetName', 'Asset_Template'],
attribute icon => 'template.gif',
attribute tableName => 'template',
aspect assetName => ['assetName', 'Asset_Template'],
aspect icon => 'template.gif',
aspect tableName => 'template',
property template => (
fieldType => 'codearea',

View file

@ -25,8 +25,8 @@ use WebGUI::SQL;
use WebGUI::Utility;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset';
attribute tableName => 'wobject',
attribute assetName => 'Wobject',
aspect tableName => 'wobject',
aspect assetName => 'Wobject',
property description => (
fieldType => 'HTMLArea',
default => undef,

View file

@ -18,10 +18,10 @@ use strict;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset::Wobject';
attribute assetName => ["assetName", 'Asset_Folder'];
attribute uiLevel => 5;
attribute icon => 'folder.gif';
attribute tableName => 'Folder';
aspect assetName => ["assetName", 'Asset_Folder'];
aspect uiLevel => 5;
aspect icon => 'folder.gif';
aspect tableName => 'Folder';
property visitorCacheTimeout => (
tab => "display",

View file

@ -19,9 +19,9 @@ use WebGUI::AdSpace;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset::Wobject';
attribute assetName => ["assetName", 'Asset_Layout'];
attribute icon => 'layout.gif';
attribute tableName => 'Layout';
aspect assetName => ["assetName", 'Asset_Layout'];
aspect icon => 'layout.gif';
aspect tableName => 'Layout';
property templateId => (
fieldType => "template",

View file

@ -20,9 +20,9 @@ use WebGUI::Utility;
use WebGUI::Definition::Asset;
extends 'WebGUI::Asset::Wobject';
attribute assetName => ["assetName", 'Asset_Navigation'];
attribute icon => 'navigation.gif';
attribute tableName => 'Navigation';
aspect assetName => ["assetName", 'Asset_Navigation'];
aspect icon => 'navigation.gif';
aspect tableName => 'Navigation';
property templateId => (
label => ['1096', 'Asset_Navigation'],

View file

@ -21,9 +21,9 @@ use WebGUI::Storage;
use WebGUI::Exception::Shop;
use WebGUI::Asset::Sku::Product;
attribute assetName => ['assetName', 'Asset_Shelf'];
attribute icon => 'Shelf.gif';
attribute tableName => 'Shelf';
aspect assetName => ['assetName', 'Asset_Shelf'];
aspect icon => 'Shelf.gif';
aspect tableName => 'Shelf';
property templateId => (
fieldType => "template",

View file

@ -16,7 +16,7 @@ use lib "$FindBin::Bin/lib";
use WebGUI::Test;
use Test::More tests => 10;
use Test::More tests => 12;
use Test::Deep;
use Test::Exception;
@ -27,7 +27,7 @@ my $called_getProperties;
package WGT::Class;
use WebGUI::Definition;
attribute 'attribute1' => 'attribute1 value';
aspect 'aspect1' => 'aspect1 value';
property 'property1' => (
arbitrary_key => 'arbitrary_value',
label => 'property1',
@ -37,8 +37,8 @@ my $called_getProperties;
label => 'property2',
);
# attributes create methods
::can_ok +__PACKAGE__, 'attribute1';
# aspects create methods
::can_ok +__PACKAGE__, 'aspect1';
# propeties create methods
::can_ok +__PACKAGE__, 'property1';
@ -60,7 +60,7 @@ my $called_getProperties;
package WGT::Class2;
use WebGUI::Definition;
attribute 'attribute1' => 'attribute1 value';
aspect 'aspect1' => 'aspect1 value';
property 'property3' => ( label => 'label' );
property 'property1' => ( label => 'label' );
property 'property2' => ( label => 'label' );
@ -102,7 +102,7 @@ my $called_getProperties;
package WGT::Class3;
use WebGUI::Definition;
attribute 'attribute1' => 'attribute1 value';
aspect 'aspect1' => 'aspect1 value';
property 'property1' => (
label => ['webgui', 'WebGUI'],
options => \&property1_options,
@ -127,3 +127,32 @@ my $called_getProperties;
);
}
{
package WGT::Class4;
use WebGUI::Definition;
extends 'WGT::Class3';
aspect 'aspect41' => 'aspect41 value';
property 'property41' => (
label => ['webgui', 'WebGUI'],
);
has something => (
is => 'rw',
);
my $object3 = WGT::Class3->new({session => $session});
my $object4 = WGT::Class4->new({session => $session});
::cmp_bag (
[WGT::Class3->meta->get_all_attributes_list],
[qw/ property1 session /],
'get_all_aspects_list returns all aspects in all metaclasses for the class'
);
::cmp_bag (
[WGT::Class4->meta->get_all_attributes_list],
[qw/ property41 something property1 session /],
'... checking inherited class'
);
}

View file

@ -24,7 +24,7 @@ use WebGUI::Test;
package WGT::Class::Atset;
use WebGUI::Definition::Asset;
attribute tableName => 'asset';
aspect tableName => 'asset';
::dies_ok { property 'property1' => (); } 'must have a fieldType';
::dies_ok { property 'property1' => (fieldType => 'text'); } 'must pass either a label or noFormPost flag';
::lives_ok { property 'property1' => (
@ -44,7 +44,7 @@ use WebGUI::Test;
package WGT::Class::Asset;
use WebGUI::Definition::Asset;
attribute tableName => 'asset';
aspect tableName => 'asset';
property 'property2' => (
fieldType => 'text',
label => 'property2',
@ -142,7 +142,7 @@ use WebGUI::Test;
package WGT::Class::AlsoAsset;
use WebGUI::Definition::Asset;
attribute tableName => 'asset';
aspect tableName => 'asset';
property 'property1' => (
fieldType => 'text',
label => 'property1',
@ -160,7 +160,7 @@ use WebGUI::Test;
use WebGUI::Definition::Asset;
extends 'WGT::Class::AlsoAsset';
attribute tableName => 'snippet';
aspect tableName => 'snippet';
property 'property10' => (
fieldType => 'text',
label => 'property10',
@ -215,7 +215,7 @@ use WebGUI::Test;
use WebGUI::Definition::Asset;
extends 'WGT::Class::AlsoAsset';
attribute tableName => 'snippet';
aspect tableName => 'snippet';
property 'property10' => (
fieldType => 'text',
label => 'property10',
@ -241,7 +241,7 @@ use WebGUI::Test;
use WebGUI::Definition::Asset;
extends 'WGT::Class::AlsoAsset';
attribute tableName => 'tertius';
aspect tableName => 'tertius';
property 'defaulted' => (
fieldType => 'text',
label => 'defaulted',