Permalink
Browse files

* Can display comments

* Can link from from blog posts.
  • Loading branch information...
1 parent d3e2d3b commit f49374e2ebc2bfe13626f0fe84c803917e109e18 @peakpg peakpg committed May 30, 2012
@@ -6,7 +6,7 @@ def _blog_path(blog, route_name, route_params)
end
def _blog_post_path(blog_post)
- send("#{blog_post.route_name}_path", blog_post.route_params)
+ main_app.send("#{blog_post.route_name}_path", blog_post.route_params)
end
def feeds_link_tag_for(name)
@@ -18,5 +18,10 @@ def new_comment_params(portlet)
{:url=> Cms::Engine.routes.url_helpers.portlet_handler_path(:id=>portlet.id, :handler=>'create_comment'),
:method=>'post'}
end
+
+ # Cms::ViewContext doesn't expose this method correctly, so duplicating it here.
+ def main_app
+ Rails.application.routes.url_helpers
+ end
end
end
@@ -12,16 +12,16 @@ def publish_if_comments_are_enabled
end
def self.default_order
- "blog_comments.created_at desc"
+ "created_at desc"
end
def self.default_order_for_search
default_order
end
def self.columns_for_index
- [ {:label => "Comment", :method => :name, :order => "blog_comments.body" },
- {:label => "Created At", :method => :formatted_created_at, :order => "blog_comments.created_at"} ]
+ [ {:label => "Comment", :method => :name, :order => "body" },
+ {:label => "Created At", :method => :formatted_created_at, :order => "created_at"} ]
end
def name
@@ -1,4 +1,4 @@
-<%= f.cms_drop_down :post_id, BlogPost.all(:order => "name").map{|p| [p.name, p.id]} %>
+<%= f.cms_drop_down :post_id, BcmsBlog::BlogPost.all(:order => "name").map{|p| [p.name, p.id]} %>
<%= f.cms_text_field :author %>
<%= f.cms_text_field :email %>
<%= f.cms_text_field :url %>
@@ -1,2 +1,2 @@
-<%= link_to h(@content_block.post.name), cms_blog_post_path(@content_block.post) %>
+<%= link_to h(@content_block.post.name), _blog_post_path(@content_block.post) %>
<p><%=h @content_block.body.html_safe %></p>

0 comments on commit f49374e

Please sign in to comment.