Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added messages list view

  • Loading branch information...
commit 757e7a30fa39f8f5b771ffe5d7ef36d334fbb037 1 parent bd939fa
Filippo authored
View
BIN  data/phpcollab_unit_test.db
Binary file not shown
View
9 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginMessage.class.php
@@ -10,4 +10,13 @@ public function setUp()
parent::setUp();
$this->addListener(new EventLogDoctrineListener());
}
+
+ public function getLastCommentDate()
+ {
+ if ($last_comment = Doctrine::getTable('Message')->getLastComment($this->id))
+ {
+ return $last_comment->created_at;
+ }
+ return $this->created_at;
+ }
}
View
8 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginMessageTable.class.php
@@ -13,4 +13,12 @@ public function getQueryForProjectMessages($project_id)
->where('m.project_id = '. $project_id)
->orderBy('m.created_at DESC');
}
+
+ public function getLastComment($id)
+ {
+ return Doctrine::getTable('fdComment')->
+ getQueryForListByModelAndFieldAndValue('Message', 'id', $id)->
+ orderBy('created_at DESC')->
+ fetchOne();
+ }
}
View
86 plugins/idProjectManagementPlugin/modules/idMessage/templates/indexSuccess.php
@@ -1,53 +1,45 @@
<?php slot('title', __('Messages for project').' '.$project->getName()) ?>
-<div class="block" id="block-tables">
- <?php include_partial('create_message_menu'); ?>
- <div class="content">
- <div class="inner">
-
- <table class="table">
- <tr>
- <th class="first">&nbsp;</th>
- <th><?php echo __('Title') ?></th>
- <th><?php echo __('Creation date') ?></th>
- <th><?php echo __('Created by') ?></th>
- <th class="last">
- <?php if($sf_user->hasCredential('idMessage-Edit')): ?>
- <?php echo __('Actions'); ?>
- <?php endif; ?>
- </th>
- </tr>
-
- <?php if (count($pager->getResults()) !== false && count($pager->getResults()) == 0): ?>
- <tr class="odd">
- <td></td>
- <td colspan="5"><?php echo __('No Results') ?></td>
- <td></td>
- </tr>
- <?php else: ?>
- <?php foreach ($pager->getResults() as $message): ?>
- <tr class="odd">
- <td>&nbsp;</td>
- <td><?php echo link_to($message->getTitle(), '@show_message?project_id='.$message->project_id.'&message_id='.$message->id); ?></td>
- <td><?php echo $message->getCreatedAt(); ?></td>
- <td><?php echo $message->UserProfile; ?></td>
- <td>
- <?php if($sf_user->hasCredential('idMessage-Edit')): ?>
- <?php echo link_to(__('Edit'), '@edit_message?project_id='.$project->getId().'&message_id='.$message->getId()) ?> |
- <?php echo link_to(__('Delete'), '@delete_message?project_id='.$project->getId().'&message_id='.$message->getId(), array('confirm' => __('Do you really want to delete this tracker?'))) ?>
- <?php endif; ?>
- </td>
- </tr>
- <?php endforeach; ?>
- <?php endif; ?>
- <tr>
- <td></td>
- <td><?php echo pager_navigation($pager, '@index_messages?project_id='.$sf_request->getParameter('project_id')) ?></td>
- <td></td>
- </tr>
- </table>
+<div id="content" class="span-23">
+ <?php include_partial('idProject/sub_menu', array('project' => $project))?>
+ <div class="span-full">
+ <div class="title">
+ <span><?php echo __('Messages'); ?></span>
+ <a id="add-log-time"class="button block-green medium-round" href="<?php echo url_for('@new_message?project_id='.$project->id) ?>">Add</a>
+ </div>
+ <div class="menu">
+ <div class="span-5">Title</div>
+ <div class="span-12">Description</div>
+ <div class="span-3 last">Last reply</div>
</div>
- </div>
+ <ul class="action time">
+ <?php if($pager->getNbResults() > 0): ?>
+ <?php foreach($pager->getResults() as $message): ?>
+ <li class="icon-comment">
+ <ul>
+ <li class="span-5"><?php echo link_to($message->getTitle(), '@show_message?project_id='.$message->project_id.'&message_id='.$message->id); ?></li>
+ <li class="span-12"><?php echo $message->getBody() ?></li>
+ <li class="span-5 last"><?php echo format_date($message->getLastCommentDate(), 'dd MMMM, HH:mm') ?>&nbsp;</li>
+ <li class="edit-delete">
+ <?php echo link_to(__('Edit'), '@edit_message?project_id='.$message->project_id.'&message_id='.$message->id) ?>&nbsp;&nbsp;
+ <?php echo link_to(__('Delete'), '@delete_message?project_id='.$message->project_id.'&message_id='.$message->id, array('confirm' => __('Do you really want to delete this message?'))) ?>
+ </li>
+ </ul>
+ </li>
+ <?php endforeach; ?>
+ <?php else: ?>
+ <li class="span-22 last">No results</li>
+ <?php endif; ?>
+ </ul>
+ </div>
+ <?php if($pager->haveToPaginate()):?>
+ <div class="span-full pagenation">
+ <ul>
+ <?php echo pager_navigation_log_time($pager, '@index_message?project_id='.$issue->project_id) ?>
+ </ul>
+ </div>
+ <?php endif; ?>
</div>
+
View
2  test/functional/fe/idProjectMessageCreateTest.php
@@ -15,7 +15,7 @@
click('Projects')->
click('Il mio secondo progetto')->
click('Discussions')->
- click('Create a new message')->
+ click('Add')->
with('request')->begin()->
isParameter('module', 'idMessage')->
View
4 test/functional/fe/idProjectMessageDeleteTest.php
@@ -17,7 +17,7 @@
click('Discussions')->
with('response')->begin()->
- checkElement('table.table tr', 4)->
+ checkElement('ul li.icon-comment', 2)->
end()->
click('Delete')->
@@ -30,6 +30,6 @@
end()->
with('response')->begin()->
- checkElement('table.table tr', 3)->
+ checkElement('ul li.icon-comment', 1)->
end()
;
View
21 test/functional/fe/idProjectMessageListTest.php
@@ -23,18 +23,17 @@
end()->
with('response')->begin()->
- checkElement('table.table tr th:contains("Title")')->
- checkElement('table.table tr th:contains("Creation date")')->
- checkElement('table.table tr th:contains("Created by")')->
+ checkElement('.menu div:contains("Title")')->
+ checkElement('.menu div:contains("Description")')->
+ checkElement('.menu div:contains("Last reply")')->
- checkElement('table.table tr td:contains("Primo messaggio")')->
- checkElement('table.table tr td a[href~="idProject/2/idMessage/show/1"]', 'Primo messaggio')->
- checkElement('table.table tr td:contains("Secondo messaggio")')->
- checkElement('table.table tr td a[href~="idProject/2/idMessage/show/2"]', 'Secondo messaggio')->
- checkElement('table.table tr td:contains("prog (puser) prog")', 2)->
-
- checkElement('table.table tr td:contains("Edit")', 2)->
- checkElement('table.table tr td:contains("Delete")', 2)->
+ checkElement('ul li:contains("Primo messaggio")')->
+ checkElement('ul li a[href~="idProject/2/idMessage/show/1"]', 'Primo messaggio')->
+ checkElement('ul li:contains("Secondo messaggio")')->
+ checkElement('ul li a[href~="idProject/2/idMessage/show/2"]', 'Secondo messaggio')->
+
+ checkElement('ul li ul li:contains("Edit")', 2)->
+ checkElement('ul li ul li:contains("Delete")', 2)->
end()
;
View
7 test/unit/pluginMessageTableTest.php
@@ -10,7 +10,12 @@
$message_query = Doctrine::getTable('Message')->getQueryForProjectMessages(2);
$results = $message_query->execute();
-$t = new lime_test(2, new lime_output_color());
+$t = new lime_test(4, new lime_output_color());
$t->ok($message_query instanceof Doctrine_query, 'retrieveQueryForProjectMessages returns a Doctrine_Query instance');
$t->is(count($results), 2, 'retrieveQueryForProjectessages returns the right Doctrine_Query instance');
+
+
+$last_comment = Doctrine::getTable('Message')->getLastComment(1);
+$t->is('pippo', $last_comment->title, 'getLastComment ok');
+$t->is('pippo pippo poivnonjoifwe ijewjpfjpw ....', $last_comment->body, 'getLastComment ok');
Please sign in to comment.
Something went wrong with that request. Please try again.