bcms_page_comments 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYRIGHT.txt +23 -0
- data/GPL.txt +674 -0
- data/Gemfile +6 -0
- data/README.markdown +1 -2
- data/app/assets/javascripts/bcms_page_comments/application.js +15 -0
- data/app/assets/stylesheets/application.css +13 -0
- data/app/assets/stylesheets/bcms_page_comments/application.css +13 -0
- data/app/controllers/bcms_page_comments/application_controller.rb +4 -0
- data/app/controllers/bcms_page_comments/page_comments_controller.rb +4 -0
- data/app/controllers/page_comments_controller.rb +1 -1
- data/app/helpers/bcms_page_comments/application_helper.rb +4 -0
- data/app/models/bcms_page_comments/page_comment.rb +12 -0
- data/app/portlets/most_commented_on_portlet.rb +5 -5
- data/app/portlets/page_comments_portlet.rb +4 -3
- data/app/views/{cms → bcms_page_comments}/page_comments/_form.html.erb +1 -1
- data/app/views/{cms → bcms_page_comments}/page_comments/render.html.erb +0 -0
- data/app/views/portlets/page_comments/_form.html.erb +1 -1
- data/app/views/portlets/page_comments/render.html.erb +1 -2
- data/config/routes.rb +3 -0
- data/db/bcms_page_comments.seeds.rb +1 -0
- data/db/migrate/20090417155756_create_page_comments.rb +1 -10
- data/db/migrate/20120703173145_update_to_2_0_0.rb +9 -0
- data/lib/bcms_page_comments.rb +5 -1
- data/lib/bcms_page_comments/engine.rb +11 -0
- data/lib/bcms_page_comments/route_extensions.rb +8 -0
- data/lib/bcms_page_comments/version.rb +3 -0
- data/lib/generators/bcms_page_comments/install/USAGE +3 -0
- data/lib/generators/bcms_page_comments/install/install_generator.rb +21 -0
- data/lib/tasks/bcms_page_comments_tasks.rake +4 -0
- metadata +80 -49
- data/app/controllers/application_controller.rb +0 -10
- data/app/controllers/cms/page_comments_controller.rb +0 -2
- data/app/helpers/application_helper.rb +0 -3
- data/app/models/page_comment.rb +0 -11
- data/lib/bcms_page_comments/routes.rb +0 -13
- data/rails/init.rb +0 -3
- data/test/performance/browsing_test.rb +0 -9
- data/test/test_helper.rb +0 -38
- data/test/unit/portlets/most_commented_on_portlet_test.rb +0 -62
data/app/models/page_comment.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module Cms::Routes
|
2
|
-
def routes_for_bcms_page_comments
|
3
|
-
|
4
|
-
page_comments "/page_comments",
|
5
|
-
:controller => "page_comments",
|
6
|
-
:action => "create",
|
7
|
-
:conditions => {:method => :post}
|
8
|
-
|
9
|
-
namespace(:cms) do |cms|
|
10
|
-
cms.content_blocks :page_comments
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/rails/init.rb
DELETED
data/test/test_helper.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
-
require 'test_help'
|
4
|
-
|
5
|
-
class ActiveSupport::TestCase
|
6
|
-
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
-
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
-
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
-
# between every test method. Fewer database queries means faster tests.
|
10
|
-
#
|
11
|
-
# Read Mike Clark's excellent walkthrough at
|
12
|
-
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
-
#
|
14
|
-
# Every Active Record database supports transactions except MyISAM tables
|
15
|
-
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
-
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
-
# is recommended.
|
18
|
-
#
|
19
|
-
# The only drawback to using transactional fixtures is when you actually
|
20
|
-
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
-
# any transactions started in your code will be automatically rolled back.
|
22
|
-
self.use_transactional_fixtures = true
|
23
|
-
|
24
|
-
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
-
# would need people(:david). If you don't want to migrate your existing
|
26
|
-
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
-
# instantiated fixtures translates to a database query per test method),
|
28
|
-
# then set this back to true.
|
29
|
-
self.use_instantiated_fixtures = false
|
30
|
-
|
31
|
-
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
|
-
#
|
33
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
34
|
-
# -- they do not yet inherit this setting
|
35
|
-
fixtures :all
|
36
|
-
|
37
|
-
# Add more helper methods to be used by all tests here...
|
38
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '/../../test_helper')
|
2
|
-
|
3
|
-
class MostCommentedOnPortletTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def teardown
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
class StubPortlet
|
12
|
-
attr_accessor :number_to_show
|
13
|
-
end
|
14
|
-
|
15
|
-
test "Finds only a limited # of pages" do
|
16
|
-
build_pages
|
17
|
-
portlet = MostCommentedOnPortlet.new
|
18
|
-
|
19
|
-
portlet = MostCommentedOnPortlet.new
|
20
|
-
params = StubPortlet.new
|
21
|
-
params.number_to_show = 1
|
22
|
-
portlet.instance_variable_set(:@portlet, params)
|
23
|
-
|
24
|
-
portlet.render
|
25
|
-
|
26
|
-
assert_equal 1, portlet.instance_variable_get(:@pages).size
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
test "Find pages" do
|
34
|
-
build_pages
|
35
|
-
portlet = MostCommentedOnPortlet.new
|
36
|
-
|
37
|
-
pages = portlet.most_popular_pages(2)
|
38
|
-
assert_equal 2, pages.size
|
39
|
-
assert_equal @popular.name, pages[0].name
|
40
|
-
assert_equal "3", pages[0].comments_count
|
41
|
-
assert_equal "/popular", pages[0].path
|
42
|
-
|
43
|
-
assert_equal @middle.name, pages[1].name
|
44
|
-
assert_equal "/middle", pages[1].path
|
45
|
-
end
|
46
|
-
private
|
47
|
-
|
48
|
-
def build_pages
|
49
|
-
@lonely = Page.create!(:name => "Lonely", :path=>"/lonely")
|
50
|
-
@popular = Page.create!(:name => "Popular", :path=>"/popular")
|
51
|
-
@middle = Page.create!(:name => "Middle", :path=>"/middle")
|
52
|
-
|
53
|
-
PageComment.create!(:page=>@lonely)
|
54
|
-
|
55
|
-
PageComment.create!(:page=>@middle)
|
56
|
-
PageComment.create!(:page=>@middle)
|
57
|
-
|
58
|
-
PageComment.create!(:page=>@popular)
|
59
|
-
PageComment.create!(:page=>@popular)
|
60
|
-
PageComment.create!(:page=>@popular)
|
61
|
-
end
|
62
|
-
end
|