Improved the style of the timeline to add consistency.

The timeline is now a table with a more consistent look and feel with
respect to the other tables in the application.
dev
Loic d'Anterroches 2008-11-15 11:31:43 +01:00
parent b85da85dfe
commit 4760c4b563
7 changed files with 149 additions and 16 deletions

View File

@ -22,6 +22,7 @@
# ***** END LICENSE BLOCK ***** */
Pluf::loadFunction('Pluf_HTTP_URL_urlForView');
Pluf::loadFunction('Pluf_Template_dateAgo');
/**
* Base definition of a commit.
@ -158,15 +159,22 @@ class IDF_Commit extends Pluf_Model
*/
public function timelineFragment($request)
{
$tag = new IDF_Template_IssueComment();
$out = $tag->start($this->summary, $request, false);
if ($this->fullmessage) {
$out .= '<br /><br />'.$tag->start($this->fullmessage, $request, false);
}
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit',
array($request->project->shortname,
$this->scm_id));
$out .= '<div class="helptext right"><br />'.__('Commit:').'&nbsp;<a href="'.$url.'" class="mono">'.$this->scm_id.'</a>, '.__('by').' '.strip_tags($this->origauthor).'</div>';
$out = '<tr class="log"><td><a href="'.$url.'">'.
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
'</a></td><td>';
$tag = new IDF_Template_IssueComment();
$out .= $tag->start($this->summary, $request, false);
if (0 && $this->fullmessage) {
$out .= '<br /><br />'.$tag->start($this->fullmessage, $request, false);
}
$out .= '</td>
</tr>
<tr class="extra">
<td colspan="2">
<div class="helptext right">'.__('Commit').'&nbsp;<a href="'.$url.'" class="mono">'.$this->scm_id.'</a>, '.__('by').' '.strip_tags($this->origauthor).'</div></td></tr>';
return Pluf_Template::markSafe($out);
}
}
}

View File

@ -22,6 +22,7 @@
# ***** END LICENSE BLOCK ***** */
Pluf::loadFunction('Pluf_HTTP_URL_urlForView');
Pluf::loadFunction('Pluf_Template_dateAgo');
/**
* Base definition of an issue.
@ -173,11 +174,18 @@ class IDF_Issue extends Pluf_Model
*/
public function timelineFragment($request)
{
$submitter = $this->get_submitter();
$ic = (in_array($this->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($request->project->shortname,
$this->id));
return Pluf_Template::markSafe(sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a> <em>%4$s</em> created by %5$s'), $url, $ic, $this->id, Pluf_esc($this->summary), Pluf_esc($submitter)));
$out = '<tr class="log"><td><a href="'.$url.'">'.
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
'</a></td><td>';
$submitter = $this->get_submitter();
$ic = (in_array($this->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a>, %4$s'), $url, $ic, $this->id, Pluf_esc($this->summary)).'</td>';
$out .= "\n".'<tr class="extra"><td colspan="2">
<div class="helptext right">'.sprintf(__('Creation of <a href="%s">issue&nbsp;%d</a>'), $url, $this->id).', '.__('by').' '.Pluf_esc($submitter).'</div></td></tr>';
return Pluf_Template::markSafe($out);
}
}

View File

@ -122,12 +122,48 @@ class IDF_IssueComment extends Pluf_Model
public function timelineFragment($request)
{
$submitter = $this->get_submitter();
$issue = $this->get_issue();
$ic = (in_array($issue->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
array($request->project->shortname,
$issue->id));
return Pluf_Template::markSafe(sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a> <em>%4$s</em> updated by %5$s'), $url, $ic, $issue->id, Pluf_esc($issue->summary), Pluf_esc($submitter)));
$url .= '#ic'.$this->id;
$out = "\n".'<tr class="log"><td><a href="'.$url.'">'.
Pluf_esc(Pluf_Template_dateAgo($issue->creation_dtime, 'without')).
'</a></td><td>';
$submitter = $issue->get_submitter();
$ic = (in_array($issue->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a>, %4$s'), $url, $ic, $issue->id, Pluf_esc($issue->summary));
if ($this->changedIssue()) {
$out .= '<div class="issue-changes-timeline">';
foreach ($this->changes as $w => $v) {
$out .= '<strong>';
switch ($w) {
case 'su':
$out .= __('Summary:'); break;
case 'st':
$out .= __('Status:'); break;
case 'ow':
$out .= __('Owner:'); break;
case 'lb':
$out .= __('Labels:'); break;
}
$out .= '</strong>';
if ($w == 'lb') {
$out .= Pluf_esc(implode(', ', $v));
} else {
$out .= Pluf_esc($v);
}
$out .= ' ';
}
$out .= '</div>';
}
$out .= '</td></tr>';
$out .= "\n".'<tr class="extra"><td colspan="2">
<div class="helptext right">'.sprintf(__('Comment on <a href="%s">issue&nbsp;%d</a>'), $url, $issue->id).', '.__('by').' '.Pluf_esc($submitter).'</div></td></tr>';
return Pluf_Template::markSafe($out);
}
}

View File

@ -0,0 +1,42 @@
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008 Céondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* Paginator to list the timeline items.
*/
class IDF_Timeline_Paginator extends Pluf_Paginator
{
/**
* Generate a standard "line" of the body.
*
* It is important to note that the table has only 2 columns, so
* the timelineFragment() method of each item must take that into
* account.
*/
function bodyLine($item)
{
$doc = Pluf::factory($item->model_class, $item->model_id);
$doc->public_dtime = $item->public_dtime;
return $doc->timelineFragment($item->request);
}
}

View File

@ -62,8 +62,23 @@ class IDF_Views_Project
$prj = $request->project;
$title = sprintf(__('%s Timeline'), (string) $prj);
$team = $prj->getMembershipData();
$sql = new Pluf_SQL('project=%s', array($prj->id));
$timeline = Pluf::factory('IDF_Timeline')->getList(array('filter'=>$sql->gen(), 'order' => 'creation_dtime DESC'));
$pag = new IDF_Timeline_Paginator(new IDF_Timeline());
$pag->class = 'recent-issues';
$pag->item_extra_props = array('request' => $request);
$pag->summary = __('This table shows the project timeline.');
$pag->forced_where = new Pluf_SQL('project=%s', array($prj->id));
$pag->sort_order = array('creation_dtime', 'ASC');
$pag->sort_reverse_order = array('creation_dtime');
$pag->action = array('IDF_Views_Project::timeline', array($prj->shortname));
$list_display = array(
'creation_dtime' => __('Age'),
'id' => __('Change'),
);
$pag->configure($list_display, array(), array('creation_dtime'));
$pag->items_per_page = 20;
$pag->no_results_text = __('No changes were found.');
$pag->setFromRequest($request);
$downloads = array();
if ($request->rights['hasDownloadsAccess']) {
$tags = IDF_Views_Download::getDownloadTags($prj);
@ -73,7 +88,7 @@ class IDF_Views_Project
return Pluf_Shortcuts_RenderToResponse('project/timeline.html',
array(
'page_title' => $title,
'timeline' => $timeline,
'timeline' => $pag,
'team' => $team,
'downloads' => $downloads,
),

View File

@ -7,6 +7,11 @@
</div>
{/block}
{block body}
{$timeline.render}
{*
<table summary="" class="tree-list">
<thead>
<tr>
@ -23,7 +28,12 @@
{/foreach}
</tbody>
</table>
*}
{/block}
{block context}
{if count($downloads) > 0}
<p><strong>{trans 'Featured Downloads'}</strong><br />

View File

@ -108,6 +108,10 @@ table.recent-issues {
width: 90%;
}
table.recent-issues tr.log {
border-bottom: 1px solid #e7ebe3;
}
table.recent-issues th {
background-color: #e4e8E0;
vertical-align: top;
@ -196,6 +200,16 @@ div.issue-changes {
width: 60%;
}
div.issue-changes-timeline {
background-color: #eeeeec;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin-top: 4px;
padding: 4px;
width: 60%;
color: #888a85;
}
div.issue-submit-info {
background-color: #d3d7cf;
-moz-border-radius: 3px;