comfy_blog 0.1.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.travis.yml +11 -0
  4. data/Gemfile +8 -6
  5. data/LICENSE +2 -2
  6. data/README.md +22 -56
  7. data/Rakefile +19 -16
  8. data/app/controllers/admin/blog/base_controller.rb +11 -2
  9. data/app/controllers/admin/blog/blogs_controller.rb +51 -0
  10. data/app/controllers/admin/blog/comments_controller.rb +16 -17
  11. data/app/controllers/admin/blog/posts_controller.rb +26 -26
  12. data/app/controllers/blog/base_controller.rb +31 -0
  13. data/app/controllers/blog/comments_controller.rb +25 -27
  14. data/app/controllers/blog/posts_controller.rb +36 -29
  15. data/app/models/blog/blog.rb +29 -0
  16. data/app/models/blog/comment.rb +7 -9
  17. data/app/models/blog/post.rb +17 -55
  18. data/app/views/admin/blog/blogs/_form.html.haml +11 -0
  19. data/app/views/admin/blog/blogs/edit.html.haml +5 -0
  20. data/app/views/admin/blog/blogs/index.html.haml +26 -0
  21. data/app/views/admin/blog/blogs/new.html.haml +5 -0
  22. data/app/views/admin/blog/comments/_comment.html.haml +17 -0
  23. data/app/views/admin/blog/comments/index.html.haml +17 -0
  24. data/app/views/admin/blog/comments/toggle_publish.js.erb +1 -0
  25. data/app/views/admin/blog/partials/_navigation.html.haml +6 -0
  26. data/app/views/admin/blog/posts/_form.html.haml +13 -0
  27. data/app/views/admin/blog/posts/edit.html.haml +5 -0
  28. data/app/views/admin/blog/posts/index.html.haml +32 -0
  29. data/app/views/admin/blog/posts/new.html.haml +5 -0
  30. data/app/views/blog/comments/_form.html.haml +10 -0
  31. data/app/views/blog/posts/index.html.haml +13 -0
  32. data/app/views/blog/posts/index.rss.builder +7 -5
  33. data/app/views/blog/posts/show.html.haml +18 -0
  34. data/app/views/layouts/blog/application.html.haml +7 -0
  35. data/comfy_blog.gemspec +16 -128
  36. data/config.ru +1 -1
  37. data/config/application.rb +6 -26
  38. data/config/blog_routes.rb +6 -0
  39. data/config/boot.rb +1 -2
  40. data/config/database.yml +2 -16
  41. data/config/environments/development.rb +10 -16
  42. data/config/environments/test.rb +14 -20
  43. data/config/initializers/comfy_blog.rb +1 -16
  44. data/config/initializers/secret_token.rb +14 -2
  45. data/db/migrate/00_create_cms.rb +137 -0
  46. data/db/migrate/01_create_blog.rb +52 -0
  47. data/lib/comfy_blog.rb +14 -17
  48. data/lib/comfy_blog/configuration.rb +1 -35
  49. data/lib/comfy_blog/engine.rb +17 -11
  50. data/lib/comfy_blog/routing.rb +38 -0
  51. data/lib/comfy_blog/version.rb +3 -0
  52. data/lib/generators/comfy/blog/README +7 -7
  53. data/lib/generators/comfy/blog/blog_generator.rb +24 -10
  54. data/script/rails +1 -1
  55. data/test/controllers/admin/blog/blogs_controller_test.rb +94 -0
  56. data/test/controllers/admin/blog/comments_controller_test.rb +57 -0
  57. data/test/{functional → controllers}/admin/blog/posts_controller_test.rb +31 -31
  58. data/test/controllers/blog/comments_controller_test.rb +36 -0
  59. data/test/controllers/blog/posts_controller_test.rb +80 -0
  60. data/test/fixtures/blog/blogs.yml +7 -0
  61. data/test/fixtures/blog/posts.yml +1 -0
  62. data/test/fixtures/cms/sites.yml +4 -0
  63. data/test/fixtures/generators/blog/routes.rb +6 -0
  64. data/test/generators/blog_generator_test.rb +19 -0
  65. data/test/lib/configuration_test.rb +16 -0
  66. data/test/models/blog/blog_test.rb +59 -0
  67. data/test/{unit/comment_test.rb → models/blog/comments_test.rb} +4 -5
  68. data/test/models/blog/posts_test.rb +88 -0
  69. data/test/test_helper.rb +80 -27
  70. metadata +53 -111
  71. data/VERSION +0 -1
  72. data/app/assets/images/rails.png +0 -0
  73. data/app/assets/javascripts/application.js +0 -8
  74. data/app/controllers/admin/blog/tags_controller.rb +0 -56
  75. data/app/controllers/application_controller.rb +0 -5
  76. data/app/helpers/blog/application_helper.rb +0 -23
  77. data/app/models/.gitkeep +0 -0
  78. data/app/models/blog/tag.rb +0 -25
  79. data/app/models/blog/tagging.rb +0 -22
  80. data/app/views/admin/blog/_navigation.html.erb +0 -1
  81. data/app/views/admin/blog/comments/_comment.html.erb +0 -22
  82. data/app/views/admin/blog/comments/destroy.js.erb +0 -3
  83. data/app/views/admin/blog/comments/index.html.erb +0 -12
  84. data/app/views/admin/blog/comments/publish.js.erb +0 -1
  85. data/app/views/admin/blog/posts/_form.html.erb +0 -37
  86. data/app/views/admin/blog/posts/_post.html.erb +0 -29
  87. data/app/views/admin/blog/posts/edit.html.erb +0 -5
  88. data/app/views/admin/blog/posts/index.html.erb +0 -15
  89. data/app/views/admin/blog/posts/new.html.erb +0 -5
  90. data/app/views/admin/blog/tags/_form.html.erb +0 -20
  91. data/app/views/admin/blog/tags/_tag.html.erb +0 -16
  92. data/app/views/admin/blog/tags/edit.html.erb +0 -5
  93. data/app/views/admin/blog/tags/index.html.erb +0 -9
  94. data/app/views/admin/blog/tags/new.html.erb +0 -5
  95. data/app/views/blog/comments/_comment.html.erb +0 -4
  96. data/app/views/blog/comments/_disqus.html.erb +0 -14
  97. data/app/views/blog/comments/_form.html.erb +0 -6
  98. data/app/views/blog/comments/create.js.erb +0 -6
  99. data/app/views/blog/posts/_post.html.erb +0 -8
  100. data/app/views/blog/posts/index.html.erb +0 -9
  101. data/app/views/blog/posts/show.html.erb +0 -13
  102. data/app/views/layouts/application.html.erb +0 -17
  103. data/config/locales/en.yml +0 -5
  104. data/config/routes.rb +0 -37
  105. data/db/migrate/01_create_comfy_blog.rb +0 -55
  106. data/db/schema.rb +0 -63
  107. data/db/seeds.rb +0 -7
  108. data/lib/comfy_blog/core_ext/string.rb +0 -8
  109. data/lib/comfy_blog/form_builder.rb +0 -50
  110. data/lib/tasks/comfy_blog.rake +0 -4
  111. data/test/fixtures/.gitkeep +0 -0
  112. data/test/fixtures/blog/taggings.yml +0 -7
  113. data/test/fixtures/blog/tags.yml +0 -14
  114. data/test/functional/.gitkeep +0 -0
  115. data/test/functional/admin/blog/comments_controller_test.rb +0 -38
  116. data/test/functional/admin/blog/tags_controller_test.rb +0 -88
  117. data/test/functional/blog/comments_controller_test.rb +0 -78
  118. data/test/functional/blog/posts_controller_test.rb +0 -110
  119. data/test/integration/routing_test.rb +0 -26
  120. data/test/unit/.gitkeep +0 -0
  121. data/test/unit/configuration_test.rb +0 -29
  122. data/test/unit/helpers/blog/application_helper_test.rb +0 -10
  123. data/test/unit/post_test.rb +0 -147
  124. data/test/unit/tag_test.rb +0 -45
  125. data/test/unit/tagging_test.rb +0 -30
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: 1aeff81384f3fb903b4190874469788c842ec0c5
4
+ data.tar.gz: 9e7902e544405cc03be7201f28eee0df4958b2fe
5
+ !binary "U0hBNTEy":
6
+ metadata.gz: c02614684124b20d5b3015b4014e985269878e9c7fb0b5a85000565fe1d826694d02cd9a9b39ef3b04509e9e10901964bd191414d5c5f256bea09663a0abff0d
7
+ data.tar.gz: f8666a836b87ee8a5cc3a54a798d63a57060ac6536e7815b7c24305e23baa0402f5234377b1c9e33595cfa75c91ed79c99669231f3a693a130c560000d271371
@@ -0,0 +1,16 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
5
+ .DS_Store
6
+ db/schema.rb
7
+ db/development_structure.sql
8
+ pkg
9
+ rdoc
10
+ /tmp
11
+ public/*
12
+ Gemfile.lock
13
+ .rvmrc
14
+ .ruby-version
15
+ /.sass-cache
16
+ coverage/
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ before_script:
6
+ - 'rake db:migrate'
7
+ script:
8
+ - rake test:all
9
+ branches:
10
+ only:
11
+ - master
data/Gemfile CHANGED
@@ -1,13 +1,15 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '>=3.1.0'
4
- gem 'rails_autolink', '>=1.0.4'
5
- gem 'jquery-rails', '>=1.0.0'
3
+ gemspec
6
4
 
7
- # gem 'will_paginate', '>=3.0.2'
8
- # gem 'kaminari', '>=0.0.0'
5
+ group :development do
6
+ gem 'awesome_print'
7
+ gem 'better_errors'
8
+ gem 'binding_of_caller'
9
+ gem 'quiet_assets'
10
+ end
9
11
 
10
12
  group :test do
11
13
  gem 'sqlite3'
12
- gem 'jeweler'
14
+ gem 'coveralls', :require => false
13
15
  end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Oleg Khabarov, The Working Group
1
+ Copyright 2013 Oleg Khabarov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,70 +1,36 @@
1
- # ComfyBlog [![Build Status](https://secure.travis-ci.org/comfy/comfy-blog.png)](http://travis-ci.org/comfy/comfy-blog) [![Dependency Status](https://gemnasium.com/comfy/comfy-blog.png)](https://gemnasium.com/comfy/comfy-blog)
1
+ # ComfyBlog
2
+ [![Gem Version](https://badge.fury.io/rb/comfy_blog.png)](http://rubygems.org/gems/comfy_blog) [![Build Status](https://secure.travis-ci.org/comfy/comfy-blog.png)](http://travis-ci.org/comfy/comfy-blog) [![Dependency Status](https://gemnasium.com/comfy/comfy-blog.png)](https://gemnasium.com/comfy/comfy-blog) [![Code Climate](https://codeclimate.com/github/comfy/comfy-blog.png)](https://codeclimate.com/github/comfy/comfy-blog) [![Coverage Status](https://coveralls.io/repos/comfy/comfy-blog/badge.png?branch=master)](https://coveralls.io/r/comfy/comfy-blog)
2
3
 
3
- ComfyBlog is an simple blog management engine for Rails 3.1 apps. It also integrates with [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) CMS Engine
4
+ ComfyBlog is an simple blog management engine for [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) (for version >= 1.10).
5
+
6
+ ## Features
7
+
8
+ * Ability to set up multiple blogs per site
9
+ * User defined layout per blog
4
10
 
5
11
  ## Installation
6
12
 
7
13
  Add gem definition to your Gemfile:
8
-
9
- gem 'comfy_blog'
10
-
14
+
15
+ ```ruby
16
+ gem 'comfy_blog', '~> 1.0.0'
17
+ ```
18
+
11
19
  Then from the Rails project's root run:
12
20
 
13
21
  bundle install
14
- rails g comfy:blog
22
+ rails generate comfy:blog
15
23
  rake db:migrate
16
24
 
17
- Now you should be able to go to `/admin/blog/posts` and add new blog posts.
18
-
19
- ## Configuration
20
-
21
- First thing you want to do is change title and description of the blog.
22
- For that you need to adjust `comfy_blog` initializer.
23
-
24
- config.title = 'ComfyBlog'
25
- config.description = 'A Simple Blog'
26
-
27
- You'll notice that you can access blog's admin area without any type of authentication.
28
- This is because ComfyBlog doesn't deal with users, it only knows how to save and show
29
- blog posts. You probably want to put blog's admin controllers behind your controller
30
- that handles authentication.
31
-
32
- config.admin_controller = 'YourAdminBaseController'
33
-
34
- If you want blog's controller paths to match your admin path, like `cms-admin`. Change
35
- the following configuration.
36
-
37
- config.admin_route_prefix = 'cms-admin'
38
-
39
- By default blog posts are served from the root. If you want to section off blog content
40
- to a `/blog` path. Adjust this configuration:
41
-
42
- config.public_route_prefix = 'blog'
43
-
44
- Provided views to display blog posts are pretty basic and you'll probably want to change
45
- them right away. You can change the layout from the default `application` to something else.
46
-
47
- config.public_layout = 'blog'
48
-
49
- Since ComfyBlog is an engine, it allows you to completely overwrite views. It's enough to
50
- create `app/views/blog/posts/index.html.erb` (could be HAML or whatever you want) and structure
51
- it in any way you want. There's also `show.html.erb` and `_post.html.erb` available.
52
-
53
- Pagination is done using either [WillPaginate](https://github.com/mislav/will_paginate) or [Kaminari](https://github.com/amatsuda/kaminari). Add either in your Gemfile.
54
- You can control number of posts per page by adjusting this config:
55
-
56
- config.posts_per_page = 10
57
-
58
- Posted comments will be sitting in the queue waiting to be published. You can auto publish them
59
- by setting this to `true`:
60
-
61
- config.auto_publish_comments = true
62
-
63
- You can use Disqus to manage comments by setting the following config:
25
+ Take a look inside your `config/routes.rb` file and you should see following lines there:
64
26
 
65
- config.disqus_shortname = 'forum_shortname'
27
+ ```ruby
28
+ ComfyBlog::Routing.admin :path => 'admin'
29
+ ComfyBlog::Routing.content :path => 'blog'
30
+ ```
66
31
 
32
+ You should also find view templates in `/app/views/blog` folder. Feel free to adjust them as you see fit.
67
33
 
68
- ComfyBlog is released under the [MIT license](https://github.com/comfy/comfy-blog/raw/master/LICENSE)
34
+ ---
69
35
 
70
- Copyright 2012 Oleg Khabarov, [The Working Group Inc](http://www.twg.ca)
36
+ Copyright 2009-2013 Oleg Khabarov, [The Working Group Inc](http://www.twg.ca)
data/Rakefile CHANGED
@@ -1,21 +1,24 @@
1
- require File.expand_path('../config/application', __FILE__)
2
- require 'rubygems'
3
- require 'rake'
1
+ require_relative 'config/application'
4
2
 
5
3
  ComfyBlog::Application.load_tasks
6
4
 
7
- begin
8
- require 'jeweler'
9
- Jeweler::Tasks.new do |gem|
10
- gem.name = 'comfy_blog'
11
- gem.homepage = 'http://github.com/comfy/comfy-blog'
12
- gem.license = 'MIT'
13
- gem.summary = 'ComfyBlog is a blog engine for Rails 3.1 apps (and ComfortableMexicanSofa)'
14
- gem.description = ''
15
- gem.email = 'oleg@twg.ca'
16
- gem.authors = ['Oleg Khabarov', 'The Working Group Inc.']
5
+ namespace :test do
6
+
7
+ Rake::TestTask.new(:lib) do |t|
8
+ t.libs << 'test'
9
+ t.pattern = 'test/lib/**/*_test.rb'
10
+ t.verbose = true
17
11
  end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
12
+
13
+ Rake::TestTask.new(:generators) do |t|
14
+ t.libs << 'test'
15
+ t.pattern = 'test/generators/**/*_test.rb'
16
+ t.verbose = true
17
+ end
18
+
19
+ end
20
+
21
+ Rake::Task[:test].enhance do
22
+ Rake::Task['test:lib'].invoke
23
+ Rake::Task['test:generators'].invoke
21
24
  end
@@ -1,3 +1,12 @@
1
- class Admin::Blog::BaseController < ComfyBlog.config.admin_controller.to_s.constantize
2
- # ...
1
+ class Admin::Blog::BaseController < Admin::Cms::BaseController
2
+
3
+ protected
4
+
5
+ def load_blog
6
+ @blog = @site.blogs.find(params[:blog_id] || params[:id])
7
+ rescue ActiveRecord::RecordNotFound
8
+ flash[:error] = 'Blog not found'
9
+ redirect_to admin_blogs_path(@site)
10
+ end
11
+
3
12
  end
@@ -0,0 +1,51 @@
1
+ class Admin::Blog::BlogsController < Admin::Blog::BaseController
2
+
3
+ before_action :build_blog, :only => [:new, :create]
4
+ before_action :load_blog, :only => [:edit, :update, :destroy]
5
+
6
+ def index
7
+ @blogs = @site.blogs.page(params[:page])
8
+ end
9
+
10
+ def new
11
+ render
12
+ end
13
+
14
+ def edit
15
+ render
16
+ end
17
+
18
+ def create
19
+ @blog.save!
20
+ flash[:success] = 'Blog created'
21
+ redirect_to :action => :edit, :id => @blog
22
+ rescue ActiveRecord::RecordInvalid
23
+ flash.now[:error] = 'Failed to create Blog'
24
+ render :action => :new
25
+ end
26
+
27
+ def update
28
+ @blog.update_attributes!(blog_params)
29
+ flash[:success] = 'Blog updated'
30
+ redirect_to :action => :edit, :id => @blog
31
+ rescue ActiveRecord::RecordInvalid
32
+ flash.now[:error] = 'Failed to update Blog'
33
+ render :action => :edit
34
+ end
35
+
36
+ def destroy
37
+ @blog.destroy
38
+ flash[:success] = 'Blog deleted'
39
+ redirect_to :action => :index
40
+ end
41
+
42
+ protected
43
+
44
+ def build_blog
45
+ @blog = @site.blogs.new(blog_params)
46
+ end
47
+
48
+ def blog_params
49
+ params.fetch(:blog, {}).permit!
50
+ end
51
+ end
@@ -1,34 +1,33 @@
1
1
  class Admin::Blog::CommentsController < Admin::Blog::BaseController
2
2
 
3
- before_filter :load_post, :only => [:index]
4
- before_filter :load_comment, :only => [:destroy, :publish]
3
+ before_action :load_blog
4
+ before_action :load_comment, :only => [:destroy, :toggle_publish]
5
5
 
6
6
  def index
7
- @comments = @post ? @post.comments : Blog::Comment.all
7
+ @comments = if @post = @blog.posts.where(:id => params[:post_id]).first
8
+ @post.comments.page(params[:page])
9
+ else
10
+ @blog.comments.page(params[:page])
11
+ end
8
12
  end
9
-
13
+
10
14
  def destroy
11
15
  @comment.destroy
16
+ flash[:success] = 'Comment deleted'
17
+ redirect_to :action => :index
12
18
  end
13
19
 
14
- def publish
15
- @comment.update_attribute(:is_published, true)
20
+ def toggle_publish
21
+ @comment.update_attribute(:is_published, !@comment.is_published?)
16
22
  end
17
-
23
+
18
24
  protected
19
25
 
20
- def load_post
21
- return unless params[:post_id]
22
- @post = Blog::Post.find(params[:post_id])
23
- rescue ActiveRecord::RecordNotFound
24
- flash[:error] = 'Blog Post not found'
25
- redirect_to :action => :index
26
- end
27
-
28
26
  def load_comment
29
- @comment = Blog::Comment.find(params[:id])
27
+ @comment = @blog.comments.find(params[:id])
30
28
  rescue ActiveRecord::RecordNotFound
31
- # ... do nothing
29
+ flash[:error] = 'Comment not found'
30
+ redirect_to :action => :index
32
31
  end
33
32
 
34
33
  end
@@ -1,63 +1,63 @@
1
1
  class Admin::Blog::PostsController < Admin::Blog::BaseController
2
2
 
3
- before_filter :build_post, :only => [:new, :create]
4
- before_filter :load_post, :only => [:edit, :update, :destroy]
5
-
3
+ before_action :load_blog
4
+ before_action :build_post, :only => [:new, :create]
5
+ before_action :load_post, :only => [:edit, :update, :destroy]
6
+
6
7
  def index
7
- @posts = if defined? WillPaginate
8
- Blog::Post.paginate :page => params[:page]
9
- elsif defined? Kaminari
10
- Blog::Post.page params[:page]
11
- else
12
- Blog::Post.all
13
- end
8
+ @posts = @blog.posts.order(:published_at).page(params[:page])
14
9
  end
15
-
10
+
16
11
  def new
17
12
  render
18
13
  end
19
-
14
+
20
15
  def create
21
16
  @post.save!
22
- flash[:notice] = 'Blog Post created'
17
+ flash[:success] = 'Blog Post created'
23
18
  redirect_to :action => :edit, :id => @post
24
-
19
+
25
20
  rescue ActiveRecord::RecordInvalid
26
21
  flash.now[:error] = 'Failed to create Blog Post'
27
22
  render :action => :new
28
23
  end
29
-
24
+
30
25
  def edit
31
26
  render
32
27
  end
33
-
28
+
34
29
  def update
35
- @post.update_attributes!(params[:post])
36
- flash[:notice] = 'Blog Post updated'
30
+ @post.update_attributes!(post_params)
31
+ flash[:success] = 'Blog Post updated'
37
32
  redirect_to :action => :edit, :id => @post
38
-
33
+
39
34
  rescue ActiveRecord::RecordInvalid
40
35
  flash.now[:error] = 'Failed to update Blog Post'
41
36
  render :action => :edit
42
37
  end
43
-
38
+
44
39
  def destroy
45
40
  @post.destroy
46
- flash[:notice] = 'Blog Post removed'
41
+ flash[:success] = 'Blog Post removed'
47
42
  redirect_to :action => :index
48
43
  end
49
-
44
+
50
45
  protected
51
-
46
+
52
47
  def load_post
53
- @post = Blog::Post.find(params[:id])
48
+ @post = @blog.posts.find(params[:id])
54
49
  rescue ActiveRecord::RecordNotFound
55
50
  flash[:error] = 'Blog Post not found'
56
51
  redirect_to :action => :index
57
52
  end
58
-
53
+
59
54
  def build_post
60
- @post = Blog::Post.new(params[:post])
55
+ @post = @blog.posts.new(post_params)
56
+ @post.published_at ||= Time.zone.now
61
57
  end
62
58
 
59
+ def post_params
60
+ params.fetch(:post, {}).permit!
61
+ end
62
+
63
63
  end
@@ -0,0 +1,31 @@
1
+ class Blog::BaseController < Cms::BaseController
2
+
3
+ layout :set_blog_layout
4
+
5
+ before_action :load_blog
6
+
7
+ protected
8
+
9
+ def load_cms_site
10
+ super
11
+ if @cms_site.path.blank? && params[:cms_path].present?
12
+ raise ActionController::RoutingError.new('Site Not Found')
13
+ end
14
+ end
15
+
16
+ def load_blog
17
+ @blog = if @cms_site.blogs.count <= 1
18
+ @cms_site.blogs.first!
19
+ else
20
+ @cms_site.blogs.where(:path => params[:blog_path]).first!
21
+ end
22
+
23
+ rescue ActiveRecord::RecordNotFound
24
+ raise ActionController::RoutingError.new('Blog Not Found')
25
+ end
26
+
27
+ def set_blog_layout
28
+ @blog.app_layout
29
+ end
30
+
31
+ end