{% extends [
		'@doclayout/pages/news.twig',
		'@docpages/pages/news.twig',
		
		'@layout/pages/news.twig'
	]
%}

{% block page %}
<section id="news" class="section first-section news full_page full_page-search">
	<h1>{{ out.terms_and_conditions }}</h1>
	<div class="container">
		<div class="content">
			<div class="row">
				<div class="col-xs-12 col-md-8 col-md-push-2">
					<form action="/{{ constant('SITE_LANG') }}/search.html" method="POST">
						<div class="row">
							<div class="col-xs-8 col-sm-9 col-md-10">
								<input name="search" type="text" placeholder="{{ out.search.search }}" value="{{ POST.search }}">
							</div>
							<div class="col-xs-4 col-sm-3 col-md-2">
								<button type="submit" class="btn btn-primary">
									<i class="fa fa-search fa-lg"></i>
								</button>
							</div>
						</div>
					</form>
				</div>
			</div>
			
			{% block filter %}
				<div class="container">
					<div class="news-filter row os-animation animated fadeInUp" data-os-animation="fadeInUp">
						<div class="col-md-3 col-xs-4 col-xs-12">
							<p>{{ out.search.pages }}:</p>
							<ul class="isotope-filters filter-page no-padding-top">
								<li class="active"><a class="active" data-filter="*" href="javascript:void(0);">{{ out.search.all }}</a></li>
								{% for page in data.pages %}
									<li><a data-filter="[data-page='{{ page.group }}'][data-sub-page='{{ page.sub_group }}']" href="javascript:void(0);">{{ page.title }}</a></li>
								{% endfor %}
							</ul>
						</div>
						<div class="col-md-9 col-xs-8 col-xxs-12">
							<p>{{ out.search.categories }}:</p>
							<ul class="isotope-filters filter-cat no-padding-top">
								<li class="active"><a class="active" data-filter="*" href="javascript:void(0);">{{ out.search.all }}</a></li>
								{% for category in data.cats %}
									<li><a data-filter="[data-cat='{{ category.id_category }}']" href="javascript:void(0);">{{ category.desc }}</a></li>
								{% endfor %}
							</ul>
						</div>
					</div>
				</div>
			{% endblock %}
			
			
			{% block content %}
				<div class="row">
					{% for news in data.news %}
						{% set category = (site.show_news_categories and news.category ? news.category ~ ' - ') %}
						{% set title = category ~ news.title %}
						{% set page = data.pages[news.id_page] %}
						
						{% set has_content = news.title_text1 or news.title_text2 or news.title_text3 or (news.text1 and news.text1 != '<br>') or (news.text2 and news.text2 != '<br>') or (news.text3 and news.text3 != '<br>') %}
						
						{% block article %}
							<article id="news_{{ news.id_n }}" class="col-md-{{ cols }} col-sm-6 col-xxs-12" data-cat="{{ news.id_news_categories }}" data-page="5" data-sub-page="{{ news.id_page }}">
								<h1>{{ title | raw }}</h1>
								{% block article_header %}
									<div class="article-image">
										{% if news.youtube %}
											{% block article_header_youtube %}
												<div class="embeddedvideo" style="background:url('{{ constant('ROOT_URL_SCHEME') }}://img.youtube.com/vi/{{ news.youtube }}/0.jpg');background-size:cover;background-position:center center;">
													<img src="{{ youtube_src }}" data-id="{{ news.youtube }}" class="youtube_video" style="background:url('/images/youtube-play.png') no-repeat center;" alt="{{ news.title }}"/>
												</div>
											{% endblock %}
										{% else %}
											{% block article_header_image %}
												{% if page.full_page %}
													<a href="/{{ constant('SITE_LANG') }}/news/{{ news.id_n }}/{{ (category ~ news.title|escape('html')|replace({'&amp;euro;':'&euro;'})|raw)|url_clean_title() }}.html" target="_self">
												{% else %}
													<a href="{{data.store_enabled ? '/store' }}/get/{{ news.id_n }}.html?lightbox%5Bwidth%5D=640&amp;lightbox%5Bheight%5D=75p" rel="nofollow">
												{% endif %}
													<img src="/{{ news.src_thumb }}" alt="{{ title }}"/>
												</a>
											{% endblock %}
										{% endif %}
									</div>
								{% endblock %}
								
								<div class="no-padding">
									
									{% block article_title %}
										<h2 class="title text-center">{{ title|escape('html')|replace({'&amp;euro;':'&euro;'})|raw }}</h2>
										<h3 class="date"><time datetime="{{ news.html5_date }}">{{ news.date }}</time></h3>
									{% endblock %}
									{% block _ext_store_news_articles_price %}{% endblock %}
									
									{% block article_contents %}
										{% if news.html and news.html != '<br>' and news.html != '<p>&nbsp;</p>' %}
											{% block article_content %}
												<div class="padding-30 no-padding-top no-padding-bottom description text-left">
													{{ ('<p>' ~ news.html ~ '</p>') | preg_replace(cleaner.p.regex, cleaner.p.replace) | raw }}
												</div>
											{% endblock %}
										{% endif %}
										
										{% if news.doc_list|length or news.url %}
											<div class="padding-30 no-padding-top no-padding-bottom description text-left">
												{% for doc in news.doc_list %}
													{% block article_doc %}
														<a href="/{{ doc.src }}" target="_blank" class="small-button" rel="nofollow">
															<i class="fa fa-file-pdf-o"></i>&nbsp;{{ doc.title }}
														</a>&nbsp;
													{% endblock %}
												{% endfor %}
												
												{% if news.url %}
													{% block article_read_more %}
														<a href="{{ news.url }}" target="_blank" class="small-button" rel="nofollow"><i class="fa fa-link"></i> {{ out.read_more }}</a>
													{% endblock %}
												{% endif %}
											</div>
										{% endif %}
									
									{% endblock %}
								</div>
									
								{% block article_hidden_section %}
									<section>
										<h1>{{ title | raw }}</h1>
										<h2 class="text-center">{{ title | raw }}</h2>
										{% if (news.n_images > 1) and site.lightbox_news_thumbs %}
											{% block article_hidden_slideshow %}
											<div>
												<div>
													<img src="/{{ news.src_thumb }}" class="img-responsive" style="width:128px;border:3px solid #FFF">
												</div>
											</div>
											{% endblock %}
										{% endif %}
										{% if has_content %}
											<article class="col-md-4 col-sm-6 col-xs-12">
												<h1>{{ news.title_text1 }}</h1>
												<h2>{{ news.title_text1 }}</h2>
												<p>{{ news.text1 | raw }}</p>
											</article>
											<article class="col-md-4 col-sm-6 col-xs-12">
												<h1>{{ news.title_text2 }}</h1>
												<h2>{{ news.title_text2 }}</h2>
												<p>{{ news.text2 | raw }}</p>
											</article>
											<article class="col-md-4 col-sm-6 col-xs-12">
												<h1>{{ news.title_text3 }}</h1>
												<h2>{{ news.title_text3 }}</h2>
												<p>{{ news.text3 | raw }}</p>
											</article>
											<div class="clearfix"></div>
										{% endif %}
									</section>
								{% endblock article_hidden_section %}
							</article>
						{% endblock article %}
					{% endfor %}
				</div>
			{% endblock content %}
			
			
			
			
			
		</div>
	</div>
</section>

{% block script %}
{% verbatim %}
<script>
(function(window){
	window.jQuery(function($){
		$('nav ul > li > a').unbind('click');
		
		
		$('#news').has('.isotope-filters').each(function(){
			var $this = $(this);
			
			var $ul = $this.find('.isotope-filters');
			var $articles = $this.find('.row > article');
			var $parent = $articles.parent();
			var $ul_pages = $ul.filter('.filter-page');
			var $ul_cats = $ul.filter('.filter-cat');
			
			var $isotope = $parent.isotope({
    			layoutMode: 'fitRows',
    			percentPosition: true,
    			masonry: {
                    columnWidth: '.grid-sizer'
                }
			});
			
			$ul.on('click', 'a', function(e){
				e.preventDefault();
				
				var $a = $(this);
				
				if($a.hasClass('active'))
				{
					return;
				}
				
				var $top_ul = $a.closest('ul');
				
				$top_ul.find('a.active').removeClass('active');
				$a.addClass('active');
				
				var filter = (
					$ul_cats.find('a.active').attr('data-filter')
					+ $ul_pages.find('a.active').attr('data-filter')
				).replace('*', '') || '*';
				
				$isotope.isotope({
					filter: function(){
						return $(this).is(filter);
					}
				});
			});
		});
		
	});
})(Function('return this')());
</script>
{% endverbatim %}
{% endblock %}
{% endblock %}