Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for BrowserCMS 3.5.x #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/models/bcms_blog/blog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def render
finder = posts.published_between(@date, @date + 1.year)
end

@blog_posts = finder.all(:limit => 25, :order => "published_at desc")
@blog_posts = finder.where(:published => true)
.where('published_at <= ?', DateTime.now)
.order('published_at DESC')
.limit(25)

raise ActiveRecord::RecordNotFound.new("No posts found") if @blog_posts.empty?

if params[:category]
Expand Down
2 changes: 1 addition & 1 deletion app/views/bcms_blog/blogs/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<label>Permissions</label>
<%= hidden_field_tag "blog[group_ids][]", "", :id => nil %>
<div class="checkboxes">
<% for group in Cms::Group.cms_access.all(:order => "groups.name") %>
<% for group in Cms::Group.cms_access.all(:order => 'cms_groups.name') %>
<div class="checkbox_fields">
<%= check_box_tag "blog[group_ids][]", group.id,
@block.groups.include?(group), :class => "cms_group_ids", :id => "cms_group_ids_#{group.id}", :tabindex => next_tabindex %>
Expand Down
8 changes: 4 additions & 4 deletions db/migrate/20090415000003_add_attachment_to_blog_posts.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
class AddAttachmentToBlogPosts < ActiveRecord::Migration
def self.up
change_table :blog_posts do |t|
change_table :cms_blog_posts do |t|
t.belongs_to :attachment
t.integer :attachment_version
end
change_table :blog_post_versions do |t|
change_table :cms_blog_post_versions do |t|
t.belongs_to :attachment
t.integer :attachment_version
end
end

def self.down
change_table :blog_posts do |t|
change_table :cms_blog_posts do |t|
t.remove :attachment
t.remove :attachment_version
end
change_table :blog_post_versions do |t|
change_table :cms_blog_post_versions do |t|
t.remove :attachment
t.remove :attachment_version
end
Expand Down
6 changes: 3 additions & 3 deletions db/migrate/20100521042244_add_moderate_comments_to_blog.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class AddModerateCommentsToBlog < ActiveRecord::Migration
def self.up
add_content_column :blogs, :moderate_comments, :boolean, :default => true
add_content_column :cms_blogs, :moderate_comments, :boolean, :default => true
end

def self.down
remove_column :blogs, :moderate_comments
remove_column :blog_versions, :moderate_comments
remove_column :cms_blogs, :moderate_comments
remove_column :cms_blog_versions, :moderate_comments
end
end
8 changes: 8 additions & 0 deletions db/migrate/20120529184028_v130.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# Upgrade this module to v1.3.0 of BcmsBlog (Rails 3.2/CMS 3.5.x compatible)
class V130 < ActiveRecord::Migration
def change

rename_table "cms_blogs", "blogs"
rename_table "cms_blog_versions", "blog_versions"
rename_table "cms_blog_posts", "blog_posts"
rename_table "cms_blog_post_versions", "blog_post_versions"
rename_table "cms_blog_comments", "blog_comments"
rename_table "cms_blog_comment_versions", "blog_comment_versions"

["Blog", "BlogPost", "BlogComment"].each do |model|
v3_5_0_apply_namespace_to_block("BcmsBlog", model)
end
Expand Down