[Rt-commit] r5928 - in commitbit: . bin etc lib/CommitBit lib/CommitBit/Action lib/CommitBit/Notification share/web/templates share/web/templates/admin share/web/templates/admin/project share/web/templates/admin/repository share/web/templates/let share/web/templates/project share/web/templates/repository

jesse at bestpractical.com jesse at bestpractical.com
Wed Sep 13 18:49:50 EDT 2006


Author: jesse
Date: Wed Sep 13 18:49:46 2006
New Revision: 5928

Added:
   commitbit/bin/create_admin   (contents, props changed)
   commitbit/lib/CommitBit/Action/Login.pm
   commitbit/lib/CommitBit/Action/Logout.pm
   commitbit/lib/CommitBit/CurrentUser.pm
   commitbit/lib/CommitBit/Notification/
   commitbit/lib/CommitBit/Notification/ConfirmAddress.pm   (contents, props changed)
   commitbit/share/web/templates/admin/index.html
   commitbit/share/web/templates/admin/project/
      - copied from r5927, /commitbit/share/web/templates/project/
   commitbit/share/web/templates/admin/repository/
      - copied from r5927, /commitbit/share/web/templates/repository/
   commitbit/share/web/templates/let/
   commitbit/share/web/templates/let/confirm_email
   commitbit/share/web/templates/login
   commitbit/share/web/templates/logout
   commitbit/share/web/templates/signup
Removed:
   commitbit/share/web/templates/project/.people.swp
   commitbit/share/web/templates/project/people
   commitbit/share/web/templates/repository/
Modified:
   commitbit/   (props changed)
   commitbit/etc/config.yml
   commitbit/lib/CommitBit/Action/CreateProjectMember.pm
   commitbit/lib/CommitBit/Dispatcher.pm
   commitbit/lib/CommitBit/Model/Project.pm
   commitbit/lib/CommitBit/Model/ProjectMember.pm
   commitbit/lib/CommitBit/Model/Repository.pm
   commitbit/lib/CommitBit/Model/User.pm
   commitbit/share/web/templates/admin/project/index.html
   commitbit/share/web/templates/admin/repository/index.html
   commitbit/share/web/templates/admin/repository/projects
   commitbit/share/web/templates/index.html
   commitbit/share/web/templates/project/index.html

Log:
 r27422 at pinglin:  jesse | 2006-09-13 23:25:42 +0100
 * checkpoint
 


Added: commitbit/bin/create_admin
==============================================================================
--- (empty file)
+++ commitbit/bin/create_admin	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+
+use lib 'lib';
+
+use Jifty::Everything;
+use CommitBit::CurrentUser;
+use CommitBit::Model::User;
+use Getopt::Long;
+Jifty->new();
+my $email;
+GetOptions('email=s' => \$email,
+       );
+
+die "You must supply a --email=foo\@example.com flag to $0" unless ($email);
+
+my $u = CommitBit::Model::User->new(current_user => CommitBit::CurrentUser->superuser);
+
+my ($id,$msg) = $u->create( email => $email, password => 'password', email_confirmed => 1, admin => 1);
+print $msg ."\n";
+
+
+1;

Modified: commitbit/etc/config.yml
==============================================================================
--- commitbit/etc/config.yml	(original)
+++ commitbit/etc/config.yml	Wed Sep 13 18:49:46 2006
@@ -1,6 +1,6 @@
 --- 
 framework: 
-  AdminMode: 1
+  AdminMode: 0
   ApplicationClass: CommitBit
   ApplicationName: CommitBit
   Database: 
@@ -17,9 +17,6 @@
   LogLevel: DEBUG
   Mailer: Sendmail
   MailerArgs: []
-
-  Plugins: []
-
   Web: 
     BaseURL: http://localhost
     DataDir: var/mason

Modified: commitbit/lib/CommitBit/Action/CreateProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Action/CreateProjectMember.pm	(original)
+++ commitbit/lib/CommitBit/Action/CreateProjectMember.pm	Wed Sep 13 18:49:46 2006
@@ -2,7 +2,7 @@
 use warnings;
 use strict;
 
-use base qw/CommitBit::Action Jifty::Action::Record::Create/;
+use base qw/Jifty::Action::Record::Create/;
 
 sub record_class {'CommitBit::Model::ProjectMember'}
 
@@ -11,6 +11,7 @@
     my $args = $self->SUPER::arguments();
     delete $args->{'user'}{valid_values}; 
     $args->{'user'}{'render_as'} = 'Text';
+    $args->{'user'}{'hints'} = _('Please enter an email address. CommitBit will take care of the rest');
     
     return $args;
 }

Added: commitbit/lib/CommitBit/Action/Login.pm
==============================================================================
--- (empty file)
+++ commitbit/lib/CommitBit/Action/Login.pm	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,120 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+CommitBit::Action::Login
+
+=cut
+
+package CommitBit::Action::Login;
+use base qw/CommitBit::Action/;
+
+__PACKAGE__->mk_accessors(qw/user/);
+
+=head2 arguments
+
+Return the email and password form fields
+
+=cut
+
+use Jifty::Param::Schema;
+use Jifty::Action schema {
+    param
+        email => label is 'Email address',
+        is mandatory, ajax validates;
+    param
+        password => type is 'password',
+        label is 'Password', is mandatory;
+
+    param
+        remember => type is 'checkbox',
+        label is 'Remember me?',
+        hints is 'If you want, your browser can remember your login for you',
+        default is 0;
+
+};
+
+=head2 take_action
+
+Actually check the user's password. If it's right, log them in.
+Otherwise, throw an error.
+
+
+=cut
+
+sub take_action {
+    my $self = shift;
+
+    if ( $self->validate_login ) {
+        $self->login_as_user( $self->user );
+        $self->success_message;
+        return 1;
+    }
+
+    $self->error_message();
+
+    return 0;
+}
+
+sub validate_login {
+    my $self = shift;
+
+    $self->user( $self->new_currentuser( email => $self->argument_value('email') ) );
+    if ( !$self->user->id ) {
+        $self->log->debug('No record found in db');
+        return 0;
+    }
+    if ( !$self->user->password_is( $self->argument_value('password') ) ) {
+        $self->log->debug('Invalid password');
+        return 0;
+    };
+
+
+    unless (  $self->user->user_object->email_confirmed ) {
+     warn "". defined $self->user->user_object->email_confirmed?1:0 ."";
+        $self->log->debug('Unconfirmed' . 
+      Jifty::YAML::Dump($self->user->user_object->{'values'}));
+        $self->result->error(q{You haven't confirmed your account yet.});
+        return 0;
+    }
+
+    return 1;
+}
+
+sub login_as_user {
+    my $self = shift;
+    my $user = shift;
+
+    # Actually do the signin thing.
+    Jifty->web->current_user($user);
+    Jifty->web->session->expires(
+        $self->argument_value('remember') ? '+1y' : undef );
+    Jifty->web->session->set_cookie;
+
+}
+
+sub success_message {
+    my $self = shift;
+
+    # Set up our login message
+    $self->result->message("Welcome back!");
+
+}
+
+sub error_message {
+    my $self = shift;
+    unless ( $self->result->error ) {
+        $self->result->error(
+            q{You may have mistyped something. Give it another shot?});
+    }
+
+}
+
+sub new_currentuser {
+    my $self = shift;
+    my $user = CommitBit::CurrentUser->new(@_);
+    return $user;
+
+}
+1;

Added: commitbit/lib/CommitBit/Action/Logout.pm
==============================================================================
--- (empty file)
+++ commitbit/lib/CommitBit/Action/Logout.pm	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,35 @@
+use warnings;
+use strict;
+
+=head1 NAME
+
+CommitBit::Action::Logout
+
+=cut
+
+package CommitBit::Action::Logout;
+use base qw/Jifty::Action/;
+
+=head2 arguments
+
+Return the email and password form fields
+
+=cut
+
+sub arguments {
+    return ( {} );
+}
+
+=head2 take_action
+
+Nuke the current user object
+
+=cut
+
+sub take_action {
+    my $self = shift;
+    Jifty->web->current_user(undef);
+    return 1;
+}
+
+1;

Added: commitbit/lib/CommitBit/CurrentUser.pm
==============================================================================
--- (empty file)
+++ commitbit/lib/CommitBit/CurrentUser.pm	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,30 @@
+package CommitBit::CurrentUser;
+
+use warnings;
+use strict;
+
+use base 'Jifty::CurrentUser';
+
+sub password_is {
+    my $self = shift;
+    my $pass = shift;
+    return 1 if ( $self->user_object->__value('password') eq $pass );
+    return undef;
+
+}
+
+sub _init {
+    my $self = shift;
+    my %args = (@_);
+
+    if ( delete $args{'_bootstrap'} ) {
+        $self->is_bootstrap_user(1);
+    } elsif ( keys %args ) {
+        $self->user_object(
+            CommitBit::Model::User->new( current_user => $self ) );
+        $self->user_object->load_by_cols(%args);
+    }
+    $self->SUPER::_init(%args);
+}
+
+1;

Modified: commitbit/lib/CommitBit/Dispatcher.pm
==============================================================================
--- commitbit/lib/CommitBit/Dispatcher.pm	(original)
+++ commitbit/lib/CommitBit/Dispatcher.pm	Wed Sep 13 18:49:46 2006
@@ -1,7 +1,78 @@
 package CommitBit::Dispatcher;
 use Jifty::Dispatcher -base;
 
-on qr'^/repository/(.+?)(/.*|)$' => run {
+before '*' => run {
+    if (Jifty->web->current_user->id) {
+        Jifty->web->navigation->child( logout=>label=>_( 'Logout'), url => '/logout');
+    } else {
+        Jifty->web->navigation->child(login=>label=>_( 'Login'), url => '/login');
+
+
+    }
+
+};
+
+before '/admin/' => run {
+    unless (Jifty->web->current_user->id) {
+            tangent '/login';
+    }
+};
+
+# Sign up for an account
+on 'signup' => run {
+    redirect('/') if ( Jifty->web->current_user->id );
+    set 'action' =>
+        Jifty->web->new_action(
+	    class => 'Signup',
+	    moniker => 'signupbox'
+	);
+
+    set 'next' => Jifty->web->request->continuation
+        || Jifty::Continuation->new(
+        request => Jifty::Request->new( path => "/" ) );
+
+};
+
+# Login
+on 'login' => run {
+    set 'action' =>
+        Jifty->web->new_action(
+	    class => 'Login',
+	    moniker => 'loginbox'
+	);
+    set 'next' => Jifty->web->request->continuation
+        || Jifty::Continuation->new(
+        request => Jifty::Request->new( path => "/" ) );
+};
+
+# Log out
+before 'logout' => run {
+    Jifty->web->request->add_action(
+        class   => 'Logout',
+        moniker => 'logout',
+    );
+};
+
+## LetMes
+before qr'^/let/(.*)' => run {
+    my $let_me = Jifty::LetMe->new();
+    $let_me->from_token($1);
+    redirect '/error/let_me/invalid_token' unless $let_me->validate;
+
+    Jifty->web->temporary_current_user($let_me->validated_current_user);
+
+    my %args = %{$let_me->args};
+    set $_ => $args{$_} for keys %args;
+    set let_me => $let_me;
+};
+
+on qr'^/let/' => run {
+    my $let_me = get 'let_me';
+    show '/let/' . $let_me->path;
+};
+
+
+on qr'^/admin/repository/(.+?)(/.*|)$' => run {
     my $name    = $1;
     my $path    = $2;
     $name = URI::Escape::uri_unescape($name);
@@ -14,13 +85,13 @@
 
     set repository => $repository;
 
-    show( '/repository/' . $path || '/repository/index.html' );
+    show( '/admin/repository/' . $path || '/repository/index.html' );
 };
 
-on qr'^/project/(.+?)(/.*|)$' => run {
-    my $name    = $1;
-    my $path    = $2;
-    warn "Name - $name - $path";
+on qr'^/(.*?/)?project/(.+?)(/.*|)$' => run {
+    my $prefix = $1 ||'';
+    my $name    = $2;
+    my $path    = $3;
     $name = URI::Escape::uri_unescape($name);
     my $project = CommitBit::Model::Project->new();
     $project->load_by_cols( name => $name );
@@ -30,7 +101,7 @@
 
     set project => $project;
 
-    show( '/project/' . $path || '/project/index.html' );
+    show $prefix . ('/project/' . $path || '/project/index.html' );
 };
 
 1;

Modified: commitbit/lib/CommitBit/Model/Project.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/Project.pm	(original)
+++ commitbit/lib/CommitBit/Model/Project.pm	Wed Sep 13 18:49:46 2006
@@ -17,6 +17,16 @@
         is immutable,
         refers_to CommitBit::Model::Repository;
 
+
+    column 'svn_url_anon' => type is 'text';
+    column 'svn_url_auth' => type is 'text';
+    column 'svnweb_url' => type is 'text';
+    column 'wiki_url' => type is 'text';
+    column 'bugtracker_url' => type is 'text';
+    column 'lists_url' => type is 'text';
+    column 'license' => type is 'text',
+        valid_values are ('GPLv2' ,'Perl 5.8', 'Artistic 2.0', 'BSD', 'MIT', 'Death and repudiation');
+
     column 'public' =>
         type is 'boolean',
         default is '1';
@@ -42,11 +52,45 @@
     my $members = CommitBit::Model::UserCollection->new();
     my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'user');
     $members->limit(alias =>$projmembers, column => 'project', value => $self->id);
-    $members->limit(alias => $projmembers, column => 'role', operator => '!=', value => 'observer');
+    $members->limit(alias => $projmembers, column => 'role', operator => '=', value => 'author', entry_aggregator => 'or');
+    $members->limit(alias => $projmembers, column => 'role', operator => '=', value => 'administrator', entry_aggregator => 'or');
+    return $members;
+}
+
+sub admins {
+    my $self = shift;
+    my $members = CommitBit::Model::UserCollection->new();
+    my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'user');
+    $members->limit(alias =>$projmembers, column => 'project', value => $self->id);
+    $members->limit(alias => $projmembers, column => 'role', operator => '=', value => 'administrator', entry_aggregator => 'or');
     return $members;
 }
 
 
+sub is_project_admin {
+    my $self = shift;
+    my $person = shift; # user or currentuser
+
+    # XXX TODO, this is a hacky, heavy query.
+    my $admins = $self->admins();
+    $admins->limit( column => 'id', value =>$person->id);
+    return $admins->count;
+
+} 
+
+sub current_user_can {
+    my $self = shift;
+    my $right = shift;
+    if ($right eq 'read') { return 1 }
+    if (($right eq 'create' or $right eq 'update' or $right eq 'delete') and $self->current_user->user_object->admin) {
+        return 1;
+    }
+    if (( $right eq 'update' or $right eq 'delete') and $self->is_project_admin($self->current_user)) {
+        return 1;
+    }
+    return 0;
+
+}
 
 
 1;

Modified: commitbit/lib/CommitBit/Model/ProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/ProjectMember.pm	(original)
+++ commitbit/lib/CommitBit/Model/ProjectMember.pm	Wed Sep 13 18:49:46 2006
@@ -3,7 +3,9 @@
 
 package CommitBit::Model::ProjectMember;
 use Jifty::DBI::Schema;
+#use Jifty::RightsFrom column => 'project';
 
+sub current_user_can {1}
 use CommitBit::Model::User;
 use CommitBit::Model::Project;
 

Modified: commitbit/lib/CommitBit/Model/Repository.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/Repository.pm	(original)
+++ commitbit/lib/CommitBit/Model/Repository.pm	Wed Sep 13 18:49:46 2006
@@ -94,7 +94,14 @@
     my $args = { @_ };
     my $prefix = abs_path( Jifty->config->app("repository_prefix") );
 
-    unless (exists $args->{path} and length $args->{path}) {
+    warn "That means my prefix is ".$prefix;
+
+    if (exists $args->{path} and length $args->{path}) {
+             if ( ! File::Spec->file_name_is_absolute( $args->{'path'} )) {
+	        $args->{path} = File::Spec->catdir($prefix, $args->{path});
+             }
+
+    } else {
 	$args->{path} = File::Spec->catdir($prefix, $args->{name});
     }
 
@@ -118,7 +125,7 @@
     my $self = shift;
     my $project = shift;
 
-    $self->_svn('mkdir', -m => 'Project '.$project->name.' init by CommitBit',
+    $self->_svn('mkdir', -m => 'Project '.$project->name.' init by CommitBit '.$CommitBit::VERSION,
 		map { "file://".File::Spec::Unix->catdir($self->path, $project->root_path, $_)}
 	        '', 'trunk', 'branches', 'tags');
 
@@ -140,7 +147,7 @@
         print $fh $self->autogenerated_file_warning;
         my $users = $self->associated_users;
         while (my $user = $users->next) {
-            print $fh `htpasswd -nmb @{[$user->email]} @{[$user->password]}`;
+            print $fh `htpasswd -nmb @{[$user->email]} @{[$user->__value('password')]}`;
         }
     };
 }
@@ -153,7 +160,7 @@
         print $fh "[users]\n";
         my $users = $self->associated_users;
         while (my $user = $users->next) {
-            print $fh $user->email. ' = '. $user->password. "\n";
+            print $fh $user->email. ' = '. $user->__value('password'). "\n";
         }
 
 	# all users that involves in any project in the repository
@@ -165,7 +172,7 @@
 
     my $authz = {};
     my $projects = CommitBit::Model::ProjectCollection->new();
-    $projects->unlimit;
+    $projects->limit(column => 'repository', value => $self->id);
 
     with_write_lock {
 
@@ -253,9 +260,23 @@
 
 sub run_cmd {
     my $self = shift;
-    system(@_);
+    system(@_) || die $!;
+
+}
+
+
+
+sub current_user_can {
+    my $self = shift;
+    my $right = shift;
+    if ($right eq 'read') { return 1 }
+    elsif (($right eq 'create' or $right eq 'update' or $right eq 'delete') and $self->current_user->user_object->admin) {
+        return 1;
+    }
+    return 0
 
 }
 
+
 1;
 

Modified: commitbit/lib/CommitBit/Model/User.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/User.pm	(original)
+++ commitbit/lib/CommitBit/Model/User.pm	Wed Sep 13 18:49:46 2006
@@ -2,28 +2,16 @@
 use warnings;
 
 package CommitBit::Model::User;
+use Text::Password::Pronounceable;
 use Jifty::DBI::Schema;
 
 use CommitBit::Record schema {
-    column 'email' =>
-        type is 'text',
-        is 'distinct',
-        is 'immutable',
-        is 'mandatory';
-    column email_validated =>
-        type is 'boolean', 
-        default is '0';
-    column 'password' =>
-        type is 'text',
-        render_as 'password';
-    column 'nickname' =>
-        type is 'text';
-    column 'created' => 
-        type is 'timestamp',
-        is immutable;
-    column admin =>
-        type is 'boolean',
-        default is '0';
+    column 'nickname' => type is 'text';
+    column 'email' => type is 'text', is 'distinct', is 'immutable', is 'mandatory';
+    column 'password' => type is 'text', render_as 'password';
+    column 'created' => type is 'timestamp', is immutable;
+    column admin => type is 'boolean', default is '0';
+    column email_confirmed => type is 'boolean', default is '0';
 
 };
 
@@ -33,15 +21,14 @@
 
 }
 
-use Text::Password::Pronounceable;
 
-my $pp = Text::Password::Pronounceable->new(8,10);
+our $PASSWORD_GEN = Text::Password::Pronounceable->new(8,10);
 
 sub create {
     my $self = shift;
     my $args = { @_ };
     unless (length $args->{password}) {
-	$args->{password} = $pp->generate;
+	$args->{password} = $PASSWORD_GEN->generate;
     }
     return $self->SUPER::create(%$args);
 }
@@ -50,6 +37,27 @@
     my $self = shift;
     return join(' ', ($self->nickname ||''), "<".$self->email.">");
 }
+  
+
+=head2 current_user_can
+
+=cut
 
+sub current_user_can {
+    my $self = shift;
+    my $right = shift;
+    my %args = (@_); 
+    if ($right eq 'read') { 
+        if ($args{'column'} eq 'password') {
+                return 0;
+        }
+        return 1;
+
+         }
+    elsif (($right eq 'create' or $right eq 'update' or $right eq 'delete') and ($self->current_user->user_object && $self->current_user->user_object->admin)) {
+        return 1;
+    }
+    return $self->SUPER::current_user_can(@_);
+}
 1;
 

Added: commitbit/lib/CommitBit/Notification/ConfirmAddress.pm
==============================================================================
--- (empty file)
+++ commitbit/lib/CommitBit/Notification/ConfirmAddress.pm	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,55 @@
+use warnings;
+use strict;
+
+package Jifty::Plugin::Login::Notification::ConfirmAddress;
+use base qw/Jifty::Notification Jifty::Plugin::Login/;
+
+=head1 NAME
+
+Jifty::Plugin::Login::Notification::ConfirmAddress
+
+=head1 ARGUMENTS
+
+C<to>, a L<Jifty::Plugin::Login::Model::User> whose address we are confirming.
+
+=cut
+
+=head2 setup
+
+Sets up the fields of the message.
+
+=cut
+
+sub setup {
+    my $self = shift;
+    my $LoginUser = $self->LoginUserClass;
+
+    unless ( UNIVERSAL::isa($self->to, $LoginUser) ){
+	$self->log->error((ref $self) . " called with invalid user argument");
+	return;
+    } 
+   
+
+    my $letme = Jifty::LetMe->new();
+    $letme->email($self->to->email);
+    $letme->path('confirm_email'); 
+    my $confirm_url = $letme->as_url;
+    my $appname = Jifty->config->framework('ApplicationName');
+
+    $self->subject( "Welcome to $appname!" );
+    $self->from( Jifty->config->framework('AdminEmail') );
+
+    $self->body(<<"END_BODY");
+
+You're getting this message because you (or somebody claiming to be you)
+signed up for $appname.
+
+Before you can use $appname, we need to make sure that we got your email
+address right.  Click on the link below to get started:
+
+$confirm_url
+
+END_BODY
+}
+
+1;

Added: commitbit/share/web/templates/admin/index.html
==============================================================================
--- (empty file)
+++ commitbit/share/web/templates/admin/index.html	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,27 @@
+<&|/_elements/wrapper, title => 'Commit bit!' &>
+
+<h1><%_('Welcome to CommitBit')%></h1>
+
+<p><%_('Local repositories')%></p>
+<dl>
+% my $repositorys = CommitBit::Model::RepositoryCollection->new;
+% $repositorys->unlimit();
+% while ( my $p = $repositorys->next ) {
+<dt><%Jifty->web->link( url => '/admin/repository/'.$p->name, label => $p->name)%></dt>
+<dd<%$p->description%></dd>
+% }
+</dl>
+% if (Jifty->web->current_user->user_object->admin) {
+(<% Jifty->web->link( label => 'Create another repository', url => '/admin/create_repository')%>)
+% }
+
+<p><%_('Pick a project')%></p>
+<dl>
+% my $projects = CommitBit::Model::ProjectCollection->new;
+% $projects->unlimit();
+% while ( my $p = $projects->next ) {
+<dt><%Jifty->web->link( url => '/admin/project/'.$p->name, label => $p->name)%></dt>
+<dd<%$p->description%></dd>
+% }
+</dl>
+</&>

Modified: commitbit/share/web/templates/admin/project/index.html
==============================================================================
--- /commitbit/share/web/templates/project/index.html	(original)
+++ commitbit/share/web/templates/admin/project/index.html	Wed Sep 13 18:49:46 2006
@@ -14,5 +14,5 @@
 % Jifty->web->form->end;
 
 
-<%Jifty->web->link( label => 'People', url => '/project/'.$project->name.'/people')%>
+<%Jifty->web->link( label => 'People', url => '/admin/project/'.$project->name.'/people')%>
 </&>

Modified: commitbit/share/web/templates/admin/repository/index.html
==============================================================================
--- /commitbit/share/web/templates/repository/index.html	(original)
+++ commitbit/share/web/templates/admin/repository/index.html	Wed Sep 13 18:49:46 2006
@@ -18,7 +18,7 @@
 <%
 Jifty->web->link(
     label => 'Projects',
-    url   => '/repository/' . $repository->name . '/projects'
+    url   => '/admin/repository/' . $repository->name . '/projects'
     )
 
 %>

Modified: commitbit/share/web/templates/admin/repository/projects
==============================================================================
--- /commitbit/share/web/templates/repository/projects	(original)
+++ commitbit/share/web/templates/admin/repository/projects	Wed Sep 13 18:49:46 2006
@@ -5,7 +5,7 @@
 <ul>
 % while (my $project = $projects->next) {
 % my $del = Jifty->web->new_action(class => 'DeleteProject', record => $project, moniker => 'delete-project-'.$project->id);
-<li><%Jifty->web->link( label=> $project->name, url => '/project/'.$project->name)%> 
+<li><%Jifty->web->link( label=> $project->name, url => '/admin/project/'.$project->name)%> 
 <%$del->form_field('id')%>
     <% $del->button( label    => 'Delete project',
                                class    => 'delete',

Modified: commitbit/share/web/templates/index.html
==============================================================================
--- commitbit/share/web/templates/index.html	(original)
+++ commitbit/share/web/templates/index.html	Wed Sep 13 18:49:46 2006
@@ -2,17 +2,7 @@
 
 <h1><%_('Welcome to CommitBit')%></h1>
 
-<p><%_('Local repositories')%></p>
-<dl>
-% my $repositorys = CommitBit::Model::RepositoryCollection->new;
-% $repositorys->unlimit();
-% while ( my $p = $repositorys->next ) {
-<dt><%Jifty->web->link( url => '/repository/'.$p->name, label => $p->name)%></dt>
-<dd<%$p->description%></dd>
-% }
-</dl>
-(<% Jifty->web->link( label => 'Create another repository', url => '/admin/create_repository')%>)
-<p><%_('Pick a project')%></p>
+<p><%_('Locally hosted projects')%></p>
 <dl>
 % my $projects = CommitBit::Model::ProjectCollection->new;
 % $projects->unlimit();
@@ -21,4 +11,5 @@
 <dd<%$p->description%></dd>
 % }
 </dl>
+
 </&>

Added: commitbit/share/web/templates/let/confirm_email
==============================================================================
--- (empty file)
+++ commitbit/share/web/templates/let/confirm_email	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,7 @@
+<%init>
+Jifty->web->new_action(
+    moniker => 'confirm_email',
+    class   => 'ConfirmEmail',
+)->run;
+Jifty->web->redirect("/");
+</%init>

Added: commitbit/share/web/templates/login
==============================================================================
--- (empty file)
+++ commitbit/share/web/templates/login	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,20 @@
+<%args>
+$action => undef
+$next => undef
+</%args>
+<&|/_elements/wrapper, title => 'Login' &>
+
+% if (not Jifty->web->current_user->id) {
+<h2>Login</h2>
+<% Jifty->web->form->start(call => $next, name => "loginbox") %>
+<% $action->form_field('email') %>
+<% $action->form_field('password') %>
+<% $action->form_field('remember') %>
+<% Jifty->web->form->submit(label => 'Login', submit => $action) %>
+<% Jifty->web->form->end %>
+<% Jifty->web->tangent( label => q{Don't have an account?}, url => '/signup' )%>
+% }
+% else {
+You're already logged in.
+% }
+</&>

Added: commitbit/share/web/templates/logout
==============================================================================
--- (empty file)
+++ commitbit/share/web/templates/logout	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,3 @@
+<&| /_elements/wrapper, title => "Logged out" &>
+<p>Ok, you're now logged out. Have a good day.</p>
+</&>

Modified: commitbit/share/web/templates/project/index.html
==============================================================================
--- commitbit/share/web/templates/project/index.html	(original)
+++ commitbit/share/web/templates/project/index.html	Wed Sep 13 18:49:46 2006
@@ -6,13 +6,55 @@
 </%init>
 <&|/_elements/wrapper,title => $project->name &>
 <h1><%$project->name%></h1>
-% Jifty->web->form->start;
-% foreach my $arg ($edit->argument_names) {
-<%$edit->form_field($arg)%>
-%}
-<% Jifty->web->form->submit(label => 'Save changes')%>
-% Jifty->web->form->end;
+<blockquote>
+    <%$project->description%>
+</blockquote>
 
+<h2>Mailing lists</h2>
 
-<%Jifty->web->link( label => 'People', url => '/project/'.$project->name.'/people')%>
+<%Jifty->web->link( url => $project->lists_url, label => $project->lists_url)%>
+
+<h2>Wiki</h2>
+
+<%Jifty->web->link( url => $project->wiki_url, label => $project->wiki_url)%>
+
+<h2>Bug tracking</h2>
+
+<%Jifty->web->link( url => $project->bugtracker_url, label => $project->bugtracker_url)%>
+
+<h2>Version control</h2>
+
+<h3>Repository browser</h3>
+
+<%Jifty->web->link( url => $project->svnweb_url, label => $project->svnweb_url)%>
+
+
+<h3>Anonymous access</h3>
+
+<%Jifty->web->link( url => $project->svn_url_anon, label => $project->svn_url_anon)%>
+
+<h3>Committer access</h3>
+<%Jifty->web->link( url => $project->svn_url_auth, label => $project->svn_url_auth)%>
+<h2>License</h2>
+
+<div id="people">
+    <h2>People</h2>
+
+    <h3>Administrators</h3>
+<ul>
+% while (my $u = $admins->next) {
+<li><%$u->name_and_email%></li>
+% }
+</ul>
+    <h3>Authors</h3>
+<ul>
+% while (my $u = $authors->next) {
+<li><%$u->name_and_email%></li>
+% }
+</div>
 </&>
+<%init>
+my $authors = $project->members;
+my $admins = $project->admins;
+
+</%init>

Added: commitbit/share/web/templates/signup
==============================================================================
--- (empty file)
+++ commitbit/share/web/templates/signup	Wed Sep 13 18:49:46 2006
@@ -0,0 +1,13 @@
+<%args>
+$action
+$next
+</%args>
+<&|/_elements/wrapper, title => 'Signup' &>
+<h2>Signup</h2>
+<% Jifty->web->form->start(call => $next, name => "signupbox") %>
+% foreach my $key ($action->argument_names) {
+<% $action->form_field($key) %>
+% }
+<% Jifty->web->form->submit(label => 'Signup', submit => $action) %>
+<% Jifty->web->form->end %>
+</&>


More information about the Rt-commit mailing list