comfy_blog 1.1.1 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +3 -3
- data/app/controllers/{admin → comfy/admin}/blog/base_controller.rb +2 -2
- data/app/controllers/{admin → comfy/admin}/blog/blogs_controller.rb +1 -1
- data/app/controllers/{admin → comfy/admin}/blog/comments_controller.rb +1 -1
- data/app/controllers/{admin → comfy/admin}/blog/posts_controller.rb +2 -1
- data/app/controllers/{blog → comfy/blog}/base_controller.rb +1 -1
- data/app/controllers/{blog → comfy/blog}/comments_controller.rb +4 -4
- data/app/controllers/{blog → comfy/blog}/posts_controller.rb +1 -1
- data/app/models/{blog → comfy/blog}/blog.rb +4 -2
- data/app/models/{blog → comfy/blog}/comment.rb +2 -2
- data/app/models/{blog → comfy/blog}/post.rb +2 -2
- data/app/views/{admin → comfy/admin}/blog/blogs/_form.html.haml +2 -2
- data/app/views/{admin → comfy/admin}/blog/blogs/edit.html.haml +0 -0
- data/app/views/comfy/admin/blog/blogs/index.html.haml +26 -0
- data/app/views/{admin → comfy/admin}/blog/blogs/new.html.haml +0 -0
- data/app/views/comfy/admin/blog/comments/_comment.html.haml +17 -0
- data/app/views/{admin → comfy/admin}/blog/comments/index.html.haml +1 -1
- data/app/views/{admin → comfy/admin}/blog/comments/toggle_publish.js.erb +0 -0
- data/app/views/comfy/admin/blog/partials/_navigation.html.haml +6 -0
- data/app/views/{admin → comfy/admin}/blog/posts/_form.html.haml +4 -3
- data/app/views/{admin → comfy/admin}/blog/posts/edit.html.haml +0 -0
- data/app/views/comfy/admin/blog/posts/index.html.haml +32 -0
- data/app/views/{admin → comfy/admin}/blog/posts/new.html.haml +0 -0
- data/app/views/{blog → comfy/blog}/comments/_form.html.haml +1 -1
- data/app/views/{blog → comfy/blog}/posts/index.html.haml +1 -1
- data/app/views/{blog → comfy/blog}/posts/index.rss.builder +2 -2
- data/app/views/{blog → comfy/blog}/posts/show.html.haml +1 -1
- data/app/views/layouts/{blog → comfy/blog}/application.html.haml +0 -0
- data/comfy_blog.gemspec +2 -2
- data/config/application.rb +2 -0
- data/config/initializers/comfy_blog.rb +6 -3
- data/db/migrate/00_create_cms.rb +41 -39
- data/db/migrate/01_create_blog.rb +13 -13
- data/lib/comfy_blog/configuration.rb +7 -3
- data/lib/comfy_blog/engine.rb +2 -2
- data/lib/comfy_blog/routes/blog.rb +10 -8
- data/lib/comfy_blog/routes/blog_admin.rb +8 -6
- data/lib/comfy_blog/version.rb +1 -1
- data/lib/generators/comfy/blog/blog_generator.rb +1 -1
- data/test/controllers/{admin → comfy/admin}/blog/blogs_controller_test.rb +8 -8
- data/test/controllers/{admin → comfy/admin}/blog/comments_controller_test.rb +7 -7
- data/test/controllers/{admin → comfy/admin}/blog/posts_controller_test.rb +16 -8
- data/test/controllers/{blog → comfy/blog}/comments_controller_test.rb +8 -8
- data/test/controllers/{blog → comfy/blog}/posts_controller_test.rb +5 -5
- data/test/fixtures/{blog → comfy/blog}/blogs.yml +1 -1
- data/test/fixtures/{blog → comfy/blog}/comments.yml +0 -0
- data/test/fixtures/{blog → comfy/blog}/posts.yml +0 -0
- data/test/fixtures/{cms → comfy/cms}/sites.yml +0 -0
- data/test/generators/blog_generator_test.rb +1 -1
- data/test/lib/configuration_test.rb +4 -3
- data/test/models/{blog/blog_test.rb → blog_test.rb} +10 -10
- data/test/models/{blog/comments_test.rb → comments_test.rb} +9 -9
- data/test/models/{blog/posts_test.rb → posts_test.rb} +19 -19
- data/test/test_helper.rb +3 -2
- metadata +45 -46
- data/app/views/admin/blog/blogs/index.html.haml +0 -26
- data/app/views/admin/blog/comments/_comment.html.haml +0 -17
- data/app/views/admin/blog/partials/_navigation.html.haml +0 -6
- data/app/views/admin/blog/posts/index.html.haml +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7395a14952fcacabf530dc7b573c72661a329114
|
4
|
+
data.tar.gz: 30faa016ab88ad1f66a553d3b1328b93cb58dcd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e34806a569da33f7f884925ed2a855714389ed274a5ec972a6e24c73120365409d49ac41b2cd568f21f3b0f1f63dc6e3d0330e5ac7b4c18ba9eead9293b697
|
7
|
+
data.tar.gz: 6ba09ab8175ccb2e036c120de7c29ac1b6a4091f5987920d790fda058aba2c65c276edffb393880b182298405987bd1bbd55e20914c897e0cd3bf3d8b8dcd042
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# ComfyBlog
|
2
2
|
[](http://rubygems.org/gems/comfy_blog) [](http://travis-ci.org/comfy/comfy-blog) [](https://gemnasium.com/comfy/comfy-blog) [](https://codeclimate.com/github/comfy/comfy-blog) [](https://coveralls.io/r/comfy/comfy-blog)
|
3
3
|
|
4
|
-
ComfyBlog is an simple blog management engine for [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
|
4
|
+
ComfyBlog is an simple blog management engine for [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
|
5
5
|
|
6
6
|
## Features
|
7
7
|
|
@@ -13,7 +13,7 @@ ComfyBlog is an simple blog management engine for [ComfortableMexicanSofa](https
|
|
13
13
|
Add gem definition to your Gemfile:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'comfy_blog', '~> 1.
|
16
|
+
gem 'comfy_blog', '~> 1.12.0'
|
17
17
|
```
|
18
18
|
|
19
19
|
Then from the Rails project's root run:
|
@@ -33,4 +33,4 @@ You should also find view templates in `/app/views/blog` folder. Feel free to ad
|
|
33
33
|
|
34
34
|
---
|
35
35
|
|
36
|
-
Copyright 2009-
|
36
|
+
Copyright 2009-2014 Oleg Khabarov
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Admin::Blog::BaseController < Admin::Cms::BaseController
|
1
|
+
class Comfy::Admin::Blog::BaseController < Comfy::Admin::Cms::BaseController
|
2
2
|
|
3
3
|
protected
|
4
4
|
|
@@ -6,7 +6,7 @@ protected
|
|
6
6
|
@blog = @site.blogs.find(params[:blog_id] || params[:id])
|
7
7
|
rescue ActiveRecord::RecordNotFound
|
8
8
|
flash[:error] = 'Blog not found'
|
9
|
-
redirect_to
|
9
|
+
redirect_to comfy_admin_blogs_path(@site)
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Admin::Blog::PostsController < Admin::Blog::BaseController
|
1
|
+
class Comfy::Admin::Blog::PostsController < Comfy::Admin::Blog::BaseController
|
2
2
|
|
3
3
|
before_action :load_blog
|
4
4
|
before_action :build_post, :only => [:new, :create]
|
@@ -9,6 +9,7 @@ class Admin::Blog::PostsController < Admin::Blog::BaseController
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def new
|
12
|
+
@post.author = ComfyBlog.config.default_author
|
12
13
|
render
|
13
14
|
end
|
14
15
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Blog::CommentsController < Blog::BaseController
|
1
|
+
class Comfy::Blog::CommentsController < Comfy::Blog::BaseController
|
2
2
|
|
3
3
|
before_action :load_post,
|
4
4
|
:build_comment
|
@@ -7,11 +7,11 @@ class Blog::CommentsController < Blog::BaseController
|
|
7
7
|
@comment.save!
|
8
8
|
|
9
9
|
flash[:success] = 'Comment created'
|
10
|
-
redirect_to
|
10
|
+
redirect_to comfy_blog_post_path(@cms_site.path, @blog.path, @post.slug)
|
11
11
|
|
12
12
|
rescue ActiveRecord::RecordInvalid
|
13
13
|
flash[:error] = 'Failed to create Comment'
|
14
|
-
render 'blog/posts/show'
|
14
|
+
render 'comfy/blog/posts/show'
|
15
15
|
end
|
16
16
|
|
17
17
|
protected
|
@@ -20,7 +20,7 @@ protected
|
|
20
20
|
@post = @blog.posts.published.where(:slug => params[:slug]).first!
|
21
21
|
rescue ActiveRecord::RecordNotFound
|
22
22
|
flash[:error] = 'Blog Post not found'
|
23
|
-
redirect_to
|
23
|
+
redirect_to comfy_blog_posts_path(@cms_site.path, @blog.path)
|
24
24
|
end
|
25
25
|
|
26
26
|
def build_comment
|
@@ -1,7 +1,9 @@
|
|
1
|
-
class Blog::Blog < ActiveRecord::Base
|
1
|
+
class Comfy::Blog::Blog < ActiveRecord::Base
|
2
|
+
|
3
|
+
self.table_name = 'comfy_blogs'
|
2
4
|
|
3
5
|
# -- Relationhips ---------------------------------------------------------
|
4
|
-
belongs_to :site, :class_name => 'Cms::Site'
|
6
|
+
belongs_to :site, :class_name => 'Comfy::Cms::Site'
|
5
7
|
|
6
8
|
has_many :posts,
|
7
9
|
:dependent => :destroy
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class Blog::Comment < ActiveRecord::Base
|
1
|
+
class Comfy::Blog::Comment < ActiveRecord::Base
|
2
2
|
|
3
|
-
self.table_name = '
|
3
|
+
self.table_name = 'comfy_blog_comments'
|
4
4
|
|
5
5
|
# -- Relationships --------------------------------------------------------
|
6
6
|
belongs_to :post
|
@@ -2,10 +2,10 @@
|
|
2
2
|
= form.text_field :identifier, :data => {:slug => true}
|
3
3
|
= form.text_field :path
|
4
4
|
|
5
|
-
- if (options = Cms::Layout.app_layouts_for_select).present?
|
5
|
+
- if (options = Comfy::Cms::Layout.app_layouts_for_select).present?
|
6
6
|
= form.select :app_layout, options
|
7
7
|
|
8
8
|
= form.text_area :description, :class => 'short'
|
9
9
|
|
10
|
-
.form-actions
|
10
|
+
= form.form_group :class => 'form-actions' do
|
11
11
|
= form.submit :class => 'btn btn-primary'
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.page-header
|
2
|
+
= link_to 'New Blog', new_comfy_admin_blog_path(@site), :class => 'btn btn-default pull-right'
|
3
|
+
%h2 Blogs
|
4
|
+
|
5
|
+
= paginate @blogs
|
6
|
+
|
7
|
+
%table.table.table-hover.table-bordered
|
8
|
+
- @blogs.each do |blog|
|
9
|
+
%tr
|
10
|
+
%td.main
|
11
|
+
= link_to blog.label, edit_comfy_admin_blog_path(@site, blog)
|
12
|
+
.item-meta
|
13
|
+
= blog.identifier
|
14
|
+
%br
|
15
|
+
- blog_path = comfy_blog_posts_url(@site.path, blog.path)
|
16
|
+
= link_to blog_path, blog_path, :target => '_blank'
|
17
|
+
%td
|
18
|
+
.btn-group
|
19
|
+
= link_to pluralize(blog.posts.count, 'Post'), comfy_admin_blog_posts_path(@site, blog), :class => 'btn btn-small btn-inverse'
|
20
|
+
= link_to pluralize(blog.comments.count, 'Comment'), comfy_admin_blog_comments_path(@site, blog), :class => 'btn btn-small btn-inverse'
|
21
|
+
%td
|
22
|
+
.btn-group
|
23
|
+
= link_to 'Edit', edit_comfy_admin_blog_path(@site, blog), :class => 'btn btn-small'
|
24
|
+
= link_to 'Delete', comfy_admin_blog_path(@site, blog), :method => :delete, :data => {:confirm => 'Are you sure?'}, :class => 'btn btn-small btn-danger'
|
25
|
+
|
26
|
+
= paginate @blogs
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
%tr{:id => dom_id(comment)}
|
2
|
+
%td
|
3
|
+
= link_to comment.post.title.truncate(25), comfy_admin_blog_comments_path(@site, @blog, :post_id => comment.post)
|
4
|
+
%td.main
|
5
|
+
= comment.author
|
6
|
+
.item-meta
|
7
|
+
= mail_to comment.email
|
8
|
+
%br
|
9
|
+
= comment.content
|
10
|
+
%td
|
11
|
+
= comment.created_at.to_s(:db)
|
12
|
+
%td
|
13
|
+
- label, css_class = comment.is_published?? ['Unpublish', 'btn-danger'] : ['Publish', 'btn-info']
|
14
|
+
= link_to label, toggle_publish_comfy_admin_blog_comment_path(@site, @blog, comment), :method => :patch, :remote => true, :class => "btn btn-small #{css_class}"
|
15
|
+
%td
|
16
|
+
.btn-group.btn-group-sm
|
17
|
+
= link_to 'Delete', comfy_admin_blog_comment_path(@site, @blog, comment), :method => :delete, :data => {:confirm => 'Are you sure?'}, :class => 'btn btn-danger'
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- if @site.present? && @site.persisted?
|
2
|
+
%li= active_link_to 'Blogs', comfy_admin_blogs_path(@site)
|
3
|
+
- if @blog.present? && @blog.persisted?
|
4
|
+
%ul
|
5
|
+
%li= active_link_to 'Posts', comfy_admin_blog_posts_path(@site, @blog)
|
6
|
+
%li= active_link_to 'Comments', comfy_admin_blog_comments_path(@site, @blog)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- content_for :right_column do
|
2
|
-
= render :partial => 'admin/cms/files/index'
|
2
|
+
= render :partial => 'comfy/admin/cms/files/index'
|
3
3
|
|
4
4
|
= form.text_field :title, :data => {:slugify => @post.new_record?}
|
5
5
|
= form.text_field :slug, :data => {:slug => true}
|
@@ -7,7 +7,8 @@
|
|
7
7
|
= form.text_area :content, :data => {'cms-rich-text' => true}
|
8
8
|
= form.text_area :excerpt, :class => 'short'
|
9
9
|
= form.text_field :published_at, :value => @post.published_at.try(:to_s, :db), :data => {'cms-datetime' => true}
|
10
|
-
= form.
|
10
|
+
= form.form_group :is_published do
|
11
|
+
= form.check_box :is_published
|
11
12
|
|
12
|
-
.form-actions
|
13
|
+
= form.form_group :class => 'form-actions' do
|
13
14
|
= form.submit :class => 'btn btn-primary'
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
.page-header
|
2
|
+
= link_to 'New Blog Post', new_comfy_admin_blog_post_path(@site, @blog), :class => 'btn btn-default pull-right'
|
3
|
+
%h2 Blog Posts
|
4
|
+
|
5
|
+
= paginate @posts
|
6
|
+
|
7
|
+
%table.table.table-hover
|
8
|
+
%tr
|
9
|
+
%th.main Title
|
10
|
+
%th Author
|
11
|
+
%th Published
|
12
|
+
%th Comments
|
13
|
+
%th
|
14
|
+
|
15
|
+
- @posts.each do |post|
|
16
|
+
%tr
|
17
|
+
%td.main
|
18
|
+
= link_to post.title, edit_comfy_admin_blog_post_path(@site, @blog, post)
|
19
|
+
.item-meta
|
20
|
+
= post.excerpt
|
21
|
+
%td
|
22
|
+
= post.author
|
23
|
+
%td
|
24
|
+
= post.published_at.try(:to_s, :db)
|
25
|
+
%td
|
26
|
+
= link_to pluralize(post.comments.count, 'Comment'), comfy_admin_blog_comments_path(@site, @blog, :post_id => post.id), :class => 'btn btn-sm btn-info'
|
27
|
+
%td
|
28
|
+
.btn-group.btn-group-sm
|
29
|
+
= link_to 'Edit', edit_comfy_admin_blog_post_path(@site, @blog, post), :class => 'btn btn-default'
|
30
|
+
= link_to 'Delete', comfy_admin_blog_post_path(@site, @blog, post), :method => :delete, :data => {:confirm => 'Are you sure?'}, :class => 'btn btn-danger'
|
31
|
+
|
32
|
+
= paginate @posts
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= comfy_form_for @comment, :as => :comment, :url => comfy_blog_comments_path(@cms_site.path, @blog.path, @post.slug) do |form|
|
2
2
|
|
3
3
|
-# don't need this when installed into your app
|
4
4
|
= form.hidden_field :authenticity_token, :value => form_authenticity_token
|
@@ -3,10 +3,10 @@ xml.rss :version => '2.0' do
|
|
3
3
|
xml.channel do
|
4
4
|
xml.title @blog.label
|
5
5
|
xml.description @blog.description
|
6
|
-
xml.link
|
6
|
+
xml.link comfy_blog_posts_url(@cms_site.path, @blog.path)
|
7
7
|
|
8
8
|
@posts.each do |post|
|
9
|
-
url =
|
9
|
+
url = comfy_blog_post_url(@cms_site.path, @blog.path, post.slug)
|
10
10
|
|
11
11
|
xml.item do
|
12
12
|
xml.title post.title
|
File without changes
|
data/comfy_blog.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'comfy_blog/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'comfy_blog'
|
8
8
|
s.version = ComfyBlog::VERSION
|
9
|
-
s.authors = ["Oleg Khabarov"
|
9
|
+
s.authors = ["Oleg Khabarov"]
|
10
10
|
s.email = ["oleg@khabarov.ca"]
|
11
11
|
s.homepage = "http://github.com/comfy/comfy-blog"
|
12
12
|
s.summary = "Simple Blog Engine for ComfortableMexicanSofa"
|
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.platform = Gem::Platform::RUBY
|
18
18
|
s.require_paths = ['lib']
|
19
19
|
|
20
|
-
s.add_dependency 'comfortable_mexican_sofa', '
|
20
|
+
s.add_dependency 'comfortable_mexican_sofa', '~> 1.12.0'
|
21
21
|
end
|
data/config/application.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
ComfyBlog.configure do |config|
|
2
|
-
|
2
|
+
|
3
3
|
# Number of posts per page. Default is 10
|
4
4
|
# config.posts_per_page = 10
|
5
|
-
|
5
|
+
|
6
6
|
# Comments can be automatically approved/published by changing this setting
|
7
7
|
# Default is false.
|
8
8
|
# config.auto_publish_comments = false
|
9
|
-
|
9
|
+
|
10
|
+
# A default author can be specified for posts
|
11
|
+
# config.default_author = 'Author Name'
|
12
|
+
|
10
13
|
end
|
data/db/migrate/00_create_cms.rb
CHANGED
@@ -10,7 +10,7 @@ class CreateCms < ActiveRecord::Migration
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# -- Sites --------------------------------------------------------------
|
13
|
-
create_table :
|
13
|
+
create_table :comfy_cms_sites do |t|
|
14
14
|
t.string :label, :null => false
|
15
15
|
t.string :identifier, :null => false
|
16
16
|
t.string :hostname, :null => false
|
@@ -18,11 +18,11 @@ class CreateCms < ActiveRecord::Migration
|
|
18
18
|
t.string :locale, :null => false, :default => 'en'
|
19
19
|
t.boolean :is_mirrored, :null => false, :default => false
|
20
20
|
end
|
21
|
-
add_index :
|
22
|
-
add_index :
|
21
|
+
add_index :comfy_cms_sites, :hostname
|
22
|
+
add_index :comfy_cms_sites, :is_mirrored
|
23
23
|
|
24
24
|
# -- Layouts ------------------------------------------------------------
|
25
|
-
create_table :
|
25
|
+
create_table :comfy_cms_layouts do |t|
|
26
26
|
t.integer :site_id, :null => false
|
27
27
|
t.integer :parent_id
|
28
28
|
t.string :app_layout
|
@@ -35,11 +35,11 @@ class CreateCms < ActiveRecord::Migration
|
|
35
35
|
t.boolean :is_shared, :null => false, :default => false
|
36
36
|
t.timestamps
|
37
37
|
end
|
38
|
-
add_index :
|
39
|
-
add_index :
|
38
|
+
add_index :comfy_cms_layouts, [:parent_id, :position]
|
39
|
+
add_index :comfy_cms_layouts, [:site_id, :identifier], :unique => true
|
40
40
|
|
41
41
|
# -- Pages --------------------------------------------------------------
|
42
|
-
create_table :
|
42
|
+
create_table :comfy_cms_pages do |t|
|
43
43
|
t.integer :site_id, :null => false
|
44
44
|
t.integer :layout_id
|
45
45
|
t.integer :parent_id
|
@@ -47,27 +47,28 @@ class CreateCms < ActiveRecord::Migration
|
|
47
47
|
t.string :label, :null => false
|
48
48
|
t.string :slug
|
49
49
|
t.string :full_path, :null => false
|
50
|
-
t.text :
|
50
|
+
t.text :content_cache, text_limit
|
51
51
|
t.integer :position, :null => false, :default => 0
|
52
52
|
t.integer :children_count, :null => false, :default => 0
|
53
53
|
t.boolean :is_published, :null => false, :default => true
|
54
54
|
t.boolean :is_shared, :null => false, :default => false
|
55
55
|
t.timestamps
|
56
56
|
end
|
57
|
-
add_index :
|
58
|
-
add_index :
|
57
|
+
add_index :comfy_cms_pages, [:site_id, :full_path]
|
58
|
+
add_index :comfy_cms_pages, [:parent_id, :position]
|
59
59
|
|
60
60
|
# -- Page Blocks --------------------------------------------------------
|
61
|
-
create_table :
|
62
|
-
t.
|
63
|
-
t.
|
64
|
-
t.
|
61
|
+
create_table :comfy_cms_blocks do |t|
|
62
|
+
t.string :identifier, :null => false
|
63
|
+
t.text :content, text_limit
|
64
|
+
t.references :blockable, :polymorphic => true
|
65
65
|
t.timestamps
|
66
66
|
end
|
67
|
-
add_index :
|
67
|
+
add_index :comfy_cms_blocks, [:identifier]
|
68
|
+
add_index :comfy_cms_blocks, [:blockable_id, :blockable_type]
|
68
69
|
|
69
70
|
# -- Snippets -----------------------------------------------------------
|
70
|
-
create_table :
|
71
|
+
create_table :comfy_cms_snippets do |t|
|
71
72
|
t.integer :site_id, :null => false
|
72
73
|
t.string :label, :null => false
|
73
74
|
t.string :identifier, :null => false
|
@@ -76,11 +77,11 @@ class CreateCms < ActiveRecord::Migration
|
|
76
77
|
t.boolean :is_shared, :null => false, :default => false
|
77
78
|
t.timestamps
|
78
79
|
end
|
79
|
-
add_index :
|
80
|
-
add_index :
|
80
|
+
add_index :comfy_cms_snippets, [:site_id, :identifier], :unique => true
|
81
|
+
add_index :comfy_cms_snippets, [:site_id, :position]
|
81
82
|
|
82
83
|
# -- Files --------------------------------------------------------------
|
83
|
-
create_table :
|
84
|
+
create_table :comfy_cms_files do |t|
|
84
85
|
t.integer :site_id, :null => false
|
85
86
|
t.integer :block_id
|
86
87
|
t.string :label, :null => false
|
@@ -91,47 +92,48 @@ class CreateCms < ActiveRecord::Migration
|
|
91
92
|
t.integer :position, :null => false, :default => 0
|
92
93
|
t.timestamps
|
93
94
|
end
|
94
|
-
add_index :
|
95
|
-
add_index :
|
96
|
-
add_index :
|
97
|
-
add_index :
|
95
|
+
add_index :comfy_cms_files, [:site_id, :label]
|
96
|
+
add_index :comfy_cms_files, [:site_id, :file_file_name]
|
97
|
+
add_index :comfy_cms_files, [:site_id, :position]
|
98
|
+
add_index :comfy_cms_files, [:site_id, :block_id]
|
98
99
|
|
99
100
|
# -- Revisions -----------------------------------------------------------
|
100
|
-
create_table :
|
101
|
+
create_table :comfy_cms_revisions, :force => true do |t|
|
101
102
|
t.string :record_type, :null => false
|
102
103
|
t.integer :record_id, :null => false
|
103
104
|
t.text :data, text_limit
|
104
105
|
t.datetime :created_at
|
105
106
|
end
|
106
|
-
add_index :
|
107
|
+
add_index :comfy_cms_revisions, [:record_type, :record_id, :created_at],
|
107
108
|
:name => 'index_cms_revisions_on_rtype_and_rid_and_created_at'
|
108
109
|
|
109
110
|
# -- Categories ---------------------------------------------------------
|
110
|
-
create_table :
|
111
|
+
create_table :comfy_cms_categories, :force => true do |t|
|
111
112
|
t.integer :site_id, :null => false
|
112
113
|
t.string :label, :null => false
|
113
114
|
t.string :categorized_type, :null => false
|
114
115
|
end
|
115
|
-
add_index :
|
116
|
+
add_index :comfy_cms_categories, [:site_id, :categorized_type, :label], :unique => true,
|
117
|
+
:name => 'index_cms_categories_on_site_id_and_cat_type_and_label'
|
116
118
|
|
117
|
-
create_table :
|
119
|
+
create_table :comfy_cms_categorizations, :force => true do |t|
|
118
120
|
t.integer :category_id, :null => false
|
119
121
|
t.string :categorized_type, :null => false
|
120
122
|
t.integer :categorized_id, :null => false
|
121
123
|
end
|
122
|
-
add_index :
|
124
|
+
add_index :comfy_cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true,
|
123
125
|
:name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
|
124
126
|
end
|
125
127
|
|
126
128
|
def self.down
|
127
|
-
drop_table :
|
128
|
-
drop_table :
|
129
|
-
drop_table :
|
130
|
-
drop_table :
|
131
|
-
drop_table :
|
132
|
-
drop_table :
|
133
|
-
drop_table :
|
134
|
-
drop_table :
|
135
|
-
drop_table :
|
129
|
+
drop_table :comfy_cms_sites
|
130
|
+
drop_table :comfy_cms_layouts
|
131
|
+
drop_table :comfy_cms_pages
|
132
|
+
drop_table :comfy_cms_snippets
|
133
|
+
drop_table :comfy_cms_blocks
|
134
|
+
drop_table :comfy_cms_files
|
135
|
+
drop_table :comfy_cms_revisions
|
136
|
+
drop_table :comfy_cms_categories
|
137
|
+
drop_table :comfy_cms_categorizations
|
136
138
|
end
|
137
|
-
end
|
139
|
+
end
|