From 4760c4b56369c3d3aec4df4661c983277b0fb1e3 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Sat, 15 Nov 2008 11:31:43 +0100 Subject: [PATCH] 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. --- src/IDF/Commit.php | 22 ++++++++----- src/IDF/Issue.php | 14 +++++++-- src/IDF/IssueComment.php | 42 +++++++++++++++++++++++-- src/IDF/Timeline/Paginator.php | 42 +++++++++++++++++++++++++ src/IDF/Views/Project.php | 21 +++++++++++-- src/IDF/templates/project/timeline.html | 10 ++++++ www/media/idf/css/style.css | 14 +++++++++ 7 files changed, 149 insertions(+), 16 deletions(-) create mode 100644 src/IDF/Timeline/Paginator.php diff --git a/src/IDF/Commit.php b/src/IDF/Commit.php index 13e71f6..2e39a91 100644 --- a/src/IDF/Commit.php +++ b/src/IDF/Commit.php @@ -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 .= '

'.$tag->start($this->fullmessage, $request, false); - } $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit', array($request->project->shortname, $this->scm_id)); - $out .= '

'.__('Commit:').' '.$this->scm_id.', '.__('by').' '.strip_tags($this->origauthor).'
'; + $out = ''. + Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')). + ''; + $tag = new IDF_Template_IssueComment(); + $out .= $tag->start($this->summary, $request, false); + if (0 && $this->fullmessage) { + $out .= '

'.$tag->start($this->fullmessage, $request, false); + } + $out .= ' + + + +
'.__('Commit').' '.$this->scm_id.', '.__('by').' '.strip_tags($this->origauthor).'
'; return Pluf_Template::markSafe($out); } -} \ No newline at end of file +} diff --git a/src/IDF/Issue.php b/src/IDF/Issue.php index b69e220..ea3c27b 100644 --- a/src/IDF/Issue.php +++ b/src/IDF/Issue.php @@ -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(__('Issue %3$d %4$s created by %5$s'), $url, $ic, $this->id, Pluf_esc($this->summary), Pluf_esc($submitter))); + $out = ''. + Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')). + ''; + $submitter = $this->get_submitter(); + $ic = (in_array($this->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o'; + $out .= sprintf(__('Issue %3$d, %4$s'), $url, $ic, $this->id, Pluf_esc($this->summary)).''; + + $out .= "\n".' +
'.sprintf(__('Creation of issue %d'), $url, $this->id).', '.__('by').' '.Pluf_esc($submitter).'
'; + return Pluf_Template::markSafe($out); } } \ No newline at end of file diff --git a/src/IDF/IssueComment.php b/src/IDF/IssueComment.php index 5619f1d..4651407 100644 --- a/src/IDF/IssueComment.php +++ b/src/IDF/IssueComment.php @@ -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(__('Issue %3$d %4$s updated by %5$s'), $url, $ic, $issue->id, Pluf_esc($issue->summary), Pluf_esc($submitter))); + $url .= '#ic'.$this->id; + $out = "\n".''. + Pluf_esc(Pluf_Template_dateAgo($issue->creation_dtime, 'without')). + ''; + $submitter = $issue->get_submitter(); + $ic = (in_array($issue->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o'; + $out .= sprintf(__('Issue %3$d, %4$s'), $url, $ic, $issue->id, Pluf_esc($issue->summary)); + + if ($this->changedIssue()) { + $out .= '
'; + foreach ($this->changes as $w => $v) { + $out .= ''; + switch ($w) { + case 'su': + $out .= __('Summary:'); break; + case 'st': + $out .= __('Status:'); break; + case 'ow': + $out .= __('Owner:'); break; + case 'lb': + $out .= __('Labels:'); break; + } + $out .= ''; + if ($w == 'lb') { + $out .= Pluf_esc(implode(', ', $v)); + } else { + $out .= Pluf_esc($v); + } + $out .= ' '; + } + $out .= '
'; + } + $out .= ''; + + + $out .= "\n".' +
'.sprintf(__('Comment on issue %d'), $url, $issue->id).', '.__('by').' '.Pluf_esc($submitter).'
'; + + return Pluf_Template::markSafe($out); } } diff --git a/src/IDF/Timeline/Paginator.php b/src/IDF/Timeline/Paginator.php new file mode 100644 index 0000000..2c0084c --- /dev/null +++ b/src/IDF/Timeline/Paginator.php @@ -0,0 +1,42 @@ +model_class, $item->model_id); + $doc->public_dtime = $item->public_dtime; + return $doc->timelineFragment($item->request); + } +} diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php index 2c9344d..509c692 100644 --- a/src/IDF/Views/Project.php +++ b/src/IDF/Views/Project.php @@ -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, ), diff --git a/src/IDF/templates/project/timeline.html b/src/IDF/templates/project/timeline.html index afbdc6e..64de139 100644 --- a/src/IDF/templates/project/timeline.html +++ b/src/IDF/templates/project/timeline.html @@ -7,6 +7,11 @@ {/block} {block body} + + +{$timeline.render} + +{* @@ -23,7 +28,12 @@ {/foreach}
+ +*} {/block} + + + {block context} {if count($downloads) > 0}

{trans 'Featured Downloads'}
diff --git a/www/media/idf/css/style.css b/www/media/idf/css/style.css index ba1c55a..8bf0c7e 100644 --- a/www/media/idf/css/style.css +++ b/www/media/idf/css/style.css @@ -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;