Removed AJAX loading of User Enquiries view. This will make the initial load time of the View User page longer, but you can now update the status of the Enquiry again from that page. closes issue #52.

This commit is contained in:
Karl Cordes 2011-07-21 07:01:50 +10:00
parent 33369009bf
commit 5ddc942a93
5 changed files with 143 additions and 174 deletions

View file

@ -111,13 +111,14 @@ class UsersController extends AppController {
break;
case 'user':
//$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id)));
$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id)));
$status_list = $this->User->Enquiry->Status->getJSON();
$this->set('status_list', $status_list);
$classNames = $this->User->Enquiry->Status->getClassNamesJSON();
$this->set('class_names', $classNames);
$this->render('viewUser');
break;
default:

View file

@ -33,7 +33,6 @@
echo $javascript->link('global');
echo $javascript->link('search');
echo $javascript->link('jquery.jeditable.mini');
//echo $javascript->link('ckeditor/adapters/jquery');
echo $javascript->link('jquery.validate');
echo $scripts_for_layout;

View file

@ -37,7 +37,7 @@
<h3><?php __('Enquiries Assigned to this User');?></h3>
<? /* If there are enquiries for this user, render the enquiries table passing the $enquiries array */ ?>
<?php if (!empty($user['Enquiry'])) {
echo $this->element('enquiry_table', $enquiries);
echo $this->element('enquiry_table', $enquiries, $status_list);
}
else {
echo "No Enquiries for this User";

View file

@ -1,4 +1,3 @@
<?=$javascript->link('view_user'); ?>
<?=$javascript->link('view_user_email'); ?>
<span id="userID" style="display: none;"><?=$user['User']['id']?></span>
@ -33,15 +32,15 @@
</dl>
</div>
<div class="related">
<h3><?php __('Enquiries Assigned to this User');?></h3>
<button id="show" class="showHide">Show</button>
<button id="hide" class="showHide">Hide</button>
<h3><?php __('Enquiries Assigned to '.$user['User']['first_name'].' '.$user['User']['last_name']);?></h3>
<?php if (!empty($enquiries)) {
echo $this->element('enquiry_table', $enquiries);
}
else {
echo "No Enquiries have been assigned";
}
?>
<div id="ajaxLoadEnquiry" style="display:none;"><?php echo $html->image('ajax-loader.gif'); ?></div>
<div id="enquiryTable">
</div>
</div>

View file

@ -2,26 +2,6 @@ $(function() {
$('#show').hide();
$("#ajaxLoadEnquiry").hide();
var userID = $('#userID').text();
var enquiriesURL = '/enquiries/view_user_enquiries/'+userID;
getPage(enquiriesURL);
$("div.paging > a, div.paging > span > a, th.paginatorSort > a").live('click',function() {
destination = $(this).attr('href');
getPage(destination);
return false;
});
$('#hide').click(function() {
$(this).hide();
$('#show').show();
@ -35,14 +15,4 @@ $(function() {
$('#enquiryTable').slideDown('fast');
});
function getPage(url) {
$.get(url, function(data) {
$('#enquiryTable').html(data);
});
}
});