# -*- encoding : utf-8 -*-

class Public::ImageActuAlbumsController < ApplicationController
  layout "public"
  def show
    
    if params[:lang]
      
      @lang = LangSite.find_by_slug(params[:lang])
      
    end
    
    @image_actu_album_lang = ImageActuAlbumLang.where(:lang_site_id => @lang.id).find_by_id(params[:id].split("-")[-1].to_i)
		@image_actu_album = @image_actu_album_lang.image_actu_album
    
    @image_actus = @image_actu_album.image_actus.order("random_position DESC").page(params[:page]).per(20).all
   
  end


  def index
    
    
    @image_actus = ImageActu.order("random_position DESC").page(params[:page]).per(20).all
    
    
  end
 
  def hashtag
    @hashtag = Hashtag.find_by_slug(params[:id])
    
   
    @image_actus = ImageActu.joins(:hashtags).where(:hashtags => {:id => @hashtag.id}).order("random_position DESC").page(params[:page]).per(20).all
  end



end
