[Rt-commit] r5972 - in commitbit: . trunk/etc trunk/lib/CommitBit
trunk/share/web/static/css trunk/share/web/templates
trunk/share/web/templates/admin
trunk/share/web/templates/admin/project
trunk/share/web/templates/admin/repository
trunk/share/web/templates/project
jesse at bestpractical.com
jesse at bestpractical.com
Sun Sep 17 09:34:29 EDT 2006
Author: jesse
Date: Sun Sep 17 09:34:27 2006
New Revision: 5972
Added:
commitbit/trunk/share/web/static/css/
commitbit/trunk/share/web/static/css/app.css
commitbit/trunk/share/web/static/css/nav.css
Modified:
commitbit/ (props changed)
commitbit/trunk/etc/config.yml
commitbit/trunk/lib/CommitBit/Dispatcher.pm
commitbit/trunk/lib/CommitBit/Model/Project.pm
commitbit/trunk/lib/CommitBit/Model/Repository.pm
commitbit/trunk/share/web/templates/admin/index.html
commitbit/trunk/share/web/templates/admin/project/index.html
commitbit/trunk/share/web/templates/admin/project/people
commitbit/trunk/share/web/templates/admin/repository/projects
commitbit/trunk/share/web/templates/index.html
commitbit/trunk/share/web/templates/login
commitbit/trunk/share/web/templates/project/index.html
Log:
r27634 at pinglin: jesse | 2006-09-17 15:34:22 +0200
* ui tweaking
Modified: commitbit/trunk/etc/config.yml
==============================================================================
--- commitbit/trunk/etc/config.yml (original)
+++ commitbit/trunk/etc/config.yml Sun Sep 17 09:34:27 2006
@@ -33,3 +33,4 @@
TemplateRoot: share/web/templates
application:
repository_prefix: repos
+ site_name: our projects
Modified: commitbit/trunk/lib/CommitBit/Dispatcher.pm
==============================================================================
--- commitbit/trunk/lib/CommitBit/Dispatcher.pm (original)
+++ commitbit/trunk/lib/CommitBit/Dispatcher.pm Sun Sep 17 09:34:27 2006
@@ -1,13 +1,21 @@
package CommitBit::Dispatcher;
use Jifty::Dispatcher -base;
+
+# Log out
+before 'logout' => run {
+ Jifty->web->new_action(
+ class => 'Logout',
+ moniker => 'logout',
+ )->run;
+};
before '*' => run {
if (Jifty->web->current_user->id) {
- Jifty->web->navigation->child( logout=>label=>_( 'Logout'), url => '/logout');
+ Jifty->web->navigation->child( logout=>label=>_( 'Logout'), url => '/logout', sort_order => 999);
} else {
- Jifty->web->navigation->child(login=>label=>_( 'Login'), url => '/login');
+ Jifty->web->navigation->child(login=>label=>_( 'Login'), url => '/login', sort_order => 999);
}
- if (Jifty->web->current_user->user_object->admin) {
+ if (Jifty->web->current_user->user_object and Jifty->web->current_user->user_object->admin) {
Jifty->web->navigation->child(admin=>label=>_( 'Admin'), url => '/admin');
}
@@ -46,14 +54,6 @@
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();
Modified: commitbit/trunk/lib/CommitBit/Model/Project.pm
==============================================================================
--- commitbit/trunk/lib/CommitBit/Model/Project.pm (original)
+++ commitbit/trunk/lib/CommitBit/Model/Project.pm Sun Sep 17 09:34:27 2006
@@ -47,21 +47,40 @@
}
-sub members {
+
+sub _related_people {
my $self = shift;
my $members = CommitBit::Model::UserCollection->new();
my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'person');
$members->limit(alias =>$projmembers, column => 'project', value => $self->id);
+ return $projmembers => $members;
+}
+
+
+sub people {
+ my $self = shift;
+ my ($projmembers,$members) = $self->_related_people();
+ return $members;
+}
+
+
+sub observers {
+ my $self = shift;
+ my ($projmembers,$members) = $self->_related_people();
+ $members->limit(alias => $projmembers, column => 'access_level', operator => '=', value => 'observer', entry_aggregator => 'or');
+ return $members;
+}
+
+sub members {
+ my $self = shift;
+ my ($projmembers,$members) = $self->_related_people();
$members->limit(alias => $projmembers, column => 'access_level', operator => '=', value => 'author', entry_aggregator => 'or');
- $members->limit(alias => $projmembers, column => 'access_level', operator => '=', value => 'administrator', entry_aggregator => 'or');
return $members;
}
-sub admins {
+sub administrators {
my $self = shift;
- my $members = CommitBit::Model::UserCollection->new();
- my $projmembers =$members->join( alias1 => 'main', column1=>'id', table2 => 'project_members', column2 => 'person');
- $members->limit(alias =>$projmembers, column => 'project', value => $self->id);
+ my ($projmembers,$members) = $self->_related_people();
$members->limit(alias => $projmembers, column => 'access_level', operator => '=', value => 'administrator', entry_aggregator => 'or');
return $members;
}
@@ -71,10 +90,9 @@
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;
+ my $administrators = $self->administrators();
+ $administrators->limit( column => 'id', value =>$person->id);
+ return $administrators->count;
}
Modified: commitbit/trunk/lib/CommitBit/Model/Repository.pm
==============================================================================
--- commitbit/trunk/lib/CommitBit/Model/Repository.pm (original)
+++ commitbit/trunk/lib/CommitBit/Model/Repository.pm Sun Sep 17 09:34:27 2006
@@ -219,7 +219,10 @@
print $file $self->autogenerated_file_warning;
while ( my $project = $projects->next ) {
print $file "[/" . $project->root_path . "]\n" || die $@;
- foreach my $user ( @{ $project->members->items_array_ref } ) {
+ foreach my $user ( @{
+ $project->members->items_array_ref,
+ $project->administrators->items_array_ref
+ } ) {
print $file $user->email . " = rw\n" || die $@;
}
if ($project->publicly_visible) {
Added: commitbit/trunk/share/web/static/css/app.css
==============================================================================
--- (empty file)
+++ commitbit/trunk/share/web/static/css/app.css Sun Sep 17 09:34:27 2006
@@ -0,0 +1,19 @@
+div#salutation {
+ float: right;
+ position: absolute;
+ right:5px;
+ top: 5px;
+}
+
+div#people {
+
+ top: 1em;
+ clear: both;
+ position: absolute;
+ right: 10px;
+
+ }
+
+div#people h3 {
+ text-decoration: underline ;
+}
Added: commitbit/trunk/share/web/static/css/nav.css
==============================================================================
--- (empty file)
+++ commitbit/trunk/share/web/static/css/nav.css Sun Sep 17 09:34:27 2006
@@ -0,0 +1,76 @@
+/* from http://www.456bereastreet.com/lab/csstabs/nested/# */
+
+
+
+
+div#navigation {
+ float: left;
+ width: 200px;
+ font-size: 80%;
+}
+
+
+div#content {
+ position: fixed;
+ left: 220px;
+ right: 10px;
+}
+
+div#navigation ul {
+
+ margin-top: 0;
+ border-top: 0;
+ padding-top: 0;
+
+ font-family:Tahoma,"Trebuchet MS", sans-serif;
+
+ color:#000;
+}
+ul.menu {
+ margin-left: -2em;
+
+}
+ul.menu li {
+ list-style: none;
+
+
+}
+ul.submenu {
+}
+ul.submenu li {
+ font-size: 90%;
+ margin-left: -1em;
+
+}
+ul.submenu li+li {
+
+
+}
+div#navigation a:link,
+div#navigation a:visited,
+div#navigation a:hover {
+}
+div#navigation ul.menu a:link,
+div#navigation ul.menu a:visited,
+div#navigation ul.menu a:hover {
+ font-weight:bold;
+ text-transform:uppercase;
+}
+div#navigation ul.menu a:hover {
+ background-color:#24568E;
+}
+div#navigation ul.menu li.active a:link,
+div#navigation ul.menu li.active a:visited,
+div#navigation ul.menu li.active a:hover {
+ font-weight: bold;
+ border-bottom-color:#24568E;
+}
+div#navigation ul.submenu a:link,
+div#navigation ul.submenu a:visited,
+div#navigation ul.submenu a:hover {
+ font-weight:normal;
+ border:0;
+}
+div#navigation ul.submenu a:hover {
+ text-decoration:underline;
+}
Modified: commitbit/trunk/share/web/templates/admin/index.html
==============================================================================
--- commitbit/trunk/share/web/templates/admin/index.html (original)
+++ commitbit/trunk/share/web/templates/admin/index.html Sun Sep 17 09:34:27 2006
@@ -1,6 +1,4 @@
-<&|/_elements/wrapper, title => 'Commit bit!' &>
-
-<h1><%_('Welcome to CommitBit')%></h1>
+<&|/_elements/wrapper, title => _('Manage projects and repositories')&>
From this administrative interface, you can manage projects and repositories, (assuming that you've got the permissions)
</&>
Modified: commitbit/trunk/share/web/templates/admin/project/index.html
==============================================================================
--- commitbit/trunk/share/web/templates/admin/project/index.html (original)
+++ commitbit/trunk/share/web/templates/admin/project/index.html Sun Sep 17 09:34:27 2006
@@ -4,8 +4,7 @@
<%init>
my $edit = Jifty->web->new_action(class =>'UpdateProject', record => $project);
</%init>
-<&|/_elements/wrapper,title => $project->name &>
-<h1><%$project->name%></h1>
+<&|/_elements/wrapper,title => _('Overview of %1', $project->name) &>
% Jifty->web->form->start;
% foreach my $arg ($edit->argument_names) {
<%$edit->form_field($arg)%>
Modified: commitbit/trunk/share/web/templates/admin/project/people
==============================================================================
--- commitbit/trunk/share/web/templates/admin/project/people (original)
+++ commitbit/trunk/share/web/templates/admin/project/people Sun Sep 17 09:34:27 2006
@@ -1,17 +1,15 @@
-<&|/_elements/wrapper&>
-<h1>People involved with <%$project->name%>
+<&|/_elements/wrapper, title => _('People involved with %1',$project->name)&>
-<h2><%_('Committers')%></h2>
<% Jifty->web->form->start%>
-% my $committers = $project->members;
+% my $committers = $project->people;
<ul>
% while (my $committer = $committers->next) {
% my $member = CommitBit::Model::ProjectMember->new();
% $member->load_by_cols (project => $project, person => $committer);
% my $del = Jifty->web->new_action(class => 'DeleteProjectMember', record => $member, moniker => 'delete-member-'.$member->id);
-<li><%$committer->name_and_email%>
+<li><%$committer->name_and_email%> (<%$member->access_level%>)
<%$del->form_field('id')%>
- <% $del->button( label => 'Delete committer',
+ <% $del->button( label => 'Delete',
class => 'delete',
onclick => qq|return confirm('Really revoke this person's project access?');| ) %>
Modified: commitbit/trunk/share/web/templates/admin/repository/projects
==============================================================================
--- commitbit/trunk/share/web/templates/admin/repository/projects (original)
+++ commitbit/trunk/share/web/templates/admin/repository/projects Sun Sep 17 09:34:27 2006
@@ -1,5 +1,4 @@
-<&|/_elements/wrapper&>
-<h1>Projects in <%$repository->name%>
+<&|/_elements/wrapper, title => _('Projects in %1',$repository->name) &>
<% Jifty->web->form->start%>
% my $projects = $repository->projects;
<ul>
Modified: commitbit/trunk/share/web/templates/index.html
==============================================================================
--- commitbit/trunk/share/web/templates/index.html (original)
+++ commitbit/trunk/share/web/templates/index.html Sun Sep 17 09:34:27 2006
@@ -1,8 +1,7 @@
-<&|/_elements/wrapper, title => 'Commit bit!' &>
+<&|/_elements/wrapper, title => _('Welcome to CommitBit for %1', Jifty->config->app('site_name')) &>
-<h1><%_('Welcome to CommitBit')%></h1>
-<p><%_('Locally hosted projects')%></p>
+<h2><%_('Locally hosted projects')%></h2>
<dl>
% my $projects = CommitBit::Model::ProjectCollection->new;
% $projects->unlimit();
Modified: commitbit/trunk/share/web/templates/login
==============================================================================
--- commitbit/trunk/share/web/templates/login (original)
+++ commitbit/trunk/share/web/templates/login Sun Sep 17 09:34:27 2006
@@ -12,7 +12,7 @@
<% $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' )%>
+%#<% Jifty->web->tangent( label => q{Don't have an account?}, url => '/signup' )%>
% }
% else {
You're already logged in.
Modified: commitbit/trunk/share/web/templates/project/index.html
==============================================================================
--- commitbit/trunk/share/web/templates/project/index.html (original)
+++ commitbit/trunk/share/web/templates/project/index.html Sun Sep 17 09:34:27 2006
@@ -40,21 +40,21 @@
<div id="people">
<h2>People</h2>
- <h3>Administrators</h3>
+% foreach my $type (sort keys %people) {
+
+<h3><%_(ucfirst($type))%></h3>
<ul>
-% while (my $u = $admins->next) {
+% while (my $u = $people{$type}->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;
-
+my %people = (
+ observers => $project->observers,
+ authors => $project->members,
+ administrators => $project->administrators
+);
</%init>
More information about the Rt-commit
mailing list