<commit_before><?php
use Cake\Utility\Inflector;

echo $this->Html->script([
    'Cms./plugins/masonry/masonry.pkgd.min',
    'Cms./plugins/imagesloaded/imagesloaded.pkgd.min',
    'Cms.masonry.init'
], ['block' => 'scriptBotton']);

$elements = [];
foreach ($articles as $article) {
    $element = 'Plugin/Cms/' . Inflector::camelize($article->type) . '/list';

    // fallback to plugin's element
    if (!$this->elementExists($element)) {
        $element = Inflector::camelize($article->type) . '/list';
    }

    // fallback to default element
    if (!$this->elementExists($element)) {
        $element = 'Common/list';
    }

    $elements[] = [
        'name' => $element,
        'data' => [
            'types' => $types,
            'article' => $article
        ]
    ];
}
?>
<div class ="row masonry-container">
<?php foreach ($elements as $element) : ?>
    <div class="col-xs-12 col-md-6 col-lg-4 item">
        <div class="box box-solid">
            <div class="box-header with-border">
                <i class="fa fa-<?= $types[$element['data']['article']->type]['icon'] ?> text-muted"></i>
                <h3 class="box-title">
                <?= $this->Html->link(
                    $this->Text->truncate($element['data']['article']->title, 35, ['exact' => false]),
                    [
                        'controller' => 'Articles',
                        'action' => 'view',
                        $element['data']['article']->site->slug,
                        $element['data']['article']->type,
                        $element['data']['article']->slug
                    ],
                    ['title' => h($element['data']['article']->title)]
                ) ?></h3>
                <div class="box-tools pull-right">
                    <?= $this->Html->link('<i class="fa fa-pencil"></i>', '#', [
                        'title' => __('Edit'),
                        'class' => 'btn btn-box-tool',
                        'escape' => false,
                        'data-toggle' => 'modal',
                        'data-target' => '#' . $element['data']['article']->slug
                    ]) ?>
                    <?= $this->Form->postLink(
                        '<i class="fa fa-trash"></i>',
                        [
                            'controller' => 'Articles',
                            'action' => 'delete',
                            $element['data']['article']->site->slug,
                            $element['data']['article']->slug
                        ],
                        [
                            'confirm' => __('Are you sure you want to delete # {0}?', $element['data']['article']->title),
                            'title' => __('Delete'),
                            'class' => 'btn btn-box-tool',
                            'escape' => false
                        ]
                    ) ?>
                </div>
            </div>
            <div class="box-body">
                <?= $this->element($element['name'], $element['data']); ?>
            </div>
            <div class="box-footer small">
                <div class="text-muted text-right">
                    <?= __('Published') ?>
                    <?= $element['data']['article']->publish_date->timeAgoInWords([
                        'format' => 'MMM d, YYY',
                        'end' => '1 month'
                    ]) ?>
                </div>
            </div>
        </div>
    </div>
<?php endforeach; ?>
</div>
<?php foreach ($articles as $article) : ?>
    <div class="modal fade" id="<?= $article->slug ?>" tabindex="-1" role="dialog" aria-labelledby="<?= $article->slug ?>Label"><commit_msg>Display associated type or category url (task #3424)<commit_after><?php
use Cake\Utility\Inflector;

echo $this->Html->script([
    'Cms./plugins/masonry/masonry.pkgd.min',
    'Cms./plugins/imagesloaded/imagesloaded.pkgd.min',
    'Cms.masonry.init'
], ['block' => 'scriptBotton']);

$elements = [];
foreach ($articles as $article) {
    $element = 'Plugin/Cms/' . Inflector::camelize($article->type) . '/list';

    // fallback to plugin's element
    if (!$this->elementExists($element)) {
        $element = Inflector::camelize($article->type) . '/list';
    }

    // fallback to default element
    if (!$this->elementExists($element)) {
        $element = 'Common/list';
    }

    $elements[] = [
        'name' => $element,
        'data' => [
            'types' => $types,
            'article' => $article
        ]
    ];
}
?>
<div class ="row masonry-container">
<?php foreach ($elements as $element) : ?>
    <div class="col-xs-12 col-md-6 col-lg-4 item">
        <div class="box box-solid">
            <div class="box-header with-border">
                <i class="fa fa-<?= $types[$element['data']['article']->type]['icon'] ?> text-muted"></i>
                <h3 class="box-title">
                <?= $this->Html->link(
                    $this->Text->truncate($element['data']['article']->title, 35, ['exact' => false]),
                    [
                        'controller' => 'Articles',
                        'action' => 'view',
                        $element['data']['article']->site->slug,
                        $element['data']['article']->type,
                        $element['data']['article']->slug
                    ],
                    ['title' => h($element['data']['article']->title)]
                ) ?></h3>
                <div class="box-tools pull-right">
                    <?= $this->Html->link('<i class="fa fa-pencil"></i>', '#', [
                        'title' => __('Edit'),
                        'class' => 'btn btn-box-tool',
                        'escape' => false,
                        'data-toggle' => 'modal',
                        'data-target' => '#' . $element['data']['article']->slug
                    ]) ?>
                    <?= $this->Form->postLink(
                        '<i class="fa fa-trash"></i>',
                        [
                            'controller' => 'Articles',
                            'action' => 'delete',
                            $element['data']['article']->site->slug,
                            $element['data']['article']->slug
                        ],
                        [
                            'confirm' => __('Are you sure you want to delete # {0}?', $element['data']['article']->title),
                            'title' => __('Delete'),
                            'class' => 'btn btn-box-tool',
                            'escape' => false
                        ]
                    ) ?>
                </div>
            </div>
            <div class="box-body">
                <?= $this->element($element['name'], $element['data']); ?>
            </div>
            <div class="box-footer small">
                <div class="text-muted text-right">
                <?php
                if ('type' === $this->request->action) {
                    $assocUrl = $this->Html->link($element['data']['article']->category->name, [
                        'controller' => 'Categories',
                        'action' => 'view',
                        $element['data']['article']->site->slug,
                        $element['data']['article']->category->slug
                    ]);
                } else {
                    $assocUrl = $this->Html->link($types[$element['data']['article']->type]['label'], [
                        'controller' => 'Articles',
                        'action' => 'type',
                        $element['data']['article']->site->slug,
                        $element['data']['article']->type
                    ]);
                }
                ?>
                <?= $assocUrl ?>
                |
                <?= __('Published') ?>
                <?= $element['data']['article']->publish_date->timeAgoInWords([
                    'format' => 'MMM d, YYY',
                    'end' => '1 month'
                ]) ?>
                </div>
            </div>
        </div>
    </div>
<?php endforeach; ?>
</div>
<?php foreach ($articles as $article) : ?>
    <div class="modal fade" id="<?= $article->slug ?>" tabindex="-1" role="dialog" aria-labelledby="<?= $article->slug ?>Label">
{'fraction_non_alphanumeric': 0.1922984065668759, 'fraction_numerical': 0.0031385803959439883, 'mean_word_length': 1.3279010958134307, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 207, 'https://': 0, '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': '4924161', 'n_tokens_mistral': 2271, 'n_tokens_neox': 2187, 'n_words': 376}