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.
Files changed (39) hide show
  1. data/COPYRIGHT.txt +23 -0
  2. data/GPL.txt +674 -0
  3. data/Gemfile +6 -0
  4. data/README.markdown +1 -2
  5. data/app/assets/javascripts/bcms_page_comments/application.js +15 -0
  6. data/app/assets/stylesheets/application.css +13 -0
  7. data/app/assets/stylesheets/bcms_page_comments/application.css +13 -0
  8. data/app/controllers/bcms_page_comments/application_controller.rb +4 -0
  9. data/app/controllers/bcms_page_comments/page_comments_controller.rb +4 -0
  10. data/app/controllers/page_comments_controller.rb +1 -1
  11. data/app/helpers/bcms_page_comments/application_helper.rb +4 -0
  12. data/app/models/bcms_page_comments/page_comment.rb +12 -0
  13. data/app/portlets/most_commented_on_portlet.rb +5 -5
  14. data/app/portlets/page_comments_portlet.rb +4 -3
  15. data/app/views/{cms → bcms_page_comments}/page_comments/_form.html.erb +1 -1
  16. data/app/views/{cms → bcms_page_comments}/page_comments/render.html.erb +0 -0
  17. data/app/views/portlets/page_comments/_form.html.erb +1 -1
  18. data/app/views/portlets/page_comments/render.html.erb +1 -2
  19. data/config/routes.rb +3 -0
  20. data/db/bcms_page_comments.seeds.rb +1 -0
  21. data/db/migrate/20090417155756_create_page_comments.rb +1 -10
  22. data/db/migrate/20120703173145_update_to_2_0_0.rb +9 -0
  23. data/lib/bcms_page_comments.rb +5 -1
  24. data/lib/bcms_page_comments/engine.rb +11 -0
  25. data/lib/bcms_page_comments/route_extensions.rb +8 -0
  26. data/lib/bcms_page_comments/version.rb +3 -0
  27. data/lib/generators/bcms_page_comments/install/USAGE +3 -0
  28. data/lib/generators/bcms_page_comments/install/install_generator.rb +21 -0
  29. data/lib/tasks/bcms_page_comments_tasks.rake +4 -0
  30. metadata +80 -49
  31. data/app/controllers/application_controller.rb +0 -10
  32. data/app/controllers/cms/page_comments_controller.rb +0 -2
  33. data/app/helpers/application_helper.rb +0 -3
  34. data/app/models/page_comment.rb +0 -11
  35. data/lib/bcms_page_comments/routes.rb +0 -13
  36. data/rails/init.rb +0 -3
  37. data/test/performance/browsing_test.rb +0 -9
  38. data/test/test_helper.rb +0 -38
  39. data/test/unit/portlets/most_commented_on_portlet_test.rb +0 -62
@@ -1,2 +0,0 @@
1
- class Cms::PageCommentsController < Cms::ContentBlockController
2
- end
@@ -1,3 +0,0 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
- module ApplicationHelper
3
- end
@@ -1,11 +0,0 @@
1
- class PageComment < ActiveRecord::Base
2
- acts_as_content_block
3
- belongs_to :page
4
-
5
- validates_presence_of :page_id
6
-
7
- named_scope :for_page, lambda{|p| {:conditions => ["page_comments.page_id = ?", p.id]}}
8
-
9
-
10
-
11
- end
@@ -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
@@ -1,3 +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"
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
- require 'performance_test_help'
3
-
4
- # Profiling results for each test method are written to tmp/performance.
5
- class BrowsingTest < ActionController::PerformanceTest
6
- def test_homepage
7
- get '/'
8
- end
9
- end
@@ -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