Subscriptions we want to support Create,Read,Update,Delete Class: MyApp::Record::Foo For hiveminder: NEWS * on every page, we have a little box with the 3 most recent news entries:

News

<%perl> my $sub = Jifty::ClientSubscription->new( query_class => 'BTDT::Model::News', query => ['id_not' => undef], # Ordering? on_add => [ { render_with => '/fragments/news/item', render => after => 'news.entries.last_child' }, { # how do we remove something if there are more than 3? } ]); For hiveminder: My page is: list of: tasks matching 'owner me, complete is not true' each item is rendered as '/fragments/tasklist/view, with args %ARGS and record => $found Subscribe to: * creation of things that match 'owner me, complete is not true' * update, delete to anything that matches 'owner me, complete is not true' after the changes * update, delete to anything that matches 'owner me, complete is not true' before the changes "Render this component as": wrapper list of items matching the subscription 'owner me, complete is not true' render each item with '/fragments/tasklist/view', args => %ARGS, item $found my $subscription = Jifty::ClientSubscription->new( on_add => { args => \%ARGS, render_with => '/fragments/tasklist/view', render => after => '.parent.last_child' # before, after, replacing }, on_remove => { args => \%ARGS, render => replacing => 'self' render_with => '/fragments/tasklist/fade_away' }, query_class => 'BTDT::Model::Task', query => [ owner => 'me', complete_not => 'true' ] ); # Session::ClientSide-ish encoding of SIDs to subscribe # Each request carries IDs of its existing subs (stashed into ->subs) my $sid = Jifty->subs->add( query_class => 'Ping', query => [ host => '127.0.0.1' ], render_with => '/fragments/pong', ); Jifty->subs->cancel($sid); # This actually just calls the fragments with Publisher-msg structures as %ARGS # Print-on-void-context, return-on-other-contexts Jifty->subs->render;