* Modify batch edit style for product list page.
This commit is contained in:
@@ -109,6 +109,7 @@ $filter->program->default = new stdclass();
|
||||
$filter->program->pgmproject = new stdclass();
|
||||
$filter->program->prjbrowse = new stdclass();
|
||||
$filter->program->project = new stdclass();
|
||||
$filter->program->product = new stdclass();
|
||||
$filter->program->browse = new stdclass();
|
||||
$filter->program->export = new stdclass();
|
||||
$filter->program->pgmbrowse = new stdclass();
|
||||
@@ -254,6 +255,7 @@ $filter->program->default->cookie['lastPRJ'] = 'int';
|
||||
$filter->program->prjbrowse->cookie['programType'] = 'code';
|
||||
$filter->program->project->cookie['involved'] = 'code';
|
||||
$filter->program->project->cookie['showProjectBatchEdit'] = 'int';
|
||||
$filter->program->product->cookie['showProductBatchEdit'] = 'int';
|
||||
$filter->program->browse->cookie['showClosed'] = 'code';
|
||||
$filter->program->export->cookie['checkedItem'] = 'reg::checked';
|
||||
$filter->program->ajaxgetdropmenu->cookie['showClosed'] = 'code';
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
$("#" + browseType + "Tab").addClass('btn-active-text');
|
||||
$(function()
|
||||
{
|
||||
$('#productListForm .c-checkbox, #productListForm .check-all').hide();
|
||||
$('.c-name').css('border-left', 'none');
|
||||
|
||||
$('input[name^="showEdit"]').click(function()
|
||||
{
|
||||
$.cookie('showProductBatchEdit', $(this).is(':checked') ? 1 : 0, {expires: config.cookieLife, path: config.webRoot});
|
||||
@@ -46,6 +43,12 @@ $(function()
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Set batch edit checkbox.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setCheckbox()
|
||||
{
|
||||
$('#productListForm .c-checkbox, #productListForm .check-all').hide();
|
||||
|
||||
@@ -163,14 +163,15 @@ class program extends control
|
||||
$this->view->program = $program;
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->program->product;
|
||||
$this->view->position[] = $this->lang->program->product;
|
||||
$this->view->programID = $programID;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->products = $this->loadModel('product')->getStats($orderBy, $pager, $browseType, '', 'story', $programID);
|
||||
$this->view->title = $this->lang->program->product;
|
||||
$this->view->position[] = $this->lang->program->product;
|
||||
$this->view->programID = $programID;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->products = $this->loadModel('product')->getStats($orderBy, $pager, $browseType, '', 'story', $programID);
|
||||
$this->view->showBatchEdit = $this->cookie->showProductBatchEdit;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
tbody.sortable > tr > td > span.sort-handler {color: #999;}
|
||||
.icon-move {color: #16a8f8;}
|
||||
.table.has-sort-head thead>tr>th>a:after, .table.has-sort-head thead>tr>th>a:before {top: -4px;}
|
||||
.statistic {margin-left: 10px; color: #838a9d; float: left; position: relative; line-height: 28px;}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
$(function()
|
||||
{
|
||||
$('input[name^="showEdit"]').click(function()
|
||||
{
|
||||
$.cookie('showProductBatchEdit', $(this).is(':checked') ? 1 : 0, {expires: config.cookieLife, path: config.webRoot});
|
||||
setCheckbox();
|
||||
});
|
||||
setCheckbox();
|
||||
|
||||
$(":checkbox[name^='productIDList']").on('click', function()
|
||||
{
|
||||
updateStatistic()
|
||||
});
|
||||
|
||||
$(".check-all").on('click', function()
|
||||
{
|
||||
if($(":checkbox[name^='productIDList']:not(:checked)").length == 0)
|
||||
{
|
||||
$(":checkbox[name^='productIDList']").prop('checked', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(":checkbox[name^='productIDList']").prop('checked', true);
|
||||
}
|
||||
updateStatistic()
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Set batch edit checkbox.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setCheckbox()
|
||||
{
|
||||
$('#productListForm .checkbox-primary, #productListForm .check-all').hide();
|
||||
$('#productListForm .product-id').addClass('hidden');
|
||||
if($.cookie('showProductBatchEdit') == 1)
|
||||
{
|
||||
$('#productListForm .checkbox-primary, #productListForm .check-all').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#productListForm .product-id').removeClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a statistics prompt statement after the Edit button.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function addStatistic()
|
||||
{
|
||||
var checkedLength = $(":checkbox[name^='productIDList']:checked").length;
|
||||
if(checkedLength > 0)
|
||||
{
|
||||
var summary = checkedProducts.replace('%s', checkedLength);
|
||||
if(cilentLang == "en" && checkedLength < 2) summary = summary.replace('products', 'product');
|
||||
|
||||
var statistic = "<div id='productsSummary' class='statistic'>" + summary + "</div>";
|
||||
$('#productsCount').hide();
|
||||
$('#productsSummary').remove();
|
||||
$('#editBtn').after(statistic);
|
||||
$('.table-actions').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.table-actions').hide();
|
||||
$('#productsCount').show();
|
||||
$('#productsSummary').addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Anti shake operation for jquery.
|
||||
*
|
||||
* @param fn $fn
|
||||
* @param delay $delay
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function debounce(fn, delay)
|
||||
{
|
||||
var timer = null;
|
||||
return function()
|
||||
{
|
||||
if(timer) clearTimeout(timer);
|
||||
timer = setTimeout(fn, delay)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update statistics.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function updateStatistic()
|
||||
{
|
||||
debounce(addStatistic(), 200)
|
||||
}
|
||||
@@ -11,14 +11,18 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/sortable.html.php';?>
|
||||
<?php js::set('checkedProducts', $lang->product->checkedProducts);?>
|
||||
<?php js::set('cilentLang', $this->app->getClientLang());?>
|
||||
<?php $canBatchEdit = common::hasPriv('product', 'batchEdit');?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<?php if(!isonlybody()):?>
|
||||
<div class="btn-toolbar pull-left">
|
||||
<div class="btn-toolBar pull-left">
|
||||
<?php foreach($lang->product->featureBar['all'] as $key => $label):?>
|
||||
<?php $active = $key == $browseType ? 'btn-active-text' : '';?>
|
||||
<?php if($key == $browseType) $label .= " <span class='label label-light label-badge'>{$pager->recTotal}</span>";?>
|
||||
<?php echo html::a(inlink("product", "programID=$programID&browseType=$key&orderBy=$orderBy"), "<span class='text'>{$label}</span>", '', "class='btn btn-link $active'");?>
|
||||
<?php endforeach;?>
|
||||
<?php if($canBatchEdit) echo html::checkbox('showEdit', array('1' => $lang->product->edit), $showBatchEdit);?>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php common::printLink('product', 'create', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->product->create, '', 'class="btn btn-primary"');?>
|
||||
@@ -34,7 +38,6 @@
|
||||
<div class="main-col">
|
||||
<form class="main-table table-product" data-ride="table" id="productListForm" method="post" action='<?php echo $this->createLink('product', 'batchEdit', "programID=$programID");?>'>
|
||||
<?php $canOrder = common::hasPriv('product', 'updateOrder');?>
|
||||
<?php $canBatchEdit = common::hasPriv('product', 'batchEdit');?>
|
||||
<table id="productList" class="table has-sort-head table-bordered table-fixed">
|
||||
<?php $vars = "programID=$programID&browseType=$browseType&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
|
||||
<thead>
|
||||
@@ -72,10 +75,9 @@
|
||||
<tr class="text-center" data-id='<?php echo $product->id ?>' data-order='<?php echo $product->code;?>'>
|
||||
<td class='c-id text-left'>
|
||||
<?php if($canBatchEdit):?>
|
||||
<?php echo html::checkbox('productIDList', array($product->id => sprintf('%03d', $product->id)));?>
|
||||
<?php else:?>
|
||||
<?php printf('%03d', $product->id);?>
|
||||
<?php echo html::checkbox('productIDList', array($product->id => sprintf('%03d', $product->id)), '', 'class="id-checkbox ' . (!$showBatchEdit ? 'hidden"' : '"'));?>
|
||||
<?php endif;?>
|
||||
<span class="product-id <?php if($canBatchEdit && $showBatchEdit) echo 'hidden';?>"><?php printf('%03d', $product->id);?></span>
|
||||
</td>
|
||||
<td class="c-name" title='<?php echo $product->name?>'><?php echo html::a($this->createLink('product', 'browse', 'product=' . $product->id), $product->name);?></td>
|
||||
<td><?php echo $product->stories['draft'];?></td>
|
||||
@@ -101,8 +103,15 @@
|
||||
<?php if($canBatchEdit):?>
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
<?php echo html::submitButton($lang->edit, '', 'btn');?>
|
||||
<?php
|
||||
$actionLink = $this->createLink('product', 'batchEdit');
|
||||
echo html::commonButton($lang->edit, "id='editBtn' data-form-action='$actionLink'");
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$summary = sprintf($lang->product->pageSummary, count($products));
|
||||
echo "<div id='productsCount' class='statistic'>$summary</div>";
|
||||
?>
|
||||
<?php endif;?>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user