Skip to content
Snippets Groups Projects
Commit 861b0185 authored by Tim Steiner's avatar Tim Steiner
Browse files

Remember which comment tab the user is on between the viewing of different requests

parent bab468bb
No related branches found
Tags
No related merge requests found
......@@ -261,6 +261,7 @@ class RequestController extends Nmc_Controller_Action
}
$view = new Application_View();
$view->selectedCommentTab = Nmc_Registry_Session::getInstance('comments')->selectedTab;
$view->page = 'request/view';
$view->request = $request;
$view->currentGeneration = $currentGeneration;
......@@ -276,6 +277,13 @@ class RequestController extends Nmc_Controller_Action
$out->setBody($view->render('unlModernWrapper.xhtml'));
}
public function setCommentTabAction()
{
$in = $this->getRequest();
$tab = $in->getParam(0);
Nmc_Registry_Session::getInstance('comments')->selectedTab = $tab;
}
public function addCommentAction()
{
$in = $this->getRequest();
......
......@@ -120,15 +120,21 @@
</form>
<?php } else { ?>
<?php
if (!in_array($this->selectedCommentTab, array('commentsTab', 'editorsCommentsTab', 'privateCommentsTab'))) {
$this->selectedCommentTab = 'commentsTab';
}
?>
<div id="comments">
<div class="tabBar">
<a href="#" id="commentsTab" class="selected">Comments</a>
<a href="#" id="editorCommentsTab">Editor Comments</a>
<a href="#" id="privateCommentsTab">Private Comments</a>
<a href="#" id="commentsTab"<?php if ($this->selectedCommentTab == 'commentsTab') { ?> class="selected"<?php } ?>>Comments</a>
<a href="#" id="editorCommentsTab"<?php if ($this->selectedCommentTab == 'editorCommentsTab') { ?> class="selected"<?php } ?>>Editor Comments</a>
<a href="#" id="privateCommentsTab"<?php if ($this->selectedCommentTab == 'privateCommentsTab') { ?> class="selected"<?php } ?>>Private Comments</a>
</div>
<div class="tabContent" id="commentsContent">
<div class="tabContent<?php if ($this->selectedCommentTab == 'commentsTab') { ?> selected<?php } ?>" id="commentsContent">
<table class="comments">
<tr>
<th class="who">Who</th>
......@@ -155,7 +161,7 @@
</div>
<div class="tabContent" id="editorCommentsContent">
<div class="tabContent<?php if ($this->selectedCommentTab == 'editorCommentsTab') { ?> selected<?php } ?>" id="editorCommentsContent">
<table class="comments">
<tr>
<th class="who">Who</th>
......@@ -182,7 +188,7 @@
</div>
<div class="tabContent" id="privateCommentsContent">
<div class="tabContent<?php if ($this->selectedCommentTab == 'privateCommentsTab') { ?> selected<?php } ?>" id="privateCommentsContent">
<table class="comments">
<tr>
<th class="who">Who</th>
......
......@@ -82,6 +82,7 @@ div#comments {
}
.tabContent {
display: none;
clear: both;
padding: 5px;
background-color: #ddd;
......@@ -93,6 +94,10 @@ div#comments {
}
}
.tabContent.selected {
display: block
}
table.comments {
width: 100%;
......@@ -122,11 +127,6 @@ div#comments {
}
}
#editorCommentsContent,
#privateCommentsContent {
display: none;
}
}
#prevRequestLink {
......
......@@ -30,6 +30,8 @@ function viewRequestSelectTab()
privateCommentsTab.className = '';
this.className = 'selected';
var ajax = new AjaxClient();
ajax.sendRequest('/Request/SetCommentTab/' + this.id);
if (this.id == 'commentsTab') {
commentsContent.style.display = 'block';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment