Skip to content

Commit

Permalink
move plate edit functionality from own plate edit page to plate view …
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
sajp committed Sep 6, 2012
1 parent ff1be06 commit b20a274
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 196 deletions.
6 changes: 3 additions & 3 deletions lib/LIMS2/WebApp/Controller/User/PlateEdit.pm
Expand Up @@ -56,7 +56,7 @@ sub delete_plate :Path( '/user/delete_plate' ) :Args(0) {
catch {
$c->flash->{error_msg} = 'Error encountered while deleting plate: ' . $_;
$c->model('Golgi')->txn_rollback;
$c->res->redirect( $c->uri_for('/user/edit_plate', { id => $params->{id} }) );
$c->res->redirect( $c->uri_for('/user/view_plate', { id => $params->{id} }) );
};
}
);
Expand All @@ -69,7 +69,7 @@ sub rename_plate :Path( '/user/rename_plate' ) :Args(0) {

unless ( $params->{new_name} ) {
$c->flash->{error_msg} = 'You must specify a new plate name';
$c->res->redirect( $c->uri_for('/user/edit_plate', { id => $params->{id} }) );
$c->res->redirect( $c->uri_for('/user/view_plate', { id => $params->{id} }) );
return;
}

Expand All @@ -92,7 +92,7 @@ sub rename_plate :Path( '/user/rename_plate' ) :Args(0) {
}
);

$c->res->redirect( $c->uri_for('/user/edit_plate', { id => $params->{id} }) );
$c->res->redirect( $c->uri_for('/user/view_plate', { id => $params->{id} }) );
}

=head1 AUTHOR
Expand Down
5 changes: 0 additions & 5 deletions root/site/user/browseplates/index.tt
Expand Up @@ -36,11 +36,6 @@
<td>
<a href="[% c.uri_for( '/user/view_plate', { id => plate.id } ) %]">[% plate.name %]</a>
</td>
<td>
<a class="btn btn-mini" href="[% c.uri_for('/user/edit_plate', { id => plate.id } ) %]">
<i class="icon-pencil"></i> Edit
</a>
</td>
<td>[% plate.type_id %]</td>
<td>[% plate.description %]</td>
<td>[% plate.created_by.name %]</td>
Expand Down
174 changes: 136 additions & 38 deletions root/site/user/browseplates/view.tt
@@ -1,47 +1,145 @@
[%- META title="View Plate"; META tab_name = "Browse" %]
[%- META title="View Plate"; META tab_name = "Plates" %]

<div class="page-header">
<h1>Plate <small>[% plate.name %]</small></h1>
</div>

<table class="table">
<thead>
<tr>
<th>Plate Name</th>
<th>Plate Type</th>
<th>Description</th>
<th>Created By</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<tr>
<td>[% plate.name %]</td>
<td>[% plate.type.id %] ([% plate.type.description %])</td>
<td>[% plate.description %]</td>
<td>[% plate.created_by.name %]</td>
<td>[% plate.created_at.ymd %]</td>
</tr>
</tbody>
</table>

<h2>Comments</h2>
[% IF plate.plate_comments.size %]
<dl>
[% FOR comment IN plate.plate_comments %]
<dt>[% comment.created_by.name %], [% comment.created_at.ymd %]</dt>
<dd>
<p>[% comment.comment_text %]</p>
</dd>
[% END %]
</dl>
[% ELSE %]
<p><em>No comments for this plate.</em></p>
[% END %]
<div class="row">
<div class="span6">
<table class="table">

<tr>
<td>
<strong>Name</strong>
</td>
<td>
[% plate.name %]
</td>
<td>
<a class="btn btn-primary" role="button" href="#RenamePlateModal" data-toggle="modal">
<i class="icon-pencil"></i> Rename
</a>
</td>
</tr>

<tr>
<td>
<strong>Type</strong>
</td>
<td>
[% plate.type.id %] ([% plate.type.description %])
</td>
<td></td>
</tr>

<tr>
<td>
<strong>Description</strong>
</td>
<td>
[% plate.description %]
</td>
<td></td>
</tr>

<tr>
<td>
<strong>Created By</strong>
</td>
<td>
[% plate.created_by.name %]
</td>
<td></td>
</tr>

<tr>
<td>
<strong>Created At</strong>
</td>
<td>
[% plate.created_at.ymd %]
</td>
<td></td>
</tr>

</table>

</div>

<div class="span6">
<div class="well">
<h2>Comments</h2>
[% IF plate.plate_comments.size %]
<dl>
[% FOR comment IN plate.plate_comments %]
<dt>[% comment.created_by.name %], [% comment.created_at.ymd %]</dt>
<dd>
<p>[% comment.comment_text %]</p>
</dd>
[% END %]
</dl>
[% ELSE %]
<p><em>No comments for this plate.</em></p>
[% END %]
</div>
</div>
</div>

<a class="btn" href="[% c.uri_for('/user/edit_plate', { id => plate.id } ) %]">
<i class="icon-pencil"></i> Edit Plate
</a>

<div class="modal hide fade" id="RenamePlateModal">
<form method="POST" id="plate_rename" action="[% c.uri_for( '/user/rename_plate' ) %]" class="modal-form" enctype="multipart/form-data" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3 id="myModalLabel">Rename Plate</h3>
</div>

<div class="modal-body">
<input type="hidden" name="id" value="[% plate.id %]" />
<input type="hidden" name="name" value="[% plate.name %]" />
Rename plate from <strong>[% plate.name %]</strong> to <input name="new_name" id="new_name" type="text" />
</div>

<div class="modal-footer">
<button class="btn" data-dismiss="modal">Cancel</button>
<button name="plate_rename" id="plate_rename" type="submit" value="plate_rename" class="btn btn-primary">
<i class="icon-pencil"></i> Rename Plate
</button>
</div>
</form>
</div>

[% UNLESS plate.has_child_wells %]
<div class="row">
<div class="span2">
<a id="delete_plate_button" class="btn btn-danger" role="button" href="#DeletePlateModal" data-toggle="modal">
<i class="icon-remove icon-white"></i> Delete Plate
</a>
</div>
</div>
</br>

<div class="modal hide fade" id="DeletePlateModal">
<form method="POST" id="plate_delete" action="[% c.uri_for( '/user/delete_plate' ) %]" class="modal-form" enctype="multipart/form-data" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3 id="myModalLabel">Delete Plate</h3>
</div>

<div class="modal-body" align="center">
<input type="hidden" name="id" value="[% plate.id %]" />
<input type="hidden" name="name" value="[% plate.name %]" />
Are you sure you want to delete plate <strong>[% plate.name %]</strong>?
</div>

<div class="modal-footer">
<button class="btn" data-dismiss="modal">Cancel</button>
<button type="submit" value="delete_plate" class="btn btn-danger" id="delete_plate_button" >
<i class="icon-remove icon-white"></i> Confirm Delete Plate
</button>
</div>
</form>
</div>
[% END %]

<h2>Wells</h2>
<a class="btn btn-primary" href="[% well_report_uri %]"><i class="icon-list icon-white"></i> Well Details</a>
143 changes: 0 additions & 143 deletions root/site/user/plateedit/index.tt

This file was deleted.

0 comments on commit b20a274

Please sign in to comment.