Archive: ComponentOwl Rails app, DB backups, go redirect script
This commit is contained in:
33
app/controllers/articles_controller.rb
Normal file
33
app/controllers/articles_controller.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
class ArticlesController < ApplicationController
|
||||
|
||||
caches_page :index, :show
|
||||
|
||||
def index
|
||||
@featured_articles = Article.published.featured(Settings.resources.featured_articles)
|
||||
@articles = Article.cute_ordered.published - @featured_articles
|
||||
end
|
||||
|
||||
def show
|
||||
@article = Article.find_by_slug(params[:id])
|
||||
|
||||
if @article
|
||||
if @article.keyword1.present?
|
||||
@meta_title = I18n.t('txt.articles.meta_title_with_keyword', :title => @article.title, :keyword => @article.keyword1)
|
||||
else
|
||||
@meta_title = I18n.t('txt.articles.meta_title', :title => @article.title)
|
||||
end
|
||||
if @article.custom_subtemplate.blank?
|
||||
@subtemplate = SubtemplateType.with_keywords('article-sidebar', @article)
|
||||
else
|
||||
@subtemplate = @article.custom_subtemplate
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render_404 }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user