Class: Gluttonberg::Admin::MainController

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

Instance Method Summary collapse

Instance Method Details

#decline_contentObject

decline content which is waiting for approval



36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/gluttonberg/admin/main_controller.rb', line 36

def decline_content
  version, status = find_version_and_update_status
  if status
    unless version.user.blank?
      notify_user(version)
    end
    flash[:notice] = "You have declined this version, the contributor has been notified."
  else
    flash[:error] = "The version was failed to decline."
  end
  redirect_to :back
end

#indexObject

Dashboad



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

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 Gluttonberg.constants.include?(:Blog)
    @blog = Gluttonberg::Blog::Weblog.first
  end

  if Gluttonberg.constants.include?(:Blog)
    @comments = Gluttonberg::Blog::Comment.all_pending.where({:commentable_type => "Gluttonberg::Article" , :moderation_required => true }).order("created_at DESC").limit(5)
    @article = Gluttonberg::Blog::Article.new
    @blogs = Gluttonberg::Blog::Weblog.all
    @authors = User.all
  end
end

#showObject



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

def show
end

#waiting_for_approvalObject

list of content which is waiting for approval



32
33
# File 'app/controllers/gluttonberg/admin/main_controller.rb', line 32

def waiting_for_approval
end