payre3p_app/app/views/public/articles/index.html.haml
Nicolas Bally 2accaa7c41 Suite
2018-08-07 13:41:40 +02:00

216 lines
8.1 KiB
Plaintext

-@menu_shadow = true
-@title = qit "SEO titre blog", "Articles du blog"
-if !@new_site
=render :partial => "public/articles/intro_blog"
%h2.home_title
à la
%span une
.blog_index.left
.row
.columns.span_7
-if @articles[0]
=render :partial => "article", :object => @articles[0], :as => :article
.columns.span_5
-if @articles[1]
=render :partial => "article_x2", :object => @articles[1], :as => :article
-if @articles[2]
=render :partial => "article_x2", :object => @articles[2], :as => :article
.clear
%br
%br
=raw "</div>"
-@category = Category.order(:position).first
.blog_category
.main_container
%h3=qit "blog-index-categories-titre", "Catégories"
-Category.order(:position).each do |category|
-count = category.articles.recents.joins(:lang_articles).where("lang_articles.enabled = 1 and lang_articles.lang_site_id = ?", @lang.id).count
-if count > 0
=#raw(" <span>#{count}</span>")
=link_to raw(category.lang(I18n.locale.to_s).name), category_public_article_path(:lang => @lang.slug,:slug => category.lang(I18n.locale.to_s).slug), :class => ("active" if @category and category.id == @category.id), :data => {:id => category.id}
=raw "<div class='main_container' >"
.animate_index
-Category.order(:position).each do |category|
-count = category.articles.recents.joins(:lang_articles).where("lang_articles.enabled = 1 and lang_articles.lang_site_id = ?", @lang.id).count
-if count > 0
.index_category#index_category{:id => category.id, :style => ("display:none;" if @category and category.id != @category.id)}
.more_articles_link
=link_to raw(qit("blog Tous les articles", "Tous les articles")+raw(" <span>#{count}</span> >")), category_public_article_path(:slug => category.lang(I18n.locale.to_s).slug, :lang => @lang.slug), :title => "Articles de la catégorie \""+category.name.to_s+'"'
%h3
=link_to category.lang(I18n.locale.to_s).name, category_public_article_path(:slug => category.lang(I18n.locale.to_s).slug), :title => "Articles de la catégorie \""+category.name.to_s+'"'
-articles = category.articles.recents.joins(:lang_articles).where("lang_articles.enabled = 1 and lang_articles.lang_site_id = ?", @lang.id).limit(4)
.blog_index.right
.row
.columns.span_5
-if articles[1]
=render :partial => "article_x2", :object => articles[1], :as => :article
-if articles[2]
=render :partial => "article_x2", :object => articles[2], :as => :article
.columns.span_7
-if articles[0]
=render :partial => "article", :object => articles[0], :as => :article
.clear
.blog_sidebar_bottom
.blog_sidebar=render :partial => "public/articles/sidebar"
-else
.slide_home_wrapper
.slide_home.slider
-@articles_slider.each do |article|
-lang_article = article.lang_articles.find_by_lang_site_id(@lang.id)
-if lang_article.slider_image_file
-img_url = "https://payre3p.quartz.xyz"+lang_article.slider_image_file.file.large.url
-elsif article.image_file
-img_url = "https://payre3p.quartz.xyz"+article.image_file.file.large.url
=link_to article_path(:slug => lang_article.slug, :lang => @lang.slug), :class => "" do
%div.with_ratio.slide{:style => "background-image:url('#{img_url}');background-size:100%;background-size:cover;", :data => {:ratio => 0.28}}
.description.vertical_center
%h3= lang_article.title
.date
-cats = []
-article.categories.uniq.each do |cat|
-cats << cat.lang(I18n.locale.to_s).name
=cats.join(", ")
%span.sep
="|"
%span
=l article.published_at, :format => :human_date
.btn
=qit("Lire l'article")
>
:javascript
$(document).ready(function(){
$('.slider').bxSlider({
nextText: '>',
prevText: '<'
});
});
.blog_articles
.row.blog_article_sub_headers
-@articles_une[0..1].each do |article|
-lang_article = article.lang_articles.find_by_lang_site_id(@lang.id)
-img_url = ""
-if article.without_text_image_file
-img_url = "https://payre3p.quartz.xyz"+article.without_text_image_file.file.large.medium.small.url
-if article.image_file
-img_url = "https://payre3p.quartz.xyz"+article.image_file.file.large.medium.small.url
-else
-img_url = ""
.blog_article_sub_header
.inner
=link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
.img.with_ratio{:style => "background: black center center;background-image:url('#{img_url}');position:relative;background-size:cover;", :data => {:ratio => 0.62}}
=image_tag "/blog-hover.png", :class => "vertical_center"
=link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
%h2= lang_article.title
.date
-cats = []
-article.categories.uniq.each do |cat|
-cats << link_to(cat.lang(I18n.locale.to_s).name, category_public_article_path(:lang => @lang.slug,:slug => cat.lang(I18n.locale.to_s).slug), :title => "Articles de la catégorie \""+cat.lang(I18n.locale.to_s).name.to_s+'"')
=raw cats.join(", ")
%span.sep
="|"
=l article.published_at, :format => :human_date
%span.sep
="|"
%span.sep=i(:"comment-o")
=article.comments.where(:enabled => true).count.to_s
.description
=link_to article_path(:slug => lang_article.slug, :lang => @lang.slug) do
=simple_format lang_article.description.truncate(160, separator: ' ')
=link_to article_path(:slug => lang_article.slug, :lang => @lang.slug), :class => "btn" do
=qit("Lire l'article")
>
.clear
%a{:name => "categories"}
.clear
.blog_categories_wrapper
.moveSlide#upClick
=ic :"angle-right"
.moveSlide#downClick
=ic :"angle-left"
:javascript
$("#upClick").on("click" ,function(){
scroll_element = $('#blog_categories_horizontal')
scrolled = scroll_element.scrollLeft();
scrolled=scrolled+($(window).width()-60);
scroll_element.animate({
scrollLeft: scrolled
});
});
$("#downClick").on("click" ,function(){
scroll_element = $('#blog_categories_horizontal')
scrolled = scroll_element.scrollLeft();
scrolled=scrolled-($(window).width()-60);
scroll_element.animate({
scrollLeft: scrolled
});
});
#blog_categories_horizontal.blog_categories
=link_to qit("Tous"), articles_path(:change_cat => true), :class => ("active" if !params[:category_id]), :remote => true, :onclick => "$('.blog_categories a').removeClass('active');$(this).addClass('active');"
-Category.order(:position).each do |category|
-count = category.articles.recents.joins(:lang_articles).where("lang_articles.enabled = 1 and lang_articles.lang_site_id = ?", @lang.id).count
-if count > 0
%span.sep
= "|"
=link_to raw(category.lang(I18n.locale.to_s).name), articles_path(:category_id => category.id,:change_cat => true), :class => ("active" if @category and category.id == @category.id), :data => {:id => category.id}, :remote => true, :onclick => "$('.blog_categories a').removeClass('active');$(this).addClass('active');"
.blog_articles_list
=render :partial => "article_list"