<commit_before>{**
 * This file is part of the Nextras community extensions of Nette Framework
 *
 * @license    MIT
 * @link       https://github.com/nextras
 *}
<div class="grid" data-grid-name="{$control->getUniqueId()}">
{snippet rows}

{var $_templates = []}
{foreach $cellsTemplates as $cellsTemplate}
	{php
		$_template = $this->createTemplate($cellsTemplate, $this->params, "import");
		$_template->render();
		$_templates[] = $_template;
	}
{/foreach}

{form form class => 'ajax'}

{php
	$hasActionsColumn =
		(bool) $control->getEditFormFactory() /* we may render only one row so the form[filter] may not be created */
		|| isset($this->blockQueue["row-actions"]);
	$hasGlobalActionsColumn = isset($form['actions']);

	foreach ($_templates as $_template):
		$_template->params['hasActionsColumn'] = $hasActionsColumn;
		$_template->params['hasGlobalActionsColumn'] = $hasGlobalActionsColumn;
	endforeach;
	$this->params['hasActionsColumn'] = $hasActionsColumn;
	$this->params['hasGlobalActionsColumn'] = $hasGlobalActionsColumn;
}

{include #table-open-tag}
	<thead>
		{include #row-head-columns}
		{ifset $form['filter']}
			{include #row-head-filter}
		{/ifset}
	</thead>
	<tbody>
		{if count($data)}
			{foreach $data as $row}
				{var $primary = $control->getter($row, $rowPrimaryKey)}
				{var $rowId = $this->global->snippetDriver->getHtmlId("rows-$primary")}
				{include #row row => $row, rowId => $rowId}
			{/foreach}
		{else}
			{ifset #empty-result}{include #empty-result}{/ifset}
		{/if}
	</tbody>
	<tfoot n:ifset="$paginator">
		<tr>
			<th colspan="{=count($columns) + $hasGlobalActionsColumn + $hasActionsColumn}">
				{include #global-actions}
				{include #pagination}
			</th>
		</tr>
	</tfoot>
{include #table-close-tag}

{/form}

{/snippet}
</div>
<commit_msg>Show global actions only if present<commit_after>{**
 * This file is part of the Nextras community extensions of Nette Framework
 *
 * @license    MIT
 * @link       https://github.com/nextras
 *}
<div class="grid" data-grid-name="{$control->getUniqueId()}">
{snippet rows}

{var $_templates = []}
{foreach $cellsTemplates as $cellsTemplate}
	{php
		$_template = $this->createTemplate($cellsTemplate, $this->params, "import");
		$_template->render();
		$_templates[] = $_template;
	}
{/foreach}

{form form class => 'ajax'}

{php
	$hasActionsColumn =
		(bool) $control->getEditFormFactory() /* we may render only one row so the form[filter] may not be created */
		|| isset($this->blockQueue["row-actions"]);
	$hasGlobalActionsColumn = isset($form['actions']);

	foreach ($_templates as $_template):
		$_template->params['hasActionsColumn'] = $hasActionsColumn;
		$_template->params['hasGlobalActionsColumn'] = $hasGlobalActionsColumn;
	endforeach;
	$this->params['hasActionsColumn'] = $hasActionsColumn;
	$this->params['hasGlobalActionsColumn'] = $hasGlobalActionsColumn;
}

{include #table-open-tag}
	<thead>
		{include #row-head-columns}
		{ifset $form['filter']}
			{include #row-head-filter}
		{/ifset}
	</thead>
	<tbody>
		{if count($data)}
			{foreach $data as $row}
				{var $primary = $control->getter($row, $rowPrimaryKey)}
				{var $rowId = $this->global->snippetDriver->getHtmlId("rows-$primary")}
				{include #row row => $row, rowId => $rowId}
			{/foreach}
		{else}
			{ifset #empty-result}{include #empty-result}{/ifset}
		{/if}
	</tbody>
	<tfoot n:ifset="$paginator">
		<tr>
			<th colspan="{=count($columns) + $hasGlobalActionsColumn + $hasActionsColumn}">
				{if $hasGlobalActionsColumn}
					{include #global-actions}
				{/if}
				{include #pagination}
			</th>
		</tr>
	</tfoot>
{include #table-close-tag}

{/form}

{/snippet}
</div>

{'fraction_non_alphanumeric': 0.18201754385964913, 'fraction_numerical': 0.0, 'mean_word_length': 4.728414442700157, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 61, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3469035', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1247, 'n_words': 270}