* Set batch edit checkbox style to cookie.

This commit is contained in:
曹延义
2022-09-28 08:58:30 +08:00
parent 6cb187bec1
commit d16362e3da
8 changed files with 32 additions and 49 deletions
+3
View File
@@ -97,6 +97,7 @@ $filter->mail->batchdelete = new stdclass();
$filter->misc->checkupdate = new stdclass();
$filter->file->download = new stdclass();
$filter->product->browse = new stdclass();
$filter->product->all = new stdclass();
$filter->product->default = new stdclass();
$filter->product->index = new stdclass();
$filter->product->export = new stdclass();
@@ -236,6 +237,7 @@ $filter->product->browse->cookie['productStoryOrder'] = 'reg::orderBy';
$filter->product->browse->cookie['storyModule'] = 'int';
$filter->product->browse->cookie['storyBranch'] = 'int';
$filter->product->browse->cookie['treeBranch'] = 'reg::word';
$filter->product->all->cookie['showProductBatchEdit'] = 'int';
$filter->product->default->cookie['lastProduct'] = 'int';
$filter->product->default->cookie['preProductID'] = 'int';
$filter->product->index->cookie['preBranch'] = 'reg::word';
@@ -260,6 +262,7 @@ $filter->project->default->cookie['lastPRJ'] = 'int';
$filter->project->default->cookie['projectMode'] = 'code';
$filter->project->default->cookie['kanbanview'] = 'code';
$filter->project->browse->cookie['involved'] = 'code';
$filter->project->browse->cookie['showProjectBatchEdit'] = 'int';
$filter->project->export->cookie['involved'] = 'code';
$filter->project->browse->cookie['projectType'] = 'code';
$filter->project->story->cookie['storyModuleParam'] = 'int';
+1
View File
@@ -1289,6 +1289,7 @@ class product extends control
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->pager = $pager;
$this->view->showBatchEdit = $this->cookie->showProductBatchEdit;
$this->display();
}
-2
View File
@@ -38,7 +38,6 @@
#sidebar>.cell {width: 100%;}
th.c-name {width: 400px;}
th.c-requirement {width: 290px;}
th.c-story {width: 290px;}
th.c-bug {width: 150px;}
th.c-plan {width: 45px;}
@@ -46,7 +45,6 @@ th.c-release {width: 50px;}
th.c-actions {width: 50px;}
[lang='en'] .en-wrap-text {white-space: normal; height: 24px; line-height: 1; font-size: 12px;}
#productListForm thead>tr>th,
#productListForm tbody>tr>td {text-align: center; text-overflow: unset!important}
#productListForm thead>tr>th {padding: 0; line-height: 24px;}
+14 -8
View File
@@ -6,15 +6,10 @@ $(function()
$('input[name^="showEdit"]').click(function()
{
$('#productListForm .c-checkbox, #productListForm .check-all').hide();
$('.c-name').css('border-left', 'none');
var showEdit = $(this).is(':checked') ? 1 : 0;
if(showEdit)
{
$('#productListForm .c-checkbox, #productListForm .check-all').show();
$('.c-name').css('border-left', '1px solid #ddd');
}
$.cookie('showProductBatchEdit', $(this).is(':checked') ? 1 : 0, {expires: config.cookieLife, path: config.webRoot});
setCheckbox();
});
setCheckbox();
/* Init table sort. */
$('#productTableList').addClass('sortable').sortable(
@@ -51,6 +46,17 @@ $(function()
}
});
function setCheckbox()
{
$('#productListForm .c-checkbox, #productListForm .check-all').hide();
$('.c-name').css('border-left', 'none');
if($.cookie('showProductBatchEdit') == 1)
{
$('#productListForm .c-checkbox, #productListForm .check-all').show();
$('.c-name').css('border-left', '1px solid #ddd');
}
}
/* Update parent checkbox */
function updatePrarentCheckbox($parent)
{
+1 -32
View File
@@ -20,7 +20,7 @@
<?php $recTotalLabel = $browseType == $key ? " <span class='label label-light label-badge'>{$recTotal}</span>" : '';?>
<?php echo html::a(inlink("all", "browseType=$key&orderBy=$orderBy"), "<span class='text'>{$label}</span>" . $recTotalLabel, '', "class='btn btn-link' id='{$key}Tab'");?>
<?php endforeach;?>
<?php if($canBatchEdit) echo html::checkbox('showEdit', array('1' => $lang->product->edit));?>
<?php if($canBatchEdit) echo html::checkbox('showEdit', array('1' => $lang->product->edit), $showBatchEdit);?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->product->searchStory;?></a>
</div>
<div class="btn-toolbar pull-right">
@@ -52,9 +52,6 @@
<a class='table-nest-toggle table-nest-toggle-global' data-expand-text='<?php echo $lang->expand; ?>' data-collapse-text='<?php echo $lang->collapse; ?>'></a>
<?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?>
</th>
<?php if($this->config->URAndSR):?>
<th class='c-requirement' colspan="5"><?php echo $lang->story->requirement;?></th>
<?php endif;?>
<th class="c-story" colspan="5"><?php echo $lang->story->story;?></th>
<th class="c-bug" colspan="2"><?php echo $lang->bug->common;?></th>
<th class="c-plan" rowspan="2"><?php echo $lang->product->plan;?></th>
@@ -66,13 +63,6 @@
<th class='c-actions' rowspan="2"><?php echo $lang->actions;?></th>
</tr>
<tr class="text-center">
<?php if($this->config->URAndSR):?>
<th style="border-left: 1px solid #ddd;"><?php echo $lang->story->draft;?></th>
<th><?php echo $lang->story->activate;?></th>
<th><?php echo $lang->story->change;?></th>
<th><?php echo $lang->story->statusList['reviewing'];?></th>
<th><div class='en-wrap-text'><?php echo $lang->story->completeRate;?></div></th>
<?php endif;?>
<th style="border-left: 1px solid #ddd;"><?php echo $lang->story->draft;?></th>
<th><?php echo $lang->story->activate;?></th>
<th><?php echo $lang->story->change;?></th>
@@ -113,13 +103,6 @@
<span class="table-nest-icon icon table-nest-toggle"></span>
<?php echo $program['programName']?>
</td>
<?php if($this->config->URAndSR):?>
<td><?php echo $program['draftRequirements'];?></td>
<td><?php echo $program['activeRequirements'];?></td>
<td><?php echo $program['changingRequirements'];?></td>
<td><?php echo $program['reviewingRequirements'];?></td>
<td><?php echo $program['totalRequirements'] == 0 ? 0 : round($program['closedRequirements'] / $program['totalRequirements'], 3) * 100;?>%</td>
<?php endif;?>
<td><?php echo $program['draftStories'];?></td>
<td><?php echo $program['activeStories'];?></td>
<td><?php echo $program['changingStories'];?></td>
@@ -159,13 +142,6 @@
<span class="table-nest-icon icon table-nest-toggle"></span>
<?php echo $line['lineName']?>
</td>
<?php if($this->config->URAndSR):?>
<td><?php echo isset($line['draftRequirements']) ? $line['draftRequirements'] : 0;?></td>
<td><?php echo isset($line['activeRequirements']) ? $line['activeRequirements'] : 0;?></td>
<td><?php echo isset($line['changingRequirements']) ? $line['changingRequirements'] : 0;?></td>
<td><?php echo isset($line['reviewingRequirements']) ? $line['reviewingRequirements'] : 0;?></td>
<td><?php echo (isset($line['totalRequirements']) and $line['totalRequirements'] != 0) ? round($line['closedRequirements'] / $line['totalRequirements'], 3) * 100 : 0;?>%</td>
<?php endif;?>
<td><?php echo isset($line['draftStories']) ? $line['draftStories'] : 0;?></td>
<td><?php echo isset($line['activeStories']) ? $line['activeStories'] : 0;?></td>
<td><?php echo isset($line['changingStories']) ? $line['changingStories'] : 0;?></td>
@@ -219,13 +195,6 @@
echo "<span class='table-nest-icon icon icon-product'></span>" . $productLink;
?>
</td>
<?php if($this->config->URAndSR):?>
<td><?php echo $product->requirements['draft'];?></td>
<td><?php echo $product->requirements['active'];?></td>
<td><?php echo $product->requirements['changing'];?></td>
<td><?php echo $product->requirements['reviewing'];?></td>
<td><?php echo $totalRequirements == 0 ? 0 : round($product->requirements['closed'] / $totalRequirements, 3) * 100;?>%</td>
<?php endif;?>
<td><?php echo $product->stories['draft'];?></td>
<td><?php echo $product->stories['active'];?></td>
<td><?php echo $product->stories['changing'];?></td>
+1
View File
@@ -378,6 +378,7 @@ class project extends control
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->showBatchEdit = $this->cookie->showProjectBatchEdit;
$this->view->allProjectsNum = $this->loadModel('program')->getProjectStats($programID, 'all');
$this->display();
+11 -6
View File
@@ -1,30 +1,35 @@
$(function()
{
$('#projectForm .checkbox-primary').hide();
$('input[name^="involved"]').click(function()
{
var involved = $(this).is(':checked') ? 1 : 0;
$.cookie('involved', involved, {expires:config.cookieLife, path:config.webRoot});
$.cookie('involved', involved, {expires: config.cookieLife, path: config.webRoot});
window.location.reload();
});
$('[id="switchButton"]').click(function()
{
var projectType = $(this).attr('data-type');
$.cookie('projectType', projectType, {expires:config.cookieLife, path:config.webRoot});
$.cookie('projectType', projectType, {expires: config.cookieLife, path: config.webRoot});
window.location.reload();
});
$('input[name^="showEdit"]').click(function()
{
$('#projectForm .checkbox-primary').hide();
var showEdit = $(this).is(':checked') ? 1 : 0;
if(showEdit) $('#projectForm .checkbox-primary').show();
$.cookie('showProjectBatchEdit', $(this).is(':checked') ? 1 : 0, {expires: config.cookieLife, path: config.webRoot});
setCheckbox();
});
setCheckbox();
if(!useDatatable) resetNameWidth();
});
function setCheckbox()
{
$('#projectForm .checkbox-primary').hide();
if($.cookie('showProjectBatchEdit') == 1) $('#projectForm .checkbox-primary').show();
}
function resetNameWidth()
{
$name = $('#projectForm thead th.c-name');
+1 -1
View File
@@ -41,7 +41,7 @@
<?php if($browseType == $key) $label .= " <span class='label label-light label-badge'>{$pager->recTotal}</span>";?>
<?php echo html::a(inlink('browse', "programID=$programID&browseType=$key"), $label, '', "class='btn btn-link $active'");?>
<?php endforeach;?>
<?php if($canBatchEdit) echo html::checkbox('showEdit', array('1' => $lang->project->edit));?>
<?php if($canBatchEdit) echo html::checkbox('showEdit', array('1' => $lang->project->edit), $showBatchEdit);?>
<?php if($browseType != 'bysearch') echo html::checkbox('involved', array('1' => $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->search->common;?></a>
</div>