[Jifty-commit] r2371 - in jifty/branches/template-declare: .
doc/talks examples/MyWeblog examples/MyWeblog/bin
examples/MyWeblog/doc examples/MyWeblog/etc
examples/MyWeblog/lib examples/MyWeblog/lib/MyWeblog
examples/MyWeblog/lib/MyWeblog/Action
examples/MyWeblog/lib/MyWeblog/Model
examples/MyWeblog/share/po examples/MyWeblog/share/web
examples/MyWeblog/share/web/static
examples/MyWeblog/share/web/templates
examples/MyWeblog/share/web/templates/_elements
examples/MyWeblog/share/web/templates/fragments
examples/MyWeblog/t examples/MyWeblog/var
examples/MyWeblog/var/mason examples/MyWeblog/var/mason/cache
lib lib/Jifty lib/Jifty/Manual lib/Jifty/Upgrade
lib/Jifty/Web/Form share/web/static/css t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Dec 10 23:58:35 EST 2006
Author: audreyt
Date: Sun Dec 10 23:58:34 2006
New Revision: 2371
Added:
jifty/branches/template-declare/doc/talks/lpw_intro_jifty_2006.key.tgz (contents, props changed)
jifty/branches/template-declare/doc/talks/lpw_intro_jifty_2006.pdf (contents, props changed)
jifty/branches/template-declare/doc/talks/lpw_scary_jifty.key.tgz (contents, props changed)
jifty/branches/template-declare/doc/talks/lpw_scary_jifty.pdf (contents, props changed)
jifty/branches/template-declare/examples/MyWeblog/
jifty/branches/template-declare/examples/MyWeblog/Makefile.PL
jifty/branches/template-declare/examples/MyWeblog/bin/
jifty/branches/template-declare/examples/MyWeblog/bin/jifty (contents, props changed)
jifty/branches/template-declare/examples/MyWeblog/doc/
jifty/branches/template-declare/examples/MyWeblog/etc/
jifty/branches/template-declare/examples/MyWeblog/etc/config.yml
jifty/branches/template-declare/examples/MyWeblog/lib/
jifty/branches/template-declare/examples/MyWeblog/lib/MyWeblog/
jifty/branches/template-declare/examples/MyWeblog/lib/MyWeblog/Action/
jifty/branches/template-declare/examples/MyWeblog/lib/MyWeblog/Model/
jifty/branches/template-declare/examples/MyWeblog/lib/MyWeblog/Model/Post.pm
jifty/branches/template-declare/examples/MyWeblog/share/
jifty/branches/template-declare/examples/MyWeblog/share/po/
jifty/branches/template-declare/examples/MyWeblog/share/web/
jifty/branches/template-declare/examples/MyWeblog/share/web/static/
jifty/branches/template-declare/examples/MyWeblog/share/web/templates/
jifty/branches/template-declare/examples/MyWeblog/share/web/templates/_elements/
jifty/branches/template-declare/examples/MyWeblog/share/web/templates/_elements/nav
jifty/branches/template-declare/examples/MyWeblog/share/web/templates/fragments/
jifty/branches/template-declare/examples/MyWeblog/share/web/templates/fragments/page_of_posts
jifty/branches/template-declare/examples/MyWeblog/share/web/templates/index.html
jifty/branches/template-declare/examples/MyWeblog/share/web/templates/post
jifty/branches/template-declare/examples/MyWeblog/t/
jifty/branches/template-declare/examples/MyWeblog/t/00-model-Post.t
jifty/branches/template-declare/examples/MyWeblog/var/
jifty/branches/template-declare/examples/MyWeblog/var/mason/
jifty/branches/template-declare/examples/MyWeblog/var/mason/cache/
jifty/branches/template-declare/t/12-param-schema.t (contents, props changed)
Modified:
jifty/branches/template-declare/ (props changed)
jifty/branches/template-declare/META.yml
jifty/branches/template-declare/Makefile.PL
jifty/branches/template-declare/lib/Jifty.pm
jifty/branches/template-declare/lib/Jifty/Action.pm
jifty/branches/template-declare/lib/Jifty/Manual/Tutorial.pod
jifty/branches/template-declare/lib/Jifty/Upgrade/Internal.pm
jifty/branches/template-declare/lib/Jifty/Web/Form/Clickable.pm
jifty/branches/template-declare/share/web/static/css/forms.css
Log:
* Merge down to template-declare branch.
Modified: jifty/branches/template-declare/META.yml
==============================================================================
--- jifty/branches/template-declare/META.yml (original)
+++ jifty/branches/template-declare/META.yml Sun Dec 10 23:58:34 2006
@@ -70,7 +70,7 @@
HTTP::Server::Simple::Recorder: 0
Hash::Merge: 0
Hook::LexWrap: 0
- IPC::PubSub: 0.11
+ IPC::PubSub: 0.22
JSON::Syck: 0.15
Jifty::DBI: 0.29
LWP::UserAgent: 0
@@ -99,4 +99,4 @@
perl: 5.8.3
version: 0
tests: t/*.t t/*/t/*.t
-version: 0.61123_01
+version: 0.61210
Modified: jifty/branches/template-declare/Makefile.PL
==============================================================================
--- jifty/branches/template-declare/Makefile.PL (original)
+++ jifty/branches/template-declare/Makefile.PL Sun Dec 10 23:58:34 2006
@@ -40,7 +40,7 @@
requires('HTTP::Server::Simple::Recorder');
requires('Hash::Merge');
requires('Hook::LexWrap');
-requires('IPC::PubSub' => '0.11' );
+requires('IPC::PubSub' => '0.22' );
requires('Jifty::DBI' => '0.29' ); # Jifty::DBI::Collection Jifty::DBI::Handle Jifty::DBI::Record::Cachable Jifty::DBI::SchemaGenerator
requires('Locale::Maketext::Extract' => '0.20');
requires('Locale::Maketext::Lexicon' => '0.60');
Added: jifty/branches/template-declare/doc/talks/lpw_intro_jifty_2006.key.tgz
==============================================================================
Binary file. No diff available.
Added: jifty/branches/template-declare/doc/talks/lpw_intro_jifty_2006.pdf
==============================================================================
Binary file. No diff available.
Added: jifty/branches/template-declare/doc/talks/lpw_scary_jifty.key.tgz
==============================================================================
Binary file. No diff available.
Added: jifty/branches/template-declare/doc/talks/lpw_scary_jifty.pdf
==============================================================================
Binary file. No diff available.
Added: jifty/branches/template-declare/examples/MyWeblog/Makefile.PL
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/Makefile.PL Sun Dec 10 23:58:34 2006
@@ -0,0 +1,6 @@
+use inc::Module::Install;
+name('MyWeblog');
+version('0.01');
+requires('Jifty' => '0.61123_01');
+
+WriteAll;
Added: jifty/branches/template-declare/examples/MyWeblog/bin/jifty
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/bin/jifty Sun Dec 10 23:58:34 2006
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+use File::Basename qw(dirname);
+use UNIVERSAL::require;
+
+BEGIN {
+ Jifty::Util->require or die $UNIVERSAL::require::ERROR;
+ my $root = Jifty::Util->app_root;
+ unshift @INC, "$root/lib" if ($root);
+}
+
+use Jifty::Script;
+$SIG{INT} = $SIG{TERM} = sub { warn "Stopped\n"; exit; };
+Jifty::Script->dispatch();
Added: jifty/branches/template-declare/examples/MyWeblog/etc/config.yml
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/etc/config.yml Sun Dec 10 23:58:34 2006
@@ -0,0 +1,40 @@
+---
+framework:
+ AdminMode: 1
+ ApplicationClass: MyWeblog
+ ApplicationName: MyWeblog
+ Database:
+ CheckSchema: 1
+ Database: myweblog
+ Driver: SQLite
+ Host: localhost
+ Password: ''
+ RecordBaseClass: Jifty::DBI::Record::Cachable
+ User: ''
+ Version: 0.0.1
+ DevelMode: 1
+ L10N:
+ PoDir: share/po
+ LogLevel: INFO
+ Mailer: Sendmail
+ MailerArgs: []
+
+ Plugins: []
+
+ PubSub:
+ Backend: Memcached
+ Enable: ~
+ Web:
+ BaseURL: http://localhost
+ DataDir: var/mason
+ Globals: []
+
+ MasonConfig:
+ autoflush: 0
+ default_escape_flags: h
+ error_format: text
+ error_mode: fatal
+ Port: 8888
+ ServeStaticFiles: 1
+ StaticRoot: share/web/static
+ TemplateRoot: share/web/templates
Added: jifty/branches/template-declare/examples/MyWeblog/lib/MyWeblog/Model/Post.pm
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/lib/MyWeblog/Model/Post.pm Sun Dec 10 23:58:34 2006
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+package MyWeblog::Model::Post;
+use Jifty::DBI::Schema;
+
+use MyWeblog::Record schema {
+
+ column title =>
+ type is 'text',
+ label is 'Title',
+ default is 'Untitled post';
+
+ column body =>
+ type is 'text',
+ label is 'Content',
+ render_as 'Textarea';
+
+};
+
+# Your model-specific methods go here.
+
+1;
+
Added: jifty/branches/template-declare/examples/MyWeblog/share/web/templates/_elements/nav
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/share/web/templates/_elements/nav Sun Dec 10 23:58:34 2006
@@ -0,0 +1,11 @@
+<%init>
+my $top = Jifty->web->navigation;
+$top->child( Home => url => "/", sort_order => 1);
+$top->child( Post => url => "/post", label => "Post Article");
+
+if (Jifty->config->framework('AdminMode') ) {
+ $top->child(Administration => url => "/__jifty/admin/", sort_order => 998);
+ $top->child(OnlineDocs => url => "/__jifty/online_docs/", label => 'Online docs', sort_order => 999);
+ }
+return();
+</%init>
Added: jifty/branches/template-declare/examples/MyWeblog/share/web/templates/fragments/page_of_posts
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/share/web/templates/fragments/page_of_posts Sun Dec 10 23:58:34 2006
@@ -0,0 +1,30 @@
+<%args>
+$page => 1
+</%args>
+<%init>
+my $posts = MyWeblog::Model::PostCollection->new();
+$posts->unlimit();
+$posts->set_page_info( current_page => $page,
+ per_page => 15
+ );
+$m->out("No items found.") if ($posts->pager->total_entries == 0);
+
+</%init>
+% if ($posts->pager->last_page > 1) {
+ Page <% $page %> of <% $posts->pager->last_page %>
+% }
+<dl class="list">
+% while (my $post = $posts->next) {
+ <dt><% $post->title %></dt>
+ <dd><% $post->body %></dd>
+% }
+</dl>
+
+% if ($posts->pager->previous_page) {
+ <% Jifty->web->link( label => "Previous Page", onclick => { args => { page => $posts->pager->previous_page }
+} ) %>
+% }
+% if ($posts->pager->next_page) {
+ <% Jifty->web->link( label => "Next Page", onclick => { args => { page => $posts->pager->next_page } } ) %>
+% }
+
Added: jifty/branches/template-declare/examples/MyWeblog/share/web/templates/index.html
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/share/web/templates/index.html Sun Dec 10 23:58:34 2006
@@ -0,0 +1,10 @@
+<&| /_elements/wrapper, title => Jifty->config->framework('ApplicationName') &>
+
+<% Jifty->web->region(name => "myweblog-posts",
+ path => "/fragments/page_of_posts") %>
+</&>
+<%init>
+my $posts = MyWeblog::Model::PostCollection->new();
+$posts->unlimit();
+</%init>
+
Added: jifty/branches/template-declare/examples/MyWeblog/share/web/templates/post
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/share/web/templates/post Sun Dec 10 23:58:34 2006
@@ -0,0 +1,13 @@
+<%init>
+my $action = Jifty->web->new_action(class => 'CreatePost');
+</%init>
+
+<&| /_elements/wrapper, title => "Post to your weblog" &>
+<% Jifty->web->form->start() %>
+<% Jifty->web->form->next_page( url => '/') %>
+<% $action->form_field('title') %>
+<% $action->form_field('body') %>
+<% Jifty->web->form->submit( label => 'Post' ) %>
+<% Jifty->web->form->end() %>
+</&>
+
Added: jifty/branches/template-declare/examples/MyWeblog/t/00-model-Post.t
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/examples/MyWeblog/t/00-model-Post.t Sun Dec 10 23:58:34 2006
@@ -0,0 +1,49 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+A basic test harness for the Post model.
+
+=cut
+
+use Jifty::Test tests => 11;
+
+# Make sure we can load the model
+use_ok('MyWeblog::Model::Post');
+
+# Grab a system user
+my $system_user = MyWeblog::CurrentUser->superuser;
+ok($system_user, "Found a system user");
+
+# Try testing a create
+my $o = MyWeblog::Model::Post->new(current_user => $system_user);
+my ($id) = $o->create();
+ok($id, "Post create returned success");
+ok($o->id, "New Post has valid id set");
+is($o->id, $id, "Create returned the right id");
+
+# And another
+$o->create();
+ok($o->id, "Post create returned another value");
+isnt($o->id, $id, "And it is different from the previous one");
+
+# Searches in general
+my $collection = MyWeblog::Model::PostCollection->new(current_user => $system_user);
+$collection->unlimit;
+is($collection->count, 2, "Finds two records");
+
+# Searches in specific
+$collection->limit(column => 'id', value => $o->id);
+is($collection->count, 1, "Finds one record with specific id");
+
+# Delete one of them
+$o->delete;
+$collection->redo_search;
+is($collection->count, 0, "Deleted row is gone");
+
+# And the other one is still there
+$collection->unlimit;
+is($collection->count, 1, "Still one left");
+
Modified: jifty/branches/template-declare/lib/Jifty.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty.pm (original)
+++ jifty/branches/template-declare/lib/Jifty.pm Sun Dec 10 23:58:34 2006
@@ -2,11 +2,11 @@
use strict;
package Jifty;
-use IPC::PubSub;
+use IPC::PubSub 0.22;
use encoding 'utf8';
# Work around the fact that Time::Local caches thing on first require
BEGIN { local $ENV{'TZ'} = "GMT"; require Time::Local;}
-$Jifty::VERSION = '0.61123_01';
+$Jifty::VERSION = '0.61210';
=head1 NAME
@@ -368,6 +368,7 @@
my $self = shift;
my $app_instance_id = Jifty::Model::Metadata->load("application_instance_uuid");
unless ($app_instance_id) {
+ require Data::UUID;
$app_instance_id = Data::UUID->new->create_str();
Jifty::Model::Metadata->store(application_instance_uuid => $app_instance_id );
}
Modified: jifty/branches/template-declare/lib/Jifty/Action.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Action.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Action.pm Sun Dec 10 23:58:34 2006
@@ -438,7 +438,7 @@
if exists $field_info->{'default_value'};
$default_value = $self->argument_value($field)
if $self->has_argument($field) && !$self->values_from_request->{$field};
-
+
$self->{_private_form_fields_hash}{$arg_name}
= Jifty::Web::Form::Field->new(
%$field_info,
@@ -451,7 +451,6 @@
%args
);
-
} # else $field remains undef
else {
Jifty->log->warn("$arg_name isn't a valid field for $self");
@@ -502,11 +501,11 @@
sub register {
my $self = shift;
- Jifty->web->out( qq!<input type="hidden"! .
+ Jifty->web->out( qq!<div><input type="hidden"! .
qq! name="@{[$self->register_name]}"! .
qq! id="@{[$self->register_name]}"! .
qq! value="@{[ref($self)]}"! .
- qq! />\n! );
+ qq! /></div>\n! );
Modified: jifty/branches/template-declare/lib/Jifty/Manual/Tutorial.pod
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Manual/Tutorial.pod (original)
+++ jifty/branches/template-declare/lib/Jifty/Manual/Tutorial.pod Sun Dec 10 23:58:34 2006
@@ -293,7 +293,9 @@
</&>
Yes, it's a template file in L<HTML::Mason> syntax. If you're not familiar with Mason,
-we recommend you to consult its online documentation for details.
+we recommend you to consult its online documentation for details. I<Mason templates
+should start in the first column of the file. Particularly importantly, the C<E<lt>%initE<gt>>
+and C<E<lt>/%initE<gt>> blocks must be flush left.>
=head3 Viewing
Modified: jifty/branches/template-declare/lib/Jifty/Upgrade/Internal.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Upgrade/Internal.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Upgrade/Internal.pm Sun Dec 10 23:58:34 2006
@@ -43,4 +43,17 @@
rename column => 'key', in => 'Jifty::Model::Metadata', to => 'data_key';
};
+since '0.61210' => sub {
+ Jifty::Util->require('IPC::PubSub');
+ IPC::PubSub->new(
+ JiftyDBI => (
+ db_config => Jifty->handle->{db_config},
+ table_prefix => '_jifty_pubsub_',
+ db_init => 0,
+ )
+ );
+
+ rename column => 'key', in => 'IPC::PubSub::Cache::JiftyDBI::Stash::Item', to => 'data_key';
+};
+
1;
Modified: jifty/branches/template-declare/lib/Jifty/Web/Form/Clickable.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Web/Form/Clickable.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Web/Form/Clickable.pm Sun Dec 10 23:58:34 2006
@@ -82,7 +82,7 @@
=item submit
A list of actions to run when the object is clicked. This may be an
-array refrence of a single element; each element may either be a
+array refrence or a single element; each element may either be a
moniker or a L<Jifty::Action>. An undefined value submits B<all>
actions in the form, an empty list reference (the default) submits
none.
@@ -226,8 +226,8 @@
=head2 submit
A list of actions to run when the object is clicked. This may be an
-array refrence of a single element; each element may either be a
-moniker of a L<Jifty::Action>. An undefined value submits B<all>
+array refrence or a single element; each element may either be a
+moniker or a L<Jifty::Action>. An undefined value submits B<all>
actions in the form, an empty list reference (the default) submits
none.
Modified: jifty/branches/template-declare/share/web/static/css/forms.css
==============================================================================
--- jifty/branches/template-declare/share/web/static/css/forms.css (original)
+++ jifty/branches/template-declare/share/web/static/css/forms.css Sun Dec 10 23:58:34 2006
@@ -190,6 +190,7 @@
.up_select a {
font-weight: bold;
color: #900;
+}
div.subline {
display: inline;
Added: jifty/branches/template-declare/t/12-param-schema.t
==============================================================================
--- (empty file)
+++ jifty/branches/template-declare/t/12-param-schema.t Sun Dec 10 23:58:34 2006
@@ -0,0 +1,58 @@
+use strict;
+use warnings;
+
+=head1 DESCRIPTION
+
+Tests Jifty::Param::Schema
+
+=cut
+
+use Test::More tests => 16;
+
+package Foo::Action::Bar;
+use Jifty::Param::Schema;
+use Jifty::Action schema {
+
+param keys =>
+ length is 30,
+ label is 'Search Keys',
+ hints are 'Enter your search keys here!',
+ default is 'blah blah blah';
+ type is 'text';
+
+param 'keys2';
+
+param whole_word_only =>
+ type is 'checkbox',
+ label is '',
+ hints are 'Whole word only',
+ default is 1;
+};
+
+package main;
+#use YAML::Syck;
+
+my $args = Foo::Action::Bar->arguments;
+#warn Dump($args);
+
+my $keys = $args->{keys};
+ok $keys, 'keys okay';
+is $keys->{length}, 30, 'length ok';
+is $keys->{label}, 'Search Keys', 'label ok';
+is $keys->{type}, 'text', 'type ok';
+is $keys->{hints}, 'Enter your search keys here!', 'hints okay';
+is $keys->{default_value}, 'blah blah blah', 'default_value okay';
+
+my $keys2 = $args->{keys2};
+ok $keys2, 'keys okay';
+is $keys2->{label}, undef, 'label undefined';
+is $keys2->{type}, 'text', 'type defaults to "text"';
+is $keys2->{hints}, undef, 'hints undefined';
+is $keys2->{default_value}, '', 'default_value defaults to ""';
+
+my $word_only = $args->{whole_word_only};
+ok $word_only, 'keys okay';
+is $word_only->{label}, '', 'label ok';
+is $word_only->{type}, 'checkbox', 'type ok';
+is $word_only->{hints}, 'Whole word only', 'hints ok';
+is $word_only->{default_value}, 1, 'default_value set to 1';
More information about the Jifty-commit
mailing list