Making use of modules and putting classes under modules.

This commit is contained in:
Philip Arndt 2011-07-01 09:14:46 +12:00
parent 47a71b309f
commit 7028ef3ddd
7 changed files with 260 additions and 238 deletions

View file

@ -1,7 +1,11 @@
class Admin::Blog::CategoriesController < Admin::BaseController
module Admin
module Blog
class CategoriesController < Admin::BaseController
crudify :blog_category,
:title_attribute => :title,
:order => 'title ASC'
end
end
end

View file

@ -1,4 +1,6 @@
class Admin::Blog::CommentsController < Admin::BaseController
module Admin
module Blog
class CommentsController < Admin::BaseController
crudify :blog_comment,
:title_attribute => :name,
@ -33,4 +35,6 @@ class Admin::Blog::CommentsController < Admin::BaseController
end
end
end
end
end

View file

@ -1,4 +1,6 @@
class Admin::Blog::PostsController < Admin::BaseController
module Admin
module Blog
class PostsController < Admin::BaseController
crudify :blog_post,
:title_attribute => :title,
@ -79,8 +81,10 @@ class Admin::Blog::PostsController < Admin::BaseController
before_filter :find_all_categories,
:only => [:new, :edit, :create, :update]
protected
protected
def find_all_categories
@blog_categories = BlogCategory.find(:all)
end
end
end
end

View file

@ -1,4 +1,6 @@
class Admin::Blog::SettingsController < Admin::BaseController
module Admin
module Blog
class SettingsController < Admin::BaseController
def notification_recipients
@recipients = BlogComment::Notification.recipients
@ -36,4 +38,6 @@ class Admin::Blog::SettingsController < Admin::BaseController
end
end
end
end
end

View file

@ -1,4 +1,5 @@
class Blog::CategoriesController < BlogController
module Blog
class CategoriesController < BlogController
def show
@category = BlogCategory.find(params[:id])
@ -8,4 +9,5 @@ class Blog::CategoriesController < BlogController
})
end
end
end

View file

@ -1,4 +1,5 @@
class Blog::PostsController < BlogController
module Blog
class PostsController < BlogController
before_filter :find_all_blog_posts, :except => [:archive]
before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
@ -75,7 +76,7 @@ class Blog::PostsController < BlogController
})
end
protected
protected
def find_blog_post
unless (@blog_post = BlogPost.find(params[:id])).try(:live?)
@ -98,4 +99,5 @@ protected
@tags = BlogPost.tag_counts_on(:tags)
end
end
end

View file

@ -1,4 +1,5 @@
class Blog::CommentMailer < ActionMailer::Base
module Blog
class CommentMailer < ActionMailer::Base
def notification(comment, request)
subject BlogComment::Notification.subject
@ -8,4 +9,5 @@ class Blog::CommentMailer < ActionMailer::Base
@comment = comment
end
end
end