[Rt-commit] r5894 - in commitbit: . lib/CommitBit/Action
share/web/templates/project
jesse at bestpractical.com
jesse at bestpractical.com
Sun Sep 10 19:56:48 EDT 2006
Author: jesse
Date: Sun Sep 10 19:56:47 2006
New Revision: 5894
Modified:
commitbit/ (props changed)
commitbit/lib/CommitBit/Action/CreateProjectMember.pm
commitbit/lib/CommitBit/Model/ProjectMember.pm
commitbit/lib/CommitBit/Model/User.pm
commitbit/share/web/templates/project/people
Log:
r27343 at pinglin: jesse | 2006-09-11 00:48:08 +0100
* Checkpoiint
Modified: commitbit/lib/CommitBit/Action/CreateProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Action/CreateProjectMember.pm (original)
+++ commitbit/lib/CommitBit/Action/CreateProjectMember.pm Sun Sep 10 19:56:47 2006
@@ -9,7 +9,7 @@
sub arguments {
my $self = shift;
my $args = $self->SUPER::arguments();
-
+ delete $args->{'user'}{valid_values};
$args->{'user'}{'render_as'} = 'Text';
return $args;
Modified: commitbit/lib/CommitBit/Model/ProjectMember.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/ProjectMember.pm (original)
+++ commitbit/lib/CommitBit/Model/ProjectMember.pm Sun Sep 10 19:56:47 2006
@@ -23,16 +23,40 @@
# Your model-specific methods go here.
-sub canonicalize_user {
+sub create {
+ my $self = shift;
+ my %args = (@_);
+
+ $args{'user'} = $self->_email_to_id($args{'user'});
+
+ return $self->SUPER::create(%args);
+
+
+}
+
+sub validate_user {
+ my $self = shift;
+ my $val = shift;
+ return (1) if ($val =~ /^\d+$/ || $val =~ /@/);
+ return undef;
+
+}
+
+sub set_user {
+ my $self = shift;
+ my $val = shift;
+ $val = $self->_email_to_id($val);
+ $self->_set(column => 'user', value => $val);
+}
+
+sub _email_to_id {
my $self = shift;
my $value = shift;
- return $value if ($value =~ /^\d+$/);
+ return $value if (ref $value || $value =~ /^\d+$/);
my $u = CommitBit::Model::User->new();
$u->load_or_create( email => $value);
return $u->id();
-
-
}
Modified: commitbit/lib/CommitBit/Model/User.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/User.pm (original)
+++ commitbit/lib/CommitBit/Model/User.pm Sun Sep 10 19:56:47 2006
@@ -35,7 +35,7 @@
sub name_and_email {
my $self = shift;
- return join(' ', $self->nickname , "<".$self->email.">");
+ return join(' ', ($self->nickname ||''), "<".$self->email.">");
}
1;
Modified: commitbit/share/web/templates/project/people
==============================================================================
--- commitbit/share/web/templates/project/people (original)
+++ commitbit/share/web/templates/project/people Sun Sep 10 19:56:47 2006
@@ -1,3 +1,4 @@
+<&|/_elements/wrapper&>
<h1>People involved with <%$project->name%>
<h2><%_('Committers')%></h2>
@@ -5,8 +6,16 @@
% my $committers = $project->members;
<ul>
% while (my $committer = $committers->next) {
-% my $del = Jifty->web->new_action(class => 'DeleteProjectMember', arguments => { id => $committer->id});
-<li><%$committer->name_and_email%> <%Jifty->web->form->submit(actions => $del)%></li>
+% my $member = CommitBit::Model::ProjectMember->new();
+% $member->load_by_cols (project => $project, user => $committer);
+% my $del = Jifty->web->new_action(class => 'DeleteProjectMember', record => $member, moniker => 'delete-member-'.$member->id);
+<li><%$committer->name_and_email%>
+<%$del->form_field('id')%>
+ <% $del->button( label => 'Delete committer',
+ class => 'delete',
+ onclick => qq|return confirm('Really revoke this person's project access?');| ) %>
+
+ </li>
% }
</ul>
<h2><%_('Add a new committer')%></h2>
@@ -14,12 +23,13 @@
<% $new_committer->form_field('role')%>
<% $new_committer->form_field('project', render_as => 'Hidden')%>
-<% Jifty->web->form->submit(actions => $new_committer)%>
+<% Jifty->web->form->submit(submit => $new_committer, label => 'Invite em!')%>
<% Jifty->web->form->end%>
+</&>
<%init>
my $new_committer = Jifty->web->new_action(
class => 'CreateProjectMember',
- arguments => { project => $project }
+ arguments => { project => $project->id }
);
</%init>
<%args>
More information about the Rt-commit
mailing list