<?php
slot('title', __('Читать'));
include_partial('main/breadcrumbs');
echo '<h1 class="content_title">' . __('Читать') . '</h1>';
include_component('main', 'tag');
?>
<div class="article_item_gutter" style="width: 100%; text-align: center">
    <?php
    if (count($articles) >= sfConfig::get('app_view_count_tag'))
    {
        echo '<a data-tag-id="all" class="article_show_tag green_link ' . (!$tag_id || $tag_id == 'all' ? 'active' : '') . '">Все</a>';
        foreach ($articles_tags as $tag)
        {
            echo '<a class="article_show_tag green_link ' . ($tag_id == $tag['id'] ? 'active' : '') . '" data-tag-id="' . $tag['id'] . '">' . $tag['Translation'][$culture]['title'] . '</a>';
        }
    }
    ?>
</div>
<i class="br20 mobile_hide"></i>
<div class="articles_wrap">
    <?php include_partial("article/article", array('articles' => $articles)); ?>
</div>
<script>
    var culture = '<?php echo $culture ?>';
    $('body').on('click', '.article_show_tag', function () {
        //alert('123');
        _this = this;
        $.ajax({
            url: '/' + culture + '/article/',
            type: 'get',
            data: {tag_id : $(this).attr('data-tag-id'), ajax : 1},
            success: function (html) {
                $('.article_show_tag').removeClass('active');
                $(_this).addClass('active');
                $('.articles_wrap').html(html);
                setUrlHash('?tag_id='+$(_this).attr('data-tag-id'));
            }

        });

        //alert($(this).attr('data-tag-id'));
    });

</script>