← Back to team overview

amm-dev-tem team mailing list archive

[Branch ~amm-dev-tem/amm/trunk] Rev 43: redesigned places's index

 

------------------------------------------------------------
revno: 43
committer: The Whole Life To Learn <thewholelifetolearn@xxxxxxxxx>
branch nick: sources
timestamp: Thu 2011-10-13 21:43:31 +0200
message:
  redesigned places's index
modified:
  app/views/places/index.ctp
  app/webroot/css/amm.css


--
lp:amm
https://code.launchpad.net/~amm-dev-tem/amm/trunk

Your team AMM dev team is subscribed to branch lp:amm.
To unsubscribe from this branch go to https://code.launchpad.net/~amm-dev-tem/amm/trunk/+edit-subscription
=== modified file 'app/views/places/index.ctp'
--- app/views/places/index.ctp	2011-05-28 09:36:45 +0000
+++ app/views/places/index.ctp	2011-10-13 19:43:31 +0000
@@ -1,31 +1,57 @@
-<div class="places index">
+<div class="actions grid_3">
+	<ul>
+		<li><?php echo $this->Html->link(__('New place', true), array('action' => 'add')); ?></li>
+	</ul>
+</div>
+<div class="places index grid_13">
 	<h2><?php __('Places');?></h2>
-	<table cellpadding="0" cellspacing="0">
-	<tr>
-			<th><?php echo $this->Paginator->sort(__('Name', true), 'name');?></th>
-			<th><?php echo $this->Paginator->sort(__('Address', true), 'town');?></th>
-			<th><?php __('Description');?></th>
-			<th class="actions"><?php __('Actions');?></th>
-	</tr>
+	<table>
+		<thead>
+			<tr>
+				<th><?php echo $this->Paginator->sort(__('Name', true), 'name');?></th>
+				<th><?php echo $this->Paginator->sort(__('Address', true), 'town');?></th>
+				<th><?php __('Description');?></th>
+				<th class="actions"><?php __('Actions');?></th>
+			</tr>
+		</thead>
+		<tbody>
 	<?php
-	$i = 0;
 	foreach ($places as $place):
-		$class = null;
-		if ($i++ % 2 == 0) {
-			$class = ' class="altrow"';
-		}
 	?>
-	<tr<?php echo $class;?>>
-		<td><?php echo $place['Place']['name']; ?>&nbsp;</td>
-		<td><?php echo $place['Place']['address'].' '.$place['Place']['address_complementary'].' '.$place['Place']['postal_code'].' '.$place['Place']['town']; ?>&nbsp;</td>
-		<td><?php echo $place['Place']['description']; ?>&nbsp;</td>
-		<td class="actions">
-			<?php echo $this->Html->link(__('View', true), array('action' => 'view', $place['Place']['id'])); ?>
-			<?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $place['Place']['id'])); ?>
-			<?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $place['Place']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $place['Place']['id'])); ?>
-		</td>
-	</tr>
+			<tr>
+				<td><?php echo $place['Place']['name']; ?>&nbsp;</td>
+				<td>
+					<?php
+					$addr = 0;
+					if(!empty($place['Place']['address'])) {
+						echo $place['Place']['address'];
+						$addr++;
+					}
+					if(!empty($place['Place']['address_complementary'])) {
+						if($addr) {
+							echo '<br />';
+						}
+						echo $place['Place']['address_complementary'];
+						$addr++;
+					}
+					if(!empty($place['Place']['postal_code']) or !empty($place['Place']['town'])) {
+						if($addr) {
+							echo '<br />';
+						}
+						echo $place['Place']['postal_code'].' '.$place['Place']['town'];
+						$addr++;
+					}
+					?>&nbsp;
+				</td>
+				<td><?php echo $place['Place']['description']; ?>&nbsp;</td>
+				<td class="actions">
+					<?php echo $this->Html->link($this->Html->image('view_16.png', array('alt' => __('View', true))), array('action' => 'view', $place['Place']['id']), array('escape' => false)); ?>
+					<?php echo $this->Html->link($this->Html->image('edit_16.png', array('alt' => __('Edit', true))), array('action' => 'edit', $place['Place']['id']), array('escape' => false)); ?>
+					<?php echo $this->Html->link($this->Html->image('delete_16.png', array('alt' => __('Delete', true))), array('action' => 'delete', $place['Place']['id']), array('escape' => false), sprintf(__('Are you sure you want to delete %s?', true), $place['Place']['name'])); ?>
+				</td>
+			</tr>
 <?php endforeach; ?>
+		</tbody>
 	</table>
 	<p>
 	<?php
@@ -40,12 +66,4 @@
  |
 		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
 	</div>
-</div>
-<div class="actions">
-	<h3><?php __('Actions'); ?></h3>
-	<ul>
-		<li><?php echo $this->Html->link(__('New Place', true), array('action' => 'add')); ?></li>
-		<li><?php echo $this->Html->link(__('List People', true), array('controller' => 'people', 'action' => 'index')); ?> </li>
-		<li><?php echo $this->Html->link(__('New Person', true), array('controller' => 'people', 'action' => 'add')); ?> </li>
-	</ul>
 </div>
\ No newline at end of file

=== modified file 'app/webroot/css/amm.css'
--- app/webroot/css/amm.css	2011-10-08 12:52:27 +0000
+++ app/webroot/css/amm.css	2011-10-13 19:43:31 +0000
@@ -44,6 +44,9 @@
 input[type="submit"]{
 	height: 30px;
 }
+table tbody td{
+	line-height: 18px;
+}
 #header{
 	height: 60px;
 }