<commit_before><?php
/**
 * example:  AmiGridView::view('column.editableClick', [
 * *              'name'   => 'status',
 * *              'value'  => $data->status,
 * *              'title'  => 'title',
 * *              'type'   => 'select',
 * *              'url'    => route('....'),
 * *              'source' => [0 => 'item1', 1 => 'item2', ...],
 * *         ])->render();
 * result: "productOne - variantThree"
 *
 * @var string           $initJsClass   Init js class
 * @var string           $class
 * @var string           $text
 * @var string|array|int $value
 * @var string           $url
 * @var string           $type          Type: text|textarea|select|checklist
 * @var int              $pk
 * @var array            $source        Source data for list.
 * @var string           $sourceCache   If true and source is string url - results will be cached for fields with the same source. Usefull for editable column
 *                            in grid to prevent extra requests.
 * @var string           $emptyText
 * @var string           $originalTitle Original title
 * @var string           $title
 * @var int              $rows
 * @var callable         $callback      function
 */
$id = isset($id) ? $id : null;
$initJsEvent = isset($initJsEvent) ? $initJsEvent : 'ready change';
$initJsClass = isset($initJsClass) ? $initJsClass : 'js-editableClick';
$class = isset($class) ? $class : 'inline-editable editable editable-click editable-empty';
$name = isset($name) ? $name : 'name';
$value = isset($value) ? $value : null;
$url = isset($url) ? $url : 'title';
$type = isset($type) ? $type : 'text';
$pk = isset($pk) ? $pk : '1';
$escape = isset($escape) ? $escape : true;
$emptyText = isset($emptyText) ? $emptyText : 'Empty';
$originalTitle = isset($originalTitle) ? $originalTitle : null;
$title = isset($title) ? $title : '';
$rows = isset($rows) ? $rows : 10;
$callback = isset($callback) ? $callback : null;
$sourceResult = null;
if(isset($source)) {
    if(is_array($source)) {
        $array = [];
        foreach($source as $sourceValue => $sourceText) {
            $array[] = [
                    'value' => $sourceValue,
                    'text'  => $sourceText,
            ];
        }
        $sourceResult = json_encode($array);
    } elseif(is_string($source)) {
        $sourceResult = $source;
    }
}
if(is_array($value)) {
    $value = json_encode($value);
}
?>
<a href='#'
   id='<?= $id; ?>'
   class='<?= $initJsClass; ?> <?= $class; ?>'
   data-escape='<?= $escape; ?>'
   data-name='<?= $name; ?>'
   data-value='<?= $value; ?>'
   data-url='<?= $url; ?>'
   data-type='<?= $type; ?>'
   data-pk='<?= $pk; ?>'
   data-emptytext='<?= $emptyText; ?>'
   <?php if($sourceResult) { ?>
   data-source='<?= $sourceResult; ?>'
   <?php } ?>
   <?php if($originalTitle) { ?>
   data-original-title='<?= $originalTitle; ?>'
   <?php } ?>
   <?php if($title) { ?>
   title='<?= $title; ?>'
   <?php } ?>
   <?php if($rows) { ?>
   data-rows='<?= $rows; ?>'
   <?php } ?>
        <?php if($callback) {
    echo (string)$callback;
} ?>
>
    <?= $title; ?>
</a>
{{--
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/><commit_msg>changed view for editable<commit_after><?php
/**
 * example:  AmiGridView::view('column.editableClick', [
 * *              'name'   => 'status',
 * *              'value'  => $data->status,
 * *              'title'  => 'title',
 * *              'type'   => 'select',
 * *              'url'    => route('....'),
 * *              'source' => [0 => 'item1', 1 => 'item2', ...],
 * *         ])->render();
 * result: "productOne - variantThree"
 *
 * @var string           $initJsClass   Init js class
 * @var string           $class
 * @var string           $text
 * @var string|array|int $value
 * @var string           $url
 * @var string           $type          Type: text|textarea|select|checklist
 * @var int              $pk
 * @var array            $source        Source data for list.
 * @var string           $sourceCache   If true and source is string url - results will be cached for fields with the same source. Usefull for editable column
 *                            in grid to prevent extra requests.
 * @var string           $emptyText
 * @var string           $originalTitle Original title
 * @var string           $title
 * @var int              $rows
 * @var callable         $callback      function
 */
$id = isset($id) ? $id : null;
$initJsEvent = isset($initJsEvent) ? $initJsEvent : 'ready change';
$initJsClass = isset($initJsClass) ? $initJsClass : 'js-editableClick';
$class = isset($class) ? $class : 'inline-editable editable editable-click editable-empty';
$name = isset($name) ? $name : 'name';
$value = isset($value) ? $value : null;
$url = isset($url) ? $url : 'title';
$type = isset($type) ? $type : 'text';
$pk = isset($pk) ? $pk : '1';
$escape = isset($escape) ? $escape : true;
$emptyText = isset($emptyText) ? $emptyText : 'Empty';
$originalTitle = isset($originalTitle) ? $originalTitle : null;
$title = isset($title) ? $title : '';
$rows = isset($rows) ? $rows : 10;
$callback = isset($callback) ? $callback : null;
$sourceResult = null;
if(isset($source)) {
    if(is_array($source)) {
        $array = [];
        foreach($source as $sourceValue => $sourceText) {
            $array[] = [
                    'value' => $sourceValue,
                    'text'  => $sourceText,
            ];
        }
        $sourceResult = json_encode($array);
    } elseif(is_string($source)) {
        $sourceResult = $source;
    }
}
if(is_array($value)) {
    $value = json_encode($value);
}
?>
<a href='#'
   id='<?= $id; ?>'
   class='<?= $initJsClass; ?> <?= $class; ?>'
   data-escape='<?= $escape; ?>'
   data-name='<?= $name; ?>'
   data-value='<?= $value; ?>'
   data-url='<?= $url; ?>'
   data-type='<?= $type; ?>'
   data-pk='<?= $pk; ?>'
   data-emptytext='<?= $emptyText; ?>'
   <?php if($sourceResult) { ?>
   data-source='<?= $sourceResult; ?>'
   <?php } ?>
   <?php if($originalTitle) { ?>
   data-original-title='<?= $originalTitle; ?>'
   <?php } ?>
   <?php if($title) { ?>
   title='<?= $title; ?>'
   <?php } ?>
   <?php if($rows) { ?>
   data-rows='<?= $rows; ?>'
   <?php } ?>
        <?php if($callback) {
    echo (string)$callback;
} ?>
>
    <?= $text; ?>
</a>
{{--
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>
{'fraction_non_alphanumeric': 0.20304568527918782, 'fraction_numerical': 0.00338409475465313, 'mean_word_length': 2.407756813417191, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7478862', 'n_tokens_mistral': 2131, 'n_tokens_neox': 2142, 'n_words': 478}