* Adjust to get recent executions.

This commit is contained in:
leiyong
2020-12-28 15:27:36 +08:00
parent b8598ce6ce
commit 49134bc66b
5 changed files with 39 additions and 56 deletions
+1 -22
View File
@@ -599,28 +599,7 @@ class commonModel extends model
{
global $dbh, $lang, $app;
echo "<li class='divider'></li>";
echo '<li><span id="mainRecent"><i class="icon icon-recent"></i> ' . $lang->recent . '</span></li>';
$extraWhere = empty($app->user->admin) ? ' and id in (' . $app->user->view->sprints . ') and project in (' . $app->user->view->projects . ') ' : '';
if(empty($app->user->admin) && (empty($app->user->view->sprints) || empty($app->user->view->projects)))
{
echo "</ul>\n";
return false;
}
$executions = $dbh->query('select id,name,code,project from ' . TABLE_PROJECT . " where type in ('stage','sprint') $extraWhere and status != 'closed' and deleted = '0' order by id desc limit 6")->fetchAll();
if(!empty($executions))
{
foreach($executions as $index => $execution)
{
if($index == 5) break;
$execution->code = empty($execution->code) ? $execution->name : $execution->code;
echo '<li>' . html::a(helper::createLink('project', 'task', 'projectID=' . $execution->id, '', false, $execution->project), $execution->code, '', "style='padding: 2px 8px 2px 8px;' class='main-recent-text' title='$execution->name'") . '</li>';
}
if(count($executions) > 5) echo '<li onclick="getExecutions();" id="loadMore" class="text-center"><span>' . $lang->more . '</span></li>';
}
echo '<li><span id="mainRecent" onclick="getExecutions();"><i class="icon icon-recent"></i> ' . $lang->recent . '</span></li>';
}
/**
-32
View File
@@ -49,38 +49,6 @@ include 'chosen.html.php';
<?php endif;?>
<script>
$("#menuToggle").bind('click', function()
{
$("#moreExecution").hide();
});
$("#executionList").mouseover(function()
{
$("#moreExecution").show();
});
$("#executionList").mouseout(function()
{
$("#moreExecution").hide();
});
function getExecutions()
{
$("#moreExecution").toggle();
if(!$("#moreExecution").is(':hidden'))
{
$.ajax(
{
url: createLink('project', 'ajaxGetRecentExecutions'),
dataType: 'html',
type: 'post',
success: function(data)
{
$("#executionList").html(data);
}
})
}
}
adjustMenuWidth();
</script>
<main id='main' <?php if(!empty($config->sso->redirect)) echo "class='ranzhiFixedTfootAction'";?> >
+37
View File
@@ -315,3 +315,40 @@
else openTab(defaultTabGroup);
});
}());
/* Click to show more. */
$("#menuToggle").bind('click', function()
{
$("#moreExecution").hide();
});
/* Mouse in to show more. */
$("#executionList").mouseover(function()
{
$("#moreExecution").show();
});
/* Mouse out hide more. */
$("#executionList").mouseout(function()
{
$("#moreExecution").hide();
});
/* Get recent executions. */
function getExecutions()
{
$("#moreExecution").toggle();
if(!$("#moreExecution").is(':hidden'))
{
$.ajax(
{
url: createLink('project', 'ajaxGetRecentExecutions'),
dataType: 'html',
type: 'post',
success: function(data)
{
$("#executionList").html(data);
}
})
}
}
+1 -1
View File
@@ -3574,7 +3574,7 @@ class projectModel extends model
->andWhere('status')->ne('closed')
->andWhere('deleted')->eq('0')
->orderBy('id_desc')
->limit('5,' . $this->config->project->recentQuantity)
->limit($this->config->project->recentQuantity)
->fetchAll();
}
}
-1
View File
@@ -51,7 +51,6 @@ a.showMoreImage:hover {opacity: 1;}
#mainMenu .pull-right > .btn-group > .btn-icon:hover {background: #fff;}
#mainRecent {padding: 8px; line-height: 20px; cursor: pointer; color: #fff; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; -khtml-user-select: none; user-select:none;}
#loadMore {cursor:pointer;}
#moreExecution {display:none; max-height: 420px; position: fixed; bottom: 0; left: 100px; z-index: 999; background: white; padding: 20px 10px; height: 420px; margin-bottom: 40px; border: 1px solid #efefef}
#moreExecution > .list-group {height: 380px; min-width: 150px; max-width:200px;}
.main-recent-text{overflow: hidden; white-space: nowrap;}