Class: Gluttonberg::Admin::MainController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/gluttonberg/admin/main_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/gluttonberg/admin/main_controller.rb', line 6

def index
  @categories_count = ActsAsTaggableOn::Tag.find_by_sql(%{
    select count(DISTINCT tags.id) as category_count
    from tags inner join taggings on tags.id = taggings.tag_id
    where context = 'article_category'
  }).first.category_count
  @tags_counts =  ActsAsTaggableOn::Tag.count - @categories_count.to_i

  if Blog.table_exists?
    @blog = Blog.first
  end

  if Comment.table_exists?
    @comments = Comment.find(:all , :conditions => {:commentable_type => "Gluttonberg::Article" , :moderation_required => true } , :order => "created_at DESC" , :limit => 3)
    @article = Article.new
    @article_localization = ArticleLocalization.new(:article => @article , :locale_id => Locale.first_default.id)
    @blogs = Gluttonberg::Blog.all
    @authors = User.all
  end
end

#showObject



27
28
# File 'app/controllers/gluttonberg/admin/main_controller.rb', line 27

def show
end