Adds compact column, explicit option for deferred binding in relation controller, fix to list head width

This commit is contained in:
Samuel Georges 2015-02-27 21:54:58 +11:00
parent 7032e43b92
commit 5c78140268
4 changed files with 21 additions and 5 deletions

View File

@ -2558,6 +2558,7 @@ table.table.data tbody tr.safe td,table.table.data tbody tr.special td,table.tab
table.table.data tbody td.column-break-word{word-wrap:break-word;word-break:break-all} table.table.data tbody td.column-break-word{word-wrap:break-word;word-break:break-all}
table.table.data tbody td.column-single-line{overflow:hidden;text-overflow:ellipsis;white-space:nowrap} table.table.data tbody td.column-single-line{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
table.table.data tbody td.column-slim{padding-left:0;padding-right:0} table.table.data tbody td.column-slim{padding-left:0;padding-right:0}
table.table.data tbody td.column-compact{padding:0}
table.table.data tfoot a{color:#666666;text-decoration:none} table.table.data tfoot a{color:#666666;text-decoration:none}
table.table.data tfoot td,table.table.data tfoot th{border-color:#e2e2e2;padding:10px 15px} table.table.data tfoot td,table.table.data tfoot th{border-color:#e2e2e2;padding:10px 15px}
table.table.data .list-checkbox{padding-left:16px;padding-right:8px;width:52px;vertical-align:top;border-right:1px solid #eeeeee} table.table.data .list-checkbox{padding-left:16px;padding-right:8px;width:52px;vertical-align:top;border-right:1px solid #eeeeee}

View File

@ -242,6 +242,10 @@ table.table.data {
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
} }
td.column-compact {
padding: 0;
}
} }
tfoot { tfoot {

View File

@ -147,6 +147,11 @@ class RelationController extends ControllerBehavior
*/ */
public $readOnly = false; public $readOnly = false;
/**
* @var bool Defers all binding actions using a session key when it is available.
*/
public $deferredBinding = false;
/** /**
* Behavior constructor * Behavior constructor
* @param Backend\Classes\Controller $controller * @param Backend\Classes\Controller $controller
@ -215,6 +220,7 @@ class RelationController extends ControllerBehavior
$this->relationModel = $this->relationObject->getRelated(); $this->relationModel = $this->relationObject->getRelated();
$this->readOnly = $this->getConfig('readOnly'); $this->readOnly = $this->getConfig('readOnly');
$this->deferredBinding = $this->getConfig('deferredBinding');
$this->toolbarButtons = $this->evalToolbarButtons(); $this->toolbarButtons = $this->evalToolbarButtons();
$this->viewMode = $this->viewMode ?: $this->evalViewMode(); $this->viewMode = $this->viewMode ?: $this->evalViewMode();
$this->manageMode = $this->manageMode ?: $this->evalManageMode(); $this->manageMode = $this->manageMode ?: $this->evalManageMode();
@ -705,12 +711,14 @@ class RelationController extends ControllerBehavior
$models = $this->relationModel->whereIn($foreignKeyName, $checkedIds)->get(); $models = $this->relationModel->whereIn($foreignKeyName, $checkedIds)->get();
foreach ($models as $model) { foreach ($models as $model) {
if ($this->model->exists) { $useDefer = $this->deferredBinding || !$this->model->exists;
$this->relationObject->add($model); if ($useDefer) {
}
else {
$this->relationObject->add($model, $this->relationGetSessionKey()); $this->relationObject->add($model, $this->relationGetSessionKey());
} }
else {
$this->relationObject->add($model);
}
} }
} }

View File

@ -29,7 +29,10 @@
</a> </a>
</th> </th>
<?php else: ?> <?php else: ?>
<th class="list-cell-name-<?= $column->columnName ?>"> <th
<?php if ($column->width): ?>style="width: <?= $column->width ?>"<?php endif ?>
class="list-cell-name-<?= $column->columnName ?>"
>
<span><?= $this->getHeaderValue($column) ?></span> <span><?= $this->getHeaderValue($column) ?></span>
</th> </th>
<?php endif ?> <?php endif ?>