bcms_blog 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -12
- data/app/helpers/cms/blog_helper.rb +3 -0
- data/app/models/blog.rb +2 -1
- data/app/models/blog_comment.rb +3 -1
- data/app/models/blog_observer.rb +14 -10
- data/app/models/blog_post.rb +2 -2
- data/app/portlets/blog_post_portlet.rb +22 -2
- data/app/portlets/blog_posts_portlet.rb +4 -1
- data/app/views/cms/blog_comments/render.html.erb +1 -1
- data/app/views/partials/_blog_post.html.erb +2 -2
- data/app/views/portlets/blog_post/render.html.erb +7 -2
- data/doc/release_notes.txt +5 -2
- data/lib/bcms_blog/engine.rb +10 -0
- data/lib/bcms_blog/routes.rb +5 -7
- data/lib/bcms_blog.rb +1 -0
- data/lib/generators/bcms_blog/install/USAGE +10 -0
- data/lib/generators/bcms_blog/install/install_generator.rb +18 -0
- metadata +46 -93
- data/app/controllers/application_controller.rb +0 -10
- data/app/helpers/application_helper.rb +0 -3
- data/rails/init.rb +0 -8
- data/test/blog_test_helper.rb +0 -52
- data/test/factories.rb +0 -18
- data/test/functional/blog_controller_test.rb +0 -63
- data/test/functional/blog_post_controller_test.rb +0 -31
- data/test/functional/cms/blog_posts_controller_test.rb +0 -45
- data/test/functional/cms/blogs_controller_test.rb +0 -25
- data/test/performance/browsing_test.rb +0 -9
- data/test/test_helper.rb +0 -18
- data/test/test_logging.rb +0 -64
- data/test/unit/blog_comment_test.rb +0 -34
- data/test/unit/blog_observer_test.rb +0 -61
- data/test/unit/blog_post_test.rb +0 -43
- data/test/unit/blog_test.rb +0 -42
- data/test/unit/helpers/feeds_helper_test.rb +0 -4
data/README.markdown
CHANGED
@@ -19,23 +19,14 @@ The blog module installs like most other BrowserCMS modules (http://guides.brows
|
|
19
19
|
|
20
20
|
## Set up your application to use the module
|
21
21
|
|
22
|
-
### 1.
|
22
|
+
### 1. Install the module
|
23
23
|
|
24
|
-
|
25
|
-
config.gem "bcms_blog"
|
24
|
+
rails g cms:install bcms_blog
|
26
25
|
|
27
26
|
### 2. Run the following commands
|
28
27
|
|
29
|
-
script/generate browser_cms
|
30
28
|
rake db:migrate
|
31
|
-
|
32
|
-
### 3. Edit config/routes.rb
|
33
|
-
|
34
|
-
Make sure the routes.rb loads the blog routes.
|
35
|
-
|
36
|
-
map.routes_for_bcms_blog
|
37
|
-
map.routes_for_browser_cms
|
38
|
-
|
29
|
+
|
39
30
|
## Creating a Blog
|
40
31
|
|
41
32
|
* To get started, go to the Content Library and choose the Blog module in the left hand menu.
|
@@ -13,5 +13,8 @@ module Cms::BlogHelper
|
|
13
13
|
auto_discovery_link_tag(:rss, blog_feeds_url(:blog_id => blog), :title => "#{blog.name}")
|
14
14
|
end
|
15
15
|
|
16
|
+
def new_comment_path(portlet)
|
17
|
+
url_for(:controller=>"cms/portlet", :action=>"execute_handler", :id=>portlet.id, :handler=>"create_comment")
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
data/app/models/blog.rb
CHANGED
@@ -8,7 +8,7 @@ class Blog < ActiveRecord::Base
|
|
8
8
|
validates_presence_of :name
|
9
9
|
validates_uniqueness_of :name
|
10
10
|
|
11
|
-
|
11
|
+
scope :editable_by, lambda { |user|
|
12
12
|
if user.able_to?(:administrate)
|
13
13
|
{ }
|
14
14
|
else
|
@@ -91,4 +91,5 @@ class Blog < ActiveRecord::Base
|
|
91
91
|
def name_for_path
|
92
92
|
name.to_slug.gsub('-', '_')
|
93
93
|
end
|
94
|
+
|
94
95
|
end
|
data/app/models/blog_comment.rb
CHANGED
@@ -4,7 +4,9 @@ class BlogComment < ActiveRecord::Base
|
|
4
4
|
|
5
5
|
validates_presence_of :post_id, :author, :body
|
6
6
|
|
7
|
-
|
7
|
+
before_create :publish_if_comments_are_enabled
|
8
|
+
|
9
|
+
def publish_if_comments_are_enabled
|
8
10
|
self.published = true unless post.blog.moderate_comments?
|
9
11
|
end
|
10
12
|
|
data/app/models/blog_observer.rb
CHANGED
@@ -5,15 +5,21 @@ class BlogObserver < ActiveRecord::Observer
|
|
5
5
|
create_section_pages_and_routes
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def after_save(blog)
|
9
|
+
if blog.persisted?
|
10
|
+
blog.publish
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
# Can't use before_update since CMS callback stack is altered from normal callbacks.
|
15
|
+
def before_save(blog)
|
16
|
+
if blog.persisted?
|
17
|
+
update_section_pages_and_route(blog)
|
18
|
+
end
|
14
19
|
end
|
15
|
-
|
20
|
+
|
16
21
|
private
|
22
|
+
|
17
23
|
# A section, two pages, 6 routes and a portlet are created alongside every blog.
|
18
24
|
# This structure provides sensible defaults so users can pretty much start adding
|
19
25
|
# posts right after creating a blog without having to worry about where to put
|
@@ -37,9 +43,7 @@ class BlogObserver < ActiveRecord::Observer
|
|
37
43
|
:path => "/#{@blog.name_for_path}",
|
38
44
|
:parent_id => 1
|
39
45
|
)
|
40
|
-
@section.
|
41
|
-
@section.groups << Group.find_by_code("guest")
|
42
|
-
@section.groups << Group.find_by_code("content-editor")
|
46
|
+
@section.allow_groups = :all
|
43
47
|
@section.save!
|
44
48
|
@section
|
45
49
|
)
|
@@ -106,12 +110,12 @@ class BlogObserver < ActiveRecord::Observer
|
|
106
110
|
end
|
107
111
|
|
108
112
|
def reload_routes
|
109
|
-
|
113
|
+
PageRoute.reload_routes
|
110
114
|
end
|
111
115
|
|
112
116
|
def create_route(page, name, pattern)
|
113
117
|
route = page.page_routes.build(:name => name, :pattern => pattern, :code => "")
|
114
|
-
route.
|
118
|
+
route.save!
|
115
119
|
route.add_condition(:method, "get").save
|
116
120
|
route.add_requirement(:year, '\d{4,}') if pattern.include?(":year")
|
117
121
|
route.add_requirement(:month, '\d{2,}') if pattern.include?(":month")
|
data/app/models/blog_post.rb
CHANGED
@@ -26,13 +26,13 @@ class BlogPost < ActiveRecord::Base
|
|
26
26
|
before_validation :set_slug
|
27
27
|
validates_presence_of :name, :slug, :blog_id, :author_id
|
28
28
|
|
29
|
-
|
29
|
+
scope :published_between, lambda { |start, finish|
|
30
30
|
{ :conditions => [
|
31
31
|
"blog_posts.published_at >= ? AND blog_posts.published_at < ?",
|
32
32
|
start, finish ] }
|
33
33
|
}
|
34
34
|
|
35
|
-
|
35
|
+
scope :not_tagged_with, lambda { |tag| {
|
36
36
|
:conditions => [
|
37
37
|
"blog_posts.id not in (
|
38
38
|
SELECT taggings.taggable_id FROM taggings
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class BlogPostPortlet < Portlet
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
enable_template_editor false
|
4
4
|
|
5
5
|
def render
|
6
6
|
scope = Blog.find(self.blog_id).posts
|
@@ -16,6 +16,8 @@ class BlogPostPortlet < Portlet
|
|
16
16
|
raise BlogPost::INCORRECT_PARAMETERS
|
17
17
|
end
|
18
18
|
|
19
|
+
make_page_title_use_blog_post_name(@blog_post)
|
20
|
+
|
19
21
|
pmap = flash[instance_name] || params
|
20
22
|
pmap[:blog_comment] ||= {}
|
21
23
|
|
@@ -24,6 +26,8 @@ class BlogPostPortlet < Portlet
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def create_comment
|
29
|
+
work_around_cms_3_3_bug_where_current_user_is_not_correctly_set
|
30
|
+
|
27
31
|
params[:blog_comment].merge! :ip => request.remote_ip
|
28
32
|
blog_comment = BlogComment.new(params[:blog_comment])
|
29
33
|
if blog_comment.valid? && blog_comment.save
|
@@ -34,5 +38,21 @@ class BlogPostPortlet < Portlet
|
|
34
38
|
url_for_failure
|
35
39
|
end
|
36
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def work_around_cms_3_3_bug_where_current_user_is_not_correctly_set
|
45
|
+
User.current = current_user
|
46
|
+
end
|
47
|
+
|
48
|
+
# This is a work around for a bug in bcms 3.3 where the Cms::PageHeler#page_title doesnt
|
49
|
+
# share state between the portlet view and the page view.
|
50
|
+
# When the portlet view (app/views/portlets/blog_post/render) calls 'page_title @post.name'
|
51
|
+
# that instance variable isn't shared back to the page template.
|
52
|
+
# Instead, we just temporarily set the name of the page itself.
|
53
|
+
def make_page_title_use_blog_post_name(post)
|
54
|
+
page = @controller.current_page
|
55
|
+
page.name = post.name
|
56
|
+
end
|
37
57
|
|
38
58
|
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<%= link_to h(@content_block.post.name), cms_blog_post_path(@content_block.post) %>
|
2
|
-
<p><%=h @content_block.body %></p>
|
2
|
+
<p><%=h @content_block.body.html_safe %></p>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
<div class="body">
|
22
22
|
<% if showing_individual_post or blog_post.summary.blank? %>
|
23
|
-
<%= blog_post.body %>
|
23
|
+
<%= blog_post.body.html_safe %>
|
24
24
|
<% else %>
|
25
25
|
<%= blog_post.summary %>
|
26
26
|
<p class="read_more">
|
@@ -38,7 +38,7 @@
|
|
38
38
|
<% if blog_post.tags.any? %>
|
39
39
|
Tags:
|
40
40
|
<span class="tags">
|
41
|
-
<%= blog_post.tags.map{|t| link_to(h(t.name), _blog_path(blog_post.blog, 'posts_with_tag', :tag => t.name)) }.join(", ") %>
|
41
|
+
<%= blog_post.tags.map{|t| link_to(h(t.name), _blog_path(blog_post.blog, 'posts_with_tag', :tag => t.name)) }.join(", ").html_safe %>
|
42
42
|
</span>
|
43
43
|
<strong>|</strong>
|
44
44
|
<% end %>
|
@@ -1,10 +1,15 @@
|
|
1
|
+
<%
|
2
|
+
logger.warn "Page title is: #{page_title}"
|
3
|
+
page_title "SOMETHING ELSE"
|
4
|
+
logger.warn "Now it's #{page_title}"
|
5
|
+
%>
|
1
6
|
<% page_title @blog_post.name %>
|
2
7
|
<%= render :partial => "partials/blog_post", :object => @blog_post %>
|
3
8
|
|
4
9
|
<div class="blog_comment_form">
|
5
|
-
|
10
|
+
<%= form_for @blog_comment, :url => new_comment_path(@portlet) do |f| %>
|
6
11
|
<%= f.hidden_field :post_id %>
|
7
|
-
<%= f.
|
12
|
+
<%= f.cms_error_messages %>
|
8
13
|
<div class="fields text_fields">
|
9
14
|
<%= f.label :author, 'Name *' %>
|
10
15
|
<%= f.text_field :author %>
|
data/doc/release_notes.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
v1.2.0
|
2
|
+
- Upgrade to be compatible with BrowserCMS 3.3 (aka Rails 3)
|
3
|
+
|
1
4
|
v1.1.1
|
2
5
|
|
3
6
|
- Blog partials and templates no longer include any css style declarations
|
@@ -5,7 +8,6 @@ v1.1.1
|
|
5
8
|
- Fixed bug on page route conditions and requirements when creating a blog
|
6
9
|
- Tests refactoring. Tests now depend on bcms_support gem
|
7
10
|
|
8
|
-
|
9
11
|
v1.1.0
|
10
12
|
|
11
13
|
This version introduces significant changes and improvements over version 1.0.0
|
@@ -42,4 +44,5 @@ https://browsermedia.lighthouseapp.com/projects/28481/tickets/163-review-and-int
|
|
42
44
|
Contributors:
|
43
45
|
=============
|
44
46
|
Tyler Rick
|
45
|
-
Jon Leighton
|
47
|
+
Jon Leighton
|
48
|
+
Juan Alvarez
|
data/lib/bcms_blog/routes.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
module Cms::Routes
|
2
2
|
def routes_for_bcms_blog
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
cms.content_blocks :blog_posts
|
9
|
-
cms.content_blocks :blog_comments
|
3
|
+
match '/blog/feeds', :to=>"feeds#index", :defaults=>{:format => "rss"}, :as=>'blog_feeds'
|
4
|
+
namespace(:cms) do
|
5
|
+
content_blocks :blogs
|
6
|
+
content_blocks :blog_posts
|
7
|
+
content_blocks :blog_comments
|
10
8
|
end
|
11
9
|
end
|
12
10
|
end
|
data/lib/bcms_blog.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cms/module_installation'
|
2
|
+
|
3
|
+
class BcmsBlog::InstallGenerator < Cms::ModuleInstallation
|
4
|
+
add_migrations_directory_to_source_root __FILE__
|
5
|
+
|
6
|
+
# Add migrations to be copied, by uncommenting the following file and editing as needed.
|
7
|
+
|
8
|
+
['20090415000001_create_blog_posts.rb', '20090415000000_create_blogs.rb', '20090415000002_create_blog_comments.rb',
|
9
|
+
'20090415000003_add_attachment_to_blog_posts.rb', '20100521042244_add_moderate_comments_to_blog.rb'].each do |mg|
|
10
|
+
copy_migration_file mg
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_helpers
|
14
|
+
append_to_file 'app/helpers/application_helper.rb', :after=>"module ApplicationHelper\n" do
|
15
|
+
" include Cms::BlogHelper\n"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,53 +1,39 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_blog
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 1.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- BrowserMedia
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
name: bcms_support
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2010-07-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: browsercms
|
16
|
+
requirement: &70330799771200 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
type: :development
|
34
|
-
version_requirements: *id001
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.3.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70330799771200
|
35
25
|
description: The Blog Module for BrowserCMS
|
36
26
|
email: github@browsermedia.com
|
37
27
|
executables: []
|
38
|
-
|
39
28
|
extensions: []
|
40
|
-
|
41
|
-
extra_rdoc_files:
|
29
|
+
extra_rdoc_files:
|
42
30
|
- LICENSE.txt
|
43
31
|
- README.markdown
|
44
|
-
files:
|
45
|
-
- app/controllers/application_controller.rb
|
32
|
+
files:
|
46
33
|
- app/controllers/cms/blog_comments_controller.rb
|
47
34
|
- app/controllers/cms/blog_posts_controller.rb
|
48
35
|
- app/controllers/cms/blogs_controller.rb
|
49
36
|
- app/controllers/feeds_controller.rb
|
50
|
-
- app/helpers/application_helper.rb
|
51
37
|
- app/helpers/cms/blog_helper.rb
|
52
38
|
- app/helpers/feeds_helper.rb
|
53
39
|
- app/models/blog.rb
|
@@ -72,79 +58,46 @@ files:
|
|
72
58
|
- app/views/portlets/blog_post/render.html.erb
|
73
59
|
- app/views/portlets/blog_posts/_form.html.erb
|
74
60
|
- app/views/portlets/blog_posts/render.html.haml
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.markdown
|
63
|
+
- doc/migrate_to_20100427.rb
|
64
|
+
- doc/README_FOR_APP
|
65
|
+
- doc/release_notes.txt
|
75
66
|
- db/migrate/20090415000000_create_blogs.rb
|
76
67
|
- db/migrate/20090415000001_create_blog_posts.rb
|
77
68
|
- db/migrate/20090415000002_create_blog_comments.rb
|
78
69
|
- db/migrate/20090415000003_add_attachment_to_blog_posts.rb
|
79
70
|
- db/migrate/20100521042244_add_moderate_comments_to_blog.rb
|
80
|
-
-
|
81
|
-
- doc/migrate_to_20100427.rb
|
82
|
-
- doc/release_notes.txt
|
83
|
-
- lib/bcms_blog.rb
|
71
|
+
- lib/bcms_blog/engine.rb
|
84
72
|
- lib/bcms_blog/routes.rb
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
|
89
|
-
- test/factories.rb
|
90
|
-
- test/functional/blog_controller_test.rb
|
91
|
-
- test/functional/blog_post_controller_test.rb
|
92
|
-
- test/functional/cms/blog_posts_controller_test.rb
|
93
|
-
- test/functional/cms/blogs_controller_test.rb
|
94
|
-
- test/performance/browsing_test.rb
|
95
|
-
- test/test_helper.rb
|
96
|
-
- test/test_logging.rb
|
97
|
-
- test/unit/blog_comment_test.rb
|
98
|
-
- test/unit/blog_observer_test.rb
|
99
|
-
- test/unit/blog_post_test.rb
|
100
|
-
- test/unit/blog_test.rb
|
101
|
-
- test/unit/helpers/feeds_helper_test.rb
|
102
|
-
has_rdoc: true
|
103
|
-
homepage: http://browsercms.org
|
73
|
+
- lib/bcms_blog.rb
|
74
|
+
- lib/generators/bcms_blog/install/install_generator.rb
|
75
|
+
- lib/generators/bcms_blog/install/USAGE
|
76
|
+
homepage: http://www.github.com/browsermedia/bcms_blog
|
104
77
|
licenses: []
|
105
|
-
|
106
78
|
post_install_message:
|
107
|
-
rdoc_options:
|
108
|
-
|
109
|
-
require_paths:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
110
81
|
- lib
|
111
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
83
|
none: false
|
113
|
-
requirements:
|
114
|
-
- -
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
|
117
|
-
segments:
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
segments:
|
118
89
|
- 0
|
119
|
-
|
120
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
hash: -3905715097688536829
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
92
|
none: false
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
126
|
-
segments:
|
127
|
-
- 0
|
128
|
-
version: "0"
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
129
97
|
requirements: []
|
130
|
-
|
131
|
-
|
132
|
-
rubygems_version: 1.3.7
|
98
|
+
rubyforge_project: bcms_blog
|
99
|
+
rubygems_version: 1.8.10
|
133
100
|
signing_key:
|
134
101
|
specification_version: 3
|
135
102
|
summary: The Blog Module for BrowserCMS
|
136
|
-
test_files:
|
137
|
-
- test/blog_test_helper.rb
|
138
|
-
- test/factories.rb
|
139
|
-
- test/functional/blog_controller_test.rb
|
140
|
-
- test/functional/blog_post_controller_test.rb
|
141
|
-
- test/functional/cms/blog_posts_controller_test.rb
|
142
|
-
- test/functional/cms/blogs_controller_test.rb
|
143
|
-
- test/performance/browsing_test.rb
|
144
|
-
- test/test_helper.rb
|
145
|
-
- test/test_logging.rb
|
146
|
-
- test/unit/blog_comment_test.rb
|
147
|
-
- test/unit/blog_observer_test.rb
|
148
|
-
- test/unit/blog_post_test.rb
|
149
|
-
- test/unit/blog_test.rb
|
150
|
-
- test/unit/helpers/feeds_helper_test.rb
|
103
|
+
test_files: []
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Filters added to this controller apply to all controllers in the application.
|
2
|
-
# Likewise, all the methods added will be available for all controllers.
|
3
|
-
|
4
|
-
class ApplicationController < ActionController::Base
|
5
|
-
helper :all # include all helpers, all the time
|
6
|
-
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
-
|
8
|
-
# Scrub sensitive parameters from your log
|
9
|
-
# filter_parameter_logging :password
|
10
|
-
end
|
data/rails/init.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
gem_root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
2
|
-
Cms.add_to_rails_paths gem_root
|
3
|
-
Cms.add_generator_paths gem_root, "db/migrate/[0-9]*_*.rb"
|
4
|
-
ApplicationHelper.module_eval { include Cms::BlogHelper }
|
5
|
-
|
6
|
-
config.after_initialize do
|
7
|
-
ActiveRecord::Base.observers << BlogObserver
|
8
|
-
end
|
data/test/blog_test_helper.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
module BlogTestHelper
|
2
|
-
|
3
|
-
# Seeds all data created by this module's migrations
|
4
|
-
def seed_blog_data
|
5
|
-
@content_type_group = ContentTypeGroup.create!(:name => "Blog")
|
6
|
-
CategoryType.create!(:name => "Blog Post")
|
7
|
-
ContentType.create!(:name => "Blog", :content_type_group => @content_type_group)
|
8
|
-
ContentType.create!(:name => "BlogPost", :content_type_group => @content_type_group)
|
9
|
-
ContentType.create!(:name => "BlogComment", :content_type_group => @content_type_group)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Creates data specifically used on tests
|
13
|
-
def create_test_data
|
14
|
-
template = %q[<% page_title @page_title || @blog.name %><%= render :partial => "partials/blog_post", :collection => @blog_posts %>"]
|
15
|
-
@blog = Blog.create!(:name => "MyBlog", :template => template)
|
16
|
-
|
17
|
-
@category_type = CategoryType.find_by_name("Blog Post")
|
18
|
-
|
19
|
-
@stuff = Category.create!(:name => "Stuff", :category_type => @category_type)
|
20
|
-
@general = Category.create!(:name => "General", :category_type => @category_type)
|
21
|
-
|
22
|
-
opts = {:blog => @blog, :publish_on_save => true}
|
23
|
-
@first_post = Factory(:blog_post, opts.merge(:category => @general, :published_at => Time.utc(2008, 7, 5, 6), :name => "The first Post"))
|
24
|
-
@foo_post_1 = Factory(:blog_post, opts.merge(:category => @stuff, :published_at => Time.utc(2008, 7, 5, 12), :tag_list => "foo stuff"))
|
25
|
-
@foo_post_2 = Factory(:blog_post, opts.merge(:category => @general, :published_at => Time.utc(2008, 7, 21)))
|
26
|
-
@bar_post_1 = Factory(:blog_post, opts.merge(:category => @stuff, :published_at => Time.utc(2008, 9, 2), :tag_list => "foo stuff"))
|
27
|
-
@bar_post_2 = Factory(:blog_post, opts.merge(:category => @general, :published_at => Time.utc(2009, 3, 18)))
|
28
|
-
|
29
|
-
publish_all_pages
|
30
|
-
end
|
31
|
-
|
32
|
-
def setup_blog_stubs
|
33
|
-
Blog.any_instance.stubs(:reload_routes)
|
34
|
-
@section = Section.new
|
35
|
-
Section.stubs(:create! => @section)
|
36
|
-
@section.stubs(:groups => [], :save! => true)
|
37
|
-
Page.stubs(:create! => Page.new)
|
38
|
-
Page.any_instance.stubs(:create_connector)
|
39
|
-
end
|
40
|
-
|
41
|
-
def create_group
|
42
|
-
@group = Factory(:group, :name => "Test", :group_type => Factory(:group_type, :name => "CMS User", :cms_access => true))
|
43
|
-
@group.permissions << Factory(:permission, :name => "edit_content")
|
44
|
-
@group.permissions << Factory(:permission, :name => "publish_content")
|
45
|
-
end
|
46
|
-
|
47
|
-
def create_user(opts = {})
|
48
|
-
create_group
|
49
|
-
@group.permissions << Factory(:permission, :name => "administrate") if opts[:admin]
|
50
|
-
@user = Factory(:user, :groups => [@group])
|
51
|
-
end
|
52
|
-
end
|
data/test/factories.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Factory.define :blog do |m|
|
2
|
-
m.sequence(:name) {|n| "TestBlog#{n}"}
|
3
|
-
m.moderate_comments true
|
4
|
-
end
|
5
|
-
|
6
|
-
Factory.define :blog_post do |m|
|
7
|
-
m.sequence(:name) { |n| "BlogPost#{n}" }
|
8
|
-
m.blog {|b| b.association(:blog) }
|
9
|
-
m.sequence(:body) { |n| "Lorem ipsum #{n}" }
|
10
|
-
m.association :author, :factory => :user
|
11
|
-
end
|
12
|
-
|
13
|
-
Factory.define :blog_comment do |m|
|
14
|
-
m.name "Just a comment"
|
15
|
-
m.body "Nice blog"
|
16
|
-
m.association :post, :factory => :blog_post
|
17
|
-
m.association :author, :factory => :user
|
18
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
-
|
3
|
-
class BlogControllerTest < ActionController::TestCase
|
4
|
-
tests Cms::ContentController
|
5
|
-
|
6
|
-
def setup
|
7
|
-
seed_bcms_data
|
8
|
-
seed_blog_data
|
9
|
-
create_test_data
|
10
|
-
end
|
11
|
-
|
12
|
-
test "displays the list of blog posts" do
|
13
|
-
get :show, :path => ['myblog']
|
14
|
-
|
15
|
-
assert_response :success
|
16
|
-
assert_select ".blog_post", 5
|
17
|
-
|
18
|
-
assert_select "#blog_post_#{@first_post.id}" do
|
19
|
-
assert_select "h2 a", @first_post.name
|
20
|
-
assert_select "div.body", @first_post.body
|
21
|
-
assert_select "div.meta" do
|
22
|
-
assert_select "a", 2
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_select "#blog_post_#{@foo_post_1.id}" do
|
27
|
-
assert_select "h2 a", @foo_post_1.name
|
28
|
-
assert_select "div.body", @foo_post_1.body
|
29
|
-
assert_select "div.meta .tags a", "foo"
|
30
|
-
assert_select "div.meta .tags a", "stuff"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
test "list of blog posts by category" do
|
35
|
-
get :show, :path => ['myblog'], :category => 'General'
|
36
|
-
assert_response :success
|
37
|
-
assert_select ".blog_post", 3
|
38
|
-
end
|
39
|
-
|
40
|
-
test "list of blog posts by tag" do
|
41
|
-
get :show, :path => ['myblog'], :tag => 'foo'
|
42
|
-
assert_response :success
|
43
|
-
assert_select ".blog_post", 2
|
44
|
-
end
|
45
|
-
|
46
|
-
test "list_of_blog_posts_in_day" do
|
47
|
-
get :show, :path => ["myblog"], :year => 2008, :month => 7, :day => 5
|
48
|
-
assert_response :success
|
49
|
-
assert_select ".blog_post", 2
|
50
|
-
end
|
51
|
-
|
52
|
-
test "list_of_blog_posts_in_month" do
|
53
|
-
get :show, :path => ["myblog"], :year => 2008, :month => 7
|
54
|
-
assert_response :success
|
55
|
-
assert_select ".blog_post", 3
|
56
|
-
end
|
57
|
-
|
58
|
-
test "list_of_blog_posts_in_year" do
|
59
|
-
get :show, :path => ["myblog"], :year => 2008
|
60
|
-
assert_response :success
|
61
|
-
assert_select ".blog_post", 4
|
62
|
-
end
|
63
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
-
|
3
|
-
class BlogPostControllerTest < ActionController::TestCase
|
4
|
-
tests Cms::ContentController
|
5
|
-
|
6
|
-
def setup
|
7
|
-
seed_bcms_data
|
8
|
-
seed_blog_data
|
9
|
-
create_test_data
|
10
|
-
end
|
11
|
-
|
12
|
-
test "show_post" do
|
13
|
-
get :show, :path => ['myblog', 'post'], :year => 2008, :month => 07, :day => 05, :slug => 'the-first-post'
|
14
|
-
assert_response :success
|
15
|
-
|
16
|
-
assert_select "title", @first_post.name
|
17
|
-
assert_select ".blog_post", 1
|
18
|
-
|
19
|
-
assert_select "#blog_post_#{@first_post.id}" do
|
20
|
-
assert_select "h2 a", @first_post.name
|
21
|
-
assert_select "div.body", @first_post.body
|
22
|
-
assert_select "div.meta a", "General"
|
23
|
-
assert_select "div.meta a", "0 Comments"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
test "non_existent_post_should_return_404" do
|
28
|
-
get :show, :path => ["myblog"], :year => 2005, :month => 6, :day => 14, :slug => "not-here"
|
29
|
-
assert_response :not_found
|
30
|
-
end
|
31
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
-
|
3
|
-
class Cms::BlogPostsControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
setup_blog_stubs
|
7
|
-
ContentType.create!(:name => 'BlogPost', :group_name => 'Blog')
|
8
|
-
login_as(create_user)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_access_denied_on_create_if_blog_not_user_editable
|
12
|
-
@editable = Factory(:blog, :groups => [@group])
|
13
|
-
@non_editable = Factory(:blog)
|
14
|
-
post :create, :blog_post => { :blog_id => @non_editable.id }
|
15
|
-
assert @response.body.include?("Access Denied")
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_access_denied_on_update_if_blog_not_user_editable
|
19
|
-
@editable = Factory.create(:blog, :groups => [@group])
|
20
|
-
@non_editable = Factory.create(:blog)
|
21
|
-
@blog_post = Factory.create(:blog_post, :blog => @non_editable)
|
22
|
-
put :update, :id => @blog_post, :blog_post => { :name => "Foo" }
|
23
|
-
assert @response.body.include?("Access Denied")
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_no_access_if_no_editable_blogs
|
27
|
-
@blog = Factory.create(:blog)
|
28
|
-
get :index
|
29
|
-
assert_template "no_access"
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_index_shouldnt_show_non_editable_posts
|
33
|
-
@editable = Factory.create(:blog, :groups => [@group])
|
34
|
-
@non_editable = Factory.create(:blog)
|
35
|
-
@blog_post = Factory.create(:blog_post, :name => "Non-editable", :blog => @non_editable)
|
36
|
-
get :index
|
37
|
-
assert !@response.body.include?("Non-editable")
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_create_sets_author
|
41
|
-
@blog = Factory.create(:blog, :groups => [@group])
|
42
|
-
post :create, :blog_post => { :blog_id => @blog.id }
|
43
|
-
assert_equal @user, assigns(:block).author
|
44
|
-
end
|
45
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
-
|
3
|
-
class Cms::BlogsControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
setup_blog_stubs
|
7
|
-
ContentType.create!(:name => 'Blog', :group_name => 'Blog')
|
8
|
-
Factory(:blog)
|
9
|
-
end
|
10
|
-
|
11
|
-
test "should allow access to admin users" do
|
12
|
-
login_as(create_user(:admin => true))
|
13
|
-
get :index
|
14
|
-
assert_response :success
|
15
|
-
assert assigns(:blocks)
|
16
|
-
assert_template("index")
|
17
|
-
end
|
18
|
-
|
19
|
-
test "should not allow access to non-admin users" do
|
20
|
-
login_as(create_user)
|
21
|
-
get :index
|
22
|
-
assert_response :success
|
23
|
-
assert_template("admin_only.html.erb")
|
24
|
-
end
|
25
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
-
require 'test_help'
|
4
|
-
require 'mocha'
|
5
|
-
require 'factory_girl'
|
6
|
-
require 'bcms_support'
|
7
|
-
require 'bcms_support/factories'
|
8
|
-
require 'blog_test_helper'
|
9
|
-
require 'test_logging'
|
10
|
-
|
11
|
-
class ActiveSupport::TestCase
|
12
|
-
include BcmsSupport::Test
|
13
|
-
include BlogTestHelper
|
14
|
-
include TestLogging
|
15
|
-
|
16
|
-
self.use_transactional_fixtures = true
|
17
|
-
self.use_instantiated_fixtures = false
|
18
|
-
end
|
data/test/test_logging.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
module TestLogging
|
2
|
-
def log(msg)
|
3
|
-
Rails.logger.info(msg)
|
4
|
-
end
|
5
|
-
|
6
|
-
def log_array(obj, *columns)
|
7
|
-
lengths = columns.map{|m| m.to_s.length }
|
8
|
-
|
9
|
-
obj.each do |r|
|
10
|
-
columns.each_with_index do |m, i|
|
11
|
-
v = r.send(m)
|
12
|
-
if v.to_s.length > lengths[i]
|
13
|
-
lengths[i] = v.to_s.length
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
str = " "
|
19
|
-
columns.each_with_index do |m, i|
|
20
|
-
str << "%#{lengths[i]}s" % m
|
21
|
-
str << " "
|
22
|
-
end
|
23
|
-
str << "\n "
|
24
|
-
|
25
|
-
columns.each_with_index do |m, i|
|
26
|
-
str << ("-"*lengths[i])
|
27
|
-
str << " "
|
28
|
-
end
|
29
|
-
str << "\n "
|
30
|
-
|
31
|
-
obj.each do |r|
|
32
|
-
columns.each_with_index do |m, i|
|
33
|
-
str << "%#{lengths[i]}s" % r.send(m)
|
34
|
-
str << " "
|
35
|
-
end
|
36
|
-
str << "\n "
|
37
|
-
end
|
38
|
-
|
39
|
-
log str
|
40
|
-
end
|
41
|
-
|
42
|
-
def log_table(cls, options={})
|
43
|
-
if options[:include_columns]
|
44
|
-
columns = options[:include_columns]
|
45
|
-
elsif options[:exclude_columns]
|
46
|
-
columns = cls.column_names - options[:exclude_columns].map(&:to_s)
|
47
|
-
else
|
48
|
-
columns = cls.column_names
|
49
|
-
end
|
50
|
-
log_array (cls.uses_soft_delete? ? cls.find_with_deleted(:all) : cls.all), *columns
|
51
|
-
end
|
52
|
-
|
53
|
-
def log_table_with(cls, *columns)
|
54
|
-
log_table(cls, :include_columns => columns)
|
55
|
-
end
|
56
|
-
|
57
|
-
def log_table_without(cls, *columns)
|
58
|
-
log_table(cls, :exclude_columns => columns)
|
59
|
-
end
|
60
|
-
|
61
|
-
def log_table_without_stamps(cls, *columns)
|
62
|
-
log_table(cls, :exclude_columns => %w[created_at updated_at created_by_id updated_by_id] + columns)
|
63
|
-
end
|
64
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
class BlogCommentTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
setup_blog_stubs
|
7
|
-
end
|
8
|
-
|
9
|
-
test "crates a valid instance" do
|
10
|
-
assert Factory.build(:blog_comment).valid?
|
11
|
-
end
|
12
|
-
|
13
|
-
test "requires post" do
|
14
|
-
assert Factory.build(:blog_comment, :post => nil).invalid?
|
15
|
-
end
|
16
|
-
|
17
|
-
test "requires author" do
|
18
|
-
assert Factory.build(:blog_comment, :author => nil).invalid?
|
19
|
-
end
|
20
|
-
|
21
|
-
test "requires body" do
|
22
|
-
assert Factory.build(:blog_comment, :body => nil).invalid?
|
23
|
-
end
|
24
|
-
|
25
|
-
test "should not be published if Blog#moderate_comments is true" do
|
26
|
-
assert !Factory(:blog_comment).published?
|
27
|
-
end
|
28
|
-
|
29
|
-
test "should be published if Blog#moderate_comments is false" do
|
30
|
-
blog = Factory(:blog, :moderate_comments => false)
|
31
|
-
post = Factory(:blog_post, :blog => blog)
|
32
|
-
assert Factory(:blog_comment, :post => post).published?
|
33
|
-
end
|
34
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class BlogObserverTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
setup_blog_stubs
|
7
|
-
[Section, PageRoute, Page].each {|klass| klass.stubs(:find_by_name)}
|
8
|
-
BlogPostPortlet.stubs(:create!)
|
9
|
-
@blog = Factory(:blog, :name => 'TestBlog')
|
10
|
-
end
|
11
|
-
|
12
|
-
test "does not update section, pageroute and pages if name did not change when updated" do
|
13
|
-
[Section, PageRoute, Page].each {|klass| klass.expects(:find_by_name).never}
|
14
|
-
@blog.toggle!(:moderate_comments)
|
15
|
-
end
|
16
|
-
|
17
|
-
test "updates section, pageroute and pages if name changed" do
|
18
|
-
route = mock('page_route', :update_attribute => true)
|
19
|
-
page = mock('page')
|
20
|
-
Section.expects(:find_by_name).returns(Section.new)
|
21
|
-
PageRoute.expects(:find_by_name).returns(route)
|
22
|
-
Page.expects(:find_by_name).twice.returns(page)
|
23
|
-
page.expects(:update_attribute).twice.returns(true)
|
24
|
-
page.expects(:publish).twice.returns(true)
|
25
|
-
|
26
|
-
@blog.update_attribute(:name, "OtherName")
|
27
|
-
end
|
28
|
-
|
29
|
-
test "should create a section with the same name and route" do
|
30
|
-
Section.expects(:create!).with(:name => 'Test', :path => '/test', :parent_id => 1).returns(@section)
|
31
|
-
Factory(:blog, :name => 'Test')
|
32
|
-
end
|
33
|
-
|
34
|
-
test "should create a hidden page with the same name in the section with the blog's name" do
|
35
|
-
Page.expects(:create!).with(:name => 'Test',
|
36
|
-
:path => '/test',
|
37
|
-
:section => @section,
|
38
|
-
:template_file_name => 'default.html.erb',
|
39
|
-
:hidden => true).returns(Page.new)
|
40
|
-
Factory(:blog, :name => 'Test')
|
41
|
-
end
|
42
|
-
|
43
|
-
test "should create a page to hold the BlogPostPortlet" do
|
44
|
-
Page.expects(:create!).with(:name => 'Test: Post',
|
45
|
-
:path => '/test/post',
|
46
|
-
:section => @section,
|
47
|
-
:template_file_name => 'default.html.erb',
|
48
|
-
:hidden => true).returns(Page.new)
|
49
|
-
Factory(:blog, :name => 'Test')
|
50
|
-
end
|
51
|
-
|
52
|
-
test "should create an instance of BlogPostPortlet" do
|
53
|
-
BlogPostPortlet.expects(:create!).with(:name => 'Test: Post Portlet',
|
54
|
-
:blog_id => 2,
|
55
|
-
:template => BlogPostPortlet.default_template,
|
56
|
-
:connect_to_page_id => nil,
|
57
|
-
:connect_to_container => 'main',
|
58
|
-
:publish_on_save => true).returns(BlogPostPortlet.new)
|
59
|
-
Factory(:blog, :name => 'Test')
|
60
|
-
end
|
61
|
-
end
|
data/test/unit/blog_post_test.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
class BlogPostTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
setup_blog_stubs
|
7
|
-
@post = Factory(:blog_post, :name => "This is the first Post")
|
8
|
-
end
|
9
|
-
|
10
|
-
test "cretates a valid instance" do
|
11
|
-
assert @post.valid?
|
12
|
-
end
|
13
|
-
|
14
|
-
test "requires name" do
|
15
|
-
assert Factory.build(:blog_post, :name => nil).invalid?
|
16
|
-
end
|
17
|
-
|
18
|
-
test "requires blog_id" do
|
19
|
-
assert Factory.build(:blog_post, :blog => nil).invalid?
|
20
|
-
end
|
21
|
-
|
22
|
-
test "requires author_id" do
|
23
|
-
assert Factory.build(:blog_post, :author => nil).invalid?
|
24
|
-
end
|
25
|
-
|
26
|
-
test "should set slug" do
|
27
|
-
assert_equal('this-is-the-first-post', @post.slug)
|
28
|
-
end
|
29
|
-
|
30
|
-
test "should set published_at when published" do
|
31
|
-
assert_nil @post.published_at
|
32
|
-
@post.publish!
|
33
|
-
assert_not_nil @post.published_at
|
34
|
-
end
|
35
|
-
|
36
|
-
test "BlogPost should find posts published between 2 given dates" do
|
37
|
-
@post.publish!
|
38
|
-
Factory(:blog_post, :published_at => 5.days.ago)
|
39
|
-
Factory(:blog_post, :published_at => 10.days.ago)
|
40
|
-
assert_equal(1, BlogPost.published_between(6.days.ago, 4.days.ago).count)
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
data/test/unit/blog_test.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
class BlogTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
setup_blog_stubs
|
7
|
-
@blog = Factory(:blog, :name => 'TestBlog')
|
8
|
-
end
|
9
|
-
|
10
|
-
test "creates a valid instance" do
|
11
|
-
assert @blog.valid?
|
12
|
-
end
|
13
|
-
|
14
|
-
test "requires name" do
|
15
|
-
assert Factory.build(:blog, :name => nil).invalid?
|
16
|
-
end
|
17
|
-
|
18
|
-
test "should be editable by user" do
|
19
|
-
group = Factory(:group, :group_type => Factory(:group_type,:cms_access => true))
|
20
|
-
user = Factory(:user, :groups => [group])
|
21
|
-
blog = Factory.build(:blog, :groups => [group])
|
22
|
-
assert blog.editable_by?(user)
|
23
|
-
assert !@blog.editable_by?(user)
|
24
|
-
end
|
25
|
-
|
26
|
-
test "should be editable by administrators" do
|
27
|
-
admin = Factory(:user)
|
28
|
-
admin.expects(:able_to?).with(:administrate).returns(true)
|
29
|
-
assert @blog.editable_by?(admin)
|
30
|
-
end
|
31
|
-
|
32
|
-
test "should create an instance of BlogPostPortlet" do
|
33
|
-
BlogPostPortlet.expects(:create!).with(:name => 'Test: Post Portlet',
|
34
|
-
:blog_id => 2,
|
35
|
-
:template => BlogPostPortlet.default_template,
|
36
|
-
:connect_to_page_id => nil,
|
37
|
-
:connect_to_container => 'main',
|
38
|
-
:publish_on_save => true).returns(BlogPostPortlet.new)
|
39
|
-
Factory(:blog, :name => 'Test')
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|