[Rt-commit] r5891 - in commitbit: . share/web/templates/project
jesse at bestpractical.com
jesse at bestpractical.com
Sun Sep 10 18:24:35 EDT 2006
Author: jesse
Date: Sun Sep 10 18:24:34 2006
New Revision: 5891
Modified:
commitbit/ (props changed)
commitbit/lib/CommitBit/Model/Project.pm
commitbit/lib/CommitBit/Model/ProjectMember.pm
commitbit/lib/CommitBit/Model/User.pm
commitbit/share/web/templates/project/.people.swp
commitbit/share/web/templates/project/people
Log:
r27337 at pinglin: jesse | 2006-09-10 23:24:23 +0100
Checkpoint
Modified: commitbit/lib/CommitBit/Model/Project.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/Project.pm (original)
+++ commitbit/lib/CommitBit/Model/Project.pm Sun Sep 10 18:24:34 2006
@@ -24,8 +24,14 @@
# Your model-specific methods go here.
-sub members {}
-sub admins {}
+sub members {
+ 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 => 'observer');
+ return $members;
+}
Modified: commitbit/lib/CommitBit/Model/ProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/ProjectMember.pm (original)
+++ commitbit/lib/CommitBit/Model/ProjectMember.pm Sun Sep 10 18:24:34 2006
@@ -23,5 +23,18 @@
# Your model-specific methods go here.
+sub canonicalize_user {
+ my $self = shift;
+ my $value = shift;
+ return $value if ($value =~ /^\d+$/);
+
+ my $u = CommitBit::Model::User->new();
+ $u->load_or_create( email => $value);
+ return $u->id();
+
+
+}
+
+
1;
Modified: commitbit/lib/CommitBit/Model/User.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/User.pm (original)
+++ commitbit/lib/CommitBit/Model/User.pm Sun Sep 10 18:24:34 2006
@@ -6,8 +6,6 @@
use CommitBit::Record schema {
column 'email' =>
- type is 'text';
- column 'username' =>
type is 'text',
is 'unique',
is 'immutable',
@@ -30,7 +28,6 @@
};
# Your model-specific methods go here.
-
sub _brief_description {
'name_and_email';
@@ -38,7 +35,7 @@
sub name_and_email {
my $self = shift;
- return $self->username . " <".$self->email.">";
+ return join(' ', $self->nickname , "<".$self->email.">");
}
1;
Modified: commitbit/share/web/templates/project/.people.swp
==============================================================================
Binary files. No diff available.
Modified: commitbit/share/web/templates/project/people
==============================================================================
--- commitbit/share/web/templates/project/people (original)
+++ commitbit/share/web/templates/project/people Sun Sep 10 18:24:34 2006
@@ -1,9 +1,27 @@
<h1>People involved with <%$project->name%>
<h2><%_('Committers')%></h2>
+<% Jifty->web->form->start%>
% my $committers = $project->members;
<ul>
% while (my $committer = $committers->next) {
-<li><%comitter->name_and_email%></li>
+% my $del = Jifty->web->new_action(class => 'DeleteProjectMember', arguments => { id => $committer->id});
+<li><%$committer->name_and_email%> <%Jifty->web->form->submit(actions => $del)%></li>
% }
</ul>
+<h2><%_('Add a new committer')%></h2>
+<% $new_committer->form_field('user')%>
+<% $new_committer->form_field('role')%>
+<% $new_committer->form_field('project', render_as => 'Hidden')%>
+
+<% Jifty->web->form->submit(actions => $new_committer)%>
+<% Jifty->web->form->end%>
+<%init>
+my $new_committer = Jifty->web->new_action(
+ class => 'CreateProjectMember',
+ arguments => { project => $project }
+);
+</%init>
+<%args>
+$project
+</%args>
More information about the Rt-commit
mailing list