sofa_blog 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -1
- data/Gemfile.lock +83 -65
- data/LICENSE +1 -1
- data/README.md +27 -23
- data/Rakefile +8 -7
- data/VERSION +1 -1
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/sofa_blog/application.js +7 -0
- data/app/assets/javascripts/sofa_blog/posts.js +2 -0
- data/app/assets/stylesheets/sofa_blog/admin.css +57 -0
- data/app/assets/stylesheets/sofa_blog/application.css +73 -0
- data/app/assets/stylesheets/sofa_blog/reset.css +1 -0
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/sofa_blog/admin/base_controller.rb +3 -0
- data/app/controllers/sofa_blog/admin/comments_controller.rb +74 -0
- data/app/controllers/sofa_blog/admin/posts_controller.rb +55 -0
- data/app/controllers/sofa_blog/posts_controller.rb +13 -0
- data/app/helpers/sofa_blog/posts_helper.rb +2 -0
- data/app/helpers/sofa_blog_helper.rb +12 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/sofa_blog/comment.rb +53 -0
- data/app/models/{blog_post.rb → sofa_blog/post.rb} +25 -25
- data/app/models/{blog_tag.rb → sofa_blog/tag.rb} +11 -10
- data/app/models/sofa_blog/tagging.rb +9 -0
- data/app/views/layouts/application.html.erb +17 -0
- data/app/views/sofa_blog/admin/_html_head.html.erb +1 -0
- data/app/views/sofa_blog/admin/_navigation.html.erb +1 -0
- data/app/views/sofa_blog/admin/comments/_comment.html.erb +21 -0
- data/app/views/sofa_blog/admin/comments/_form.html.erb +27 -0
- data/app/views/sofa_blog/admin/comments/_status.html.erb +7 -0
- data/app/views/sofa_blog/admin/comments/approve.js.erb +1 -0
- data/app/views/sofa_blog/admin/comments/disapprove.js.erb +1 -0
- data/app/views/sofa_blog/admin/comments/edit.html.erb +6 -0
- data/app/views/sofa_blog/admin/comments/index.html.erb +7 -0
- data/app/views/sofa_blog/admin/comments/new.html.erb +14 -0
- data/app/views/sofa_blog/admin/posts/_form.html.erb +35 -0
- data/app/views/sofa_blog/admin/posts/_post.html.erb +21 -0
- data/app/views/sofa_blog/admin/posts/edit.html.erb +5 -0
- data/app/views/sofa_blog/admin/posts/index.html.erb +7 -0
- data/app/views/sofa_blog/admin/posts/new.html.erb +5 -0
- data/app/views/sofa_blog/posts/_post.html.erb +21 -0
- data/app/views/sofa_blog/posts/index.html.erb +5 -0
- data/config/application.rb +48 -0
- data/config/boot.rb +6 -0
- data/config/database.yml +25 -0
- data/{tmp → config}/environment.rb +0 -1
- data/config/environments/development.rb +33 -0
- data/config/environments/production.rb +51 -0
- data/config/environments/test.rb +42 -0
- data/config/initializers/secret_token.rb +3 -0
- data/config/initializers/sofa_blog.rb +12 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +14 -9
- data/config.ru +4 -0
- data/db/migrate/01_create_sofa_blog.rb +29 -28
- data/db/schema.rb +59 -0
- data/db/seeds.rb +7 -0
- data/lib/sofa_blog/configuration.rb +21 -0
- data/lib/sofa_blog/engine.rb +13 -10
- data/lib/sofa_blog/form_builder.rb +50 -0
- data/lib/sofa_blog.rb +21 -2
- data/script/rails +6 -0
- data/sofa_blog.gemspec +89 -47
- data/test/fixtures/.gitkeep +0 -0
- data/test/fixtures/sofa_blog/comments.yml +6 -0
- data/test/fixtures/sofa_blog/posts.yml +7 -0
- data/test/functional/.gitkeep +0 -0
- data/test/functional/sofa_blog/admin/comments_controller_test.rb +59 -0
- data/test/functional/sofa_blog/admin/posts_controller_test.rb +76 -0
- data/test/functional/sofa_blog/posts_controller_test.rb +7 -0
- data/test/test_helper.rb +37 -0
- data/test/unit/.gitkeep +0 -0
- data/test/unit/comment_test.rb +55 -0
- data/test/unit/helpers/sofa_blog/posts_helper_test.rb +4 -0
- data/test/unit/post_test.rb +44 -0
- data/test/unit/tag_test.rb +7 -0
- data/test/unit/tagging_test.rb +7 -0
- metadata +145 -103
- data/.DS_Store +0 -0
- data/app/.DS_Store +0 -0
- data/app/controllers/cms_admin/blog_comments_controller.rb +0 -66
- data/app/controllers/cms_admin/blog_posts_controller.rb +0 -48
- data/app/models/blog_comment.rb +0 -45
- data/app/models/blog_tagging.rb +0 -8
- data/app/views/.DS_Store +0 -0
- data/app/views/cms_admin/blog_comments/_blog_comment.html.erb +0 -22
- data/app/views/cms_admin/blog_comments/_form.html.erb +0 -24
- data/app/views/cms_admin/blog_comments/_status.html.erb +0 -7
- data/app/views/cms_admin/blog_comments/approve.rjs +0 -1
- data/app/views/cms_admin/blog_comments/disapprove.rjs +0 -1
- data/app/views/cms_admin/blog_comments/edit.html.erb +0 -7
- data/app/views/cms_admin/blog_comments/index.html.erb +0 -7
- data/app/views/cms_admin/blog_comments/new.html.erb +0 -6
- data/app/views/cms_admin/blog_posts/_blog_post.html.erb +0 -21
- data/app/views/cms_admin/blog_posts/_form.html.erb +0 -33
- data/app/views/cms_admin/blog_posts/edit.html.erb +0 -7
- data/app/views/cms_admin/blog_posts/index.html.erb +0 -8
- data/app/views/cms_admin/blog_posts/new.html.erb +0 -5
- data/app/views/sofa_blog/_head.html.erb +0 -1
- data/app/views/sofa_blog/_nav.html.erb +0 -1
- data/config/.DS_Store +0 -0
- data/doc/sofa.png +0 -0
- data/lib/generators/README +0 -12
- data/lib/generators/blog_generator.rb +0 -33
- data/public/stylesheets/content.css +0 -53
- data/tmp/application.rb +0 -15
- data/tmp/boot.rb +0 -13
- data/tmp/initializers/formatted_form_builder.rb +0 -141
- data/tmp/initializers/wristband.rb +0 -1
- /data/{public/javascripts/jquery.autocomplete.pack.js → app/assets/javascripts/sofa_blog/jquery.autocomplete.js} +0 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
class SofaBlog::Comment < ActiveRecord::Base
|
2
|
+
|
3
|
+
set_table_name :sofa_blog_comments
|
4
|
+
|
5
|
+
# -- Relationships --------------------------------------------------------
|
6
|
+
belongs_to :post,
|
7
|
+
:counter_cache => :comments_count
|
8
|
+
|
9
|
+
# -- Validations ----------------------------------------------------------
|
10
|
+
validates :post_id, :presence => true
|
11
|
+
validates :content, :name, :email,
|
12
|
+
:presence => true
|
13
|
+
validates_length_of :email,
|
14
|
+
:in => 6..100,
|
15
|
+
:too_short => 'Your email address needs to be at least 6 characters long.'
|
16
|
+
validates_format_of :email,
|
17
|
+
:message => 'The email you entered is not valid.',
|
18
|
+
:with => /^([\w.%-+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
19
|
+
|
20
|
+
# -- Callbacks ------------------------------------------------------------
|
21
|
+
after_save :update_approved_comments_counter, :update_comments_counter
|
22
|
+
after_destroy :update_approved_comments_counter, :update_comments_counter
|
23
|
+
|
24
|
+
# -- Scopes ---------------------------------------------------------------
|
25
|
+
scope :approved, where(:is_approved => true)
|
26
|
+
|
27
|
+
# -- Instance Methods -----------------------------------------------------
|
28
|
+
def approve!
|
29
|
+
update_attribute(:is_approved, true)
|
30
|
+
end
|
31
|
+
|
32
|
+
def disapprove!
|
33
|
+
update_attribute(:is_approved, false)
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
def update_approved_comments_counter
|
38
|
+
self.connection.execute("
|
39
|
+
UPDATE sofa_blog_posts
|
40
|
+
SET approved_comments_count = #{post.comments.approved.count}
|
41
|
+
WHERE id = #{post.id}
|
42
|
+
")
|
43
|
+
end
|
44
|
+
|
45
|
+
def update_comments_counter
|
46
|
+
self.connection.execute("
|
47
|
+
UPDATE sofa_blog_posts
|
48
|
+
SET comments_count = #{post.comments.count}
|
49
|
+
WHERE id = #{post.id}
|
50
|
+
")
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -1,40 +1,39 @@
|
|
1
|
-
class
|
1
|
+
class SofaBlog::Post < ActiveRecord::Base
|
2
2
|
|
3
|
+
set_table_name :sofa_blog_posts
|
4
|
+
|
5
|
+
# -- Attributes --------------------------------------------------------
|
3
6
|
attr_accessor :tag_names
|
4
7
|
|
5
8
|
# -- Relationships --------------------------------------------------------
|
6
|
-
|
7
|
-
has_many :
|
8
|
-
has_many :
|
9
|
-
has_many :blog_tags, :through => :blog_taggings
|
9
|
+
has_many :comments, :dependent => :destroy
|
10
|
+
has_many :taggings, :dependent => :destroy
|
11
|
+
has_many :tags, :through => :taggings
|
10
12
|
|
11
13
|
# -- Validations ----------------------------------------------------------
|
12
|
-
|
13
14
|
validates :content, :presence => {:message => 'Please enter some content for this post'}
|
14
15
|
validates :title, :presence => {:message => 'Please enter a title for this post'}
|
15
16
|
|
16
|
-
# -- Scopes
|
17
|
-
|
18
|
-
scope :published, where(:
|
17
|
+
# -- Scopes ---------------------------------------------------------------
|
18
|
+
default_scope order('created_at DESC')
|
19
|
+
scope :published, where(:is_published => true)
|
19
20
|
scope :tagged_with, lambda { |tag_id|
|
20
|
-
joins(:
|
21
|
+
joins(:taggings).where('sofa_blog_taggings.tag_id' => tag_id)
|
21
22
|
}
|
22
|
-
|
23
|
-
# --
|
24
|
-
|
23
|
+
|
24
|
+
# -- Callbacks ---------------------------------------------------------------
|
25
25
|
before_save :assign_tags
|
26
26
|
after_save :delete_unused_tags
|
27
|
-
|
28
|
-
# -- Instance Methods
|
29
|
-
|
27
|
+
|
28
|
+
# -- Instance Methods -----------------------------------------------------
|
30
29
|
def to_param
|
31
30
|
"#{self.id}-#{title.downcase.gsub(/\W|_/, ' ').strip.squeeze(' ').gsub(/\s/, '-')}"
|
32
31
|
end
|
33
32
|
|
34
33
|
def tag_names
|
35
|
-
@tag_names ||= self.
|
34
|
+
@tag_names ||= self.tags.collect(&:name).join(', ')
|
36
35
|
end
|
37
|
-
|
36
|
+
|
38
37
|
|
39
38
|
protected
|
40
39
|
def self.collect_tags(query)
|
@@ -44,19 +43,20 @@ protected
|
|
44
43
|
|
45
44
|
def assign_tags
|
46
45
|
self.tag_names # IMPORTANT: populating @tag_names so we can rebuild existing taggings
|
47
|
-
self.
|
46
|
+
self.taggings.delete_all
|
48
47
|
|
49
|
-
|
50
|
-
if existing_tag =
|
51
|
-
self.
|
48
|
+
SofaBlog::Post.collect_tags(self.tag_names).each do |tag_name|
|
49
|
+
if existing_tag = SofaBlog::Tag.find_by_name(tag_name)
|
50
|
+
self.tags << existing_tag
|
52
51
|
else
|
53
|
-
self.
|
52
|
+
self.tags.new(:name => tag_name)
|
54
53
|
end
|
55
54
|
end
|
56
55
|
@tag_names = nil # reloading the reader
|
57
56
|
end
|
58
57
|
|
59
58
|
def delete_unused_tags
|
60
|
-
|
59
|
+
SofaBlog::Tag.destroy_all('taggings_count = 0')
|
61
60
|
end
|
62
|
-
|
61
|
+
|
62
|
+
end
|
@@ -1,17 +1,18 @@
|
|
1
|
-
class
|
2
|
-
|
3
|
-
# -- AR Callbacks ---------------------------------------------------------
|
1
|
+
class SofaBlog::Tag < ActiveRecord::Base
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
# -- Validations ----------------------------------------------------------
|
3
|
+
set_table_name :sofa_blog_tags
|
8
4
|
|
9
|
-
validates_uniqueness_of :name
|
10
|
-
|
11
5
|
# -- Relationships --------------------------------------------------------
|
6
|
+
has_many :taggings, :dependent => :destroy
|
7
|
+
has_many :posts, :through => :taggings
|
12
8
|
|
13
|
-
|
14
|
-
|
9
|
+
# -- Validations ----------------------------------------------------------
|
10
|
+
validates_uniqueness_of :name
|
11
|
+
|
12
|
+
# -- Callbacks ---------------------------------------------------------
|
13
|
+
before_validation :downcase_name
|
14
|
+
|
15
|
+
|
15
16
|
|
16
17
|
protected
|
17
18
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
|
5
|
+
<title>SofaBlog</title>
|
6
|
+
<%= javascript_include_tag 'sofa_blog/application' %>
|
7
|
+
<%= stylesheet_link_tag "sofa_blog/application" %>
|
8
|
+
<%= yield :head %>
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<% flash.each do |type, message| %>
|
13
|
+
<div class='flash <%= type %>'><%= message %></div>
|
14
|
+
<% end %>
|
15
|
+
<%= yield %>
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= stylesheet_link_tag 'sofa_blog/admin' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<li><%= active_link_to 'Blog posts', sofa_blog_admin_posts_path %></li>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<li>
|
2
|
+
<div class='item'>
|
3
|
+
<div class='icon' style="background-image:url(http://www.gravatar.com/avatar/<%=Digest::MD5.hexdigest(comment.email.downcase)%>?s=28&d=identicon)"></div>
|
4
|
+
<div class='action_links'>
|
5
|
+
<%= render :partial => 'status', :locals => {:comment => comment} %>
|
6
|
+
<%= link_to 'Edit', edit_sofa_blog_admin_post_comment_path(@post, comment) %>
|
7
|
+
<%= link_to 'Delete', sofa_blog_admin_post_comment_path(@post, comment), :method => 'delete', :confirm => 'Are you sure?' %>
|
8
|
+
</div>
|
9
|
+
<div class='label'>
|
10
|
+
<div class='sublabel'>
|
11
|
+
<em>
|
12
|
+
<%= time_ago_in_words(comment.updated_at) %> ago
|
13
|
+
<strong><%= mail_to(comment.email, comment.name) %></strong> wrote
|
14
|
+
</em>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<div class='content'>
|
18
|
+
<%= simple_format(Rinku::auto_link(comment.content)) %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</li>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= content_for :head do %>
|
2
|
+
<script type="text/javascript">
|
3
|
+
$(document).ready(function() {
|
4
|
+
$('#blog_comment_content').focus();
|
5
|
+
})
|
6
|
+
</script>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<div id='form_blocks'>
|
10
|
+
<%= form.text_field :name %>
|
11
|
+
<%= form.text_field :email %>
|
12
|
+
<%= form.text_area :content %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
|
16
|
+
<% if defined?(ComfortableMexicanSofa) %>
|
17
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
18
|
+
<%= form.check_box :is_approved, :disable_builder => true %>
|
19
|
+
<%= form.label_for :is_approved, :label => 'Approved' %>
|
20
|
+
<%= form.submit @comment.new_record? ? 'Create comment' : 'Update comment', :disable_builder => true %>
|
21
|
+
<% end %>
|
22
|
+
<% else %>
|
23
|
+
<%= form.check_box :is_approved %>
|
24
|
+
<%= form.submit (@post.new_record? ? 'Create comment' : 'Update comment') %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<span id="<%= dom_id(comment, :status) %>">
|
2
|
+
<% if comment.is_approved? %>
|
3
|
+
<%= link_to 'Disapprove', disapprove_sofa_blog_admin_post_comment_path(@post, comment), :remote => true, :method => :put %>
|
4
|
+
<% else %>
|
5
|
+
<%= link_to 'Approve', approve_sofa_blog_admin_post_comment_path(@post, comment), :remote => true, :method => :put %>
|
6
|
+
<% end %>
|
7
|
+
</span>
|
@@ -0,0 +1 @@
|
|
1
|
+
$("#<%=dom_id(@comment, :status)%>").html("<%=escape_javascript(render(:partial => 'status', :locals => {:comment => @comment}))%>")
|
@@ -0,0 +1 @@
|
|
1
|
+
$("#<%=dom_id(@comment, :status)%>").html("<%=escape_javascript(render(:partial => 'status', :locals => {:comment => @comment}))%>")
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>New comment</h1>
|
2
|
+
|
3
|
+
<h2>
|
4
|
+
<%= link_to @post.title.titleize, edit_sofa_blog_admin_post_path(@post) %>
|
5
|
+
<% @post.tags.each do |tag| %>
|
6
|
+
<span class="tag"><%= tag.name %></span>
|
7
|
+
<% end %>
|
8
|
+
</h2>
|
9
|
+
|
10
|
+
|
11
|
+
<%= sofa_blog_form_for @comment, :as => :comment, :url => {:action => :create} do |form| %>
|
12
|
+
<%= render :partial => form %>
|
13
|
+
<% end %>
|
14
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% content_for :head do %>
|
2
|
+
<%= javascript_include_tag 'sofa_blog/jquery.autocomplete' %>
|
3
|
+
<script type="text/javascript">
|
4
|
+
$(document).ready(function() {
|
5
|
+
$('#post_title').focus();
|
6
|
+
$("#post_tag_names").autocomplete(<%= SofaBlog::Tag.all.collect(&:name).to_json.html_safe %>, {
|
7
|
+
multiple: true,
|
8
|
+
selectFirst: false
|
9
|
+
});
|
10
|
+
})
|
11
|
+
</script>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
|
15
|
+
<%= form.text_field :title %>
|
16
|
+
<%= form.text_field :author %>
|
17
|
+
<%= form.text_field :tag_names, :label => 'Tags' %>
|
18
|
+
<%= form.text_area :content, :class => 'rich_text' %>
|
19
|
+
|
20
|
+
<% if defined?(ComfortableMexicanSofa) %>
|
21
|
+
<% content_for :right_column do %>
|
22
|
+
<%= render :partial => 'cms_admin/files/index' %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
26
|
+
<%= form.check_box :is_published, :disable_builder => true %>
|
27
|
+
<%= form.label_for :is_published %>
|
28
|
+
<%= form.submit (@post.new_record? ? 'Create post' : 'Update post'), :disable_builder => true %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% else %>
|
32
|
+
<%= form.check_box :is_published %>
|
33
|
+
<%= form.submit (@post.new_record? ? 'Create post' : 'Update post') %>
|
34
|
+
<% end %>
|
35
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<li>
|
2
|
+
<div class='item'>
|
3
|
+
<div class='action_links'>
|
4
|
+
<%= link_to pluralize(post.comments_count, 'comment'), sofa_blog_admin_post_comments_path(post) %>
|
5
|
+
<%= link_to 'Edit', edit_sofa_blog_admin_post_path(post) %>
|
6
|
+
<%= link_to 'Delete', '', :method => :delete, :confirm => 'Are you sure?' %>
|
7
|
+
</div>
|
8
|
+
<div class='label'>
|
9
|
+
<%= link_to post.title.titleize, edit_sofa_blog_admin_post_path(post) %>
|
10
|
+
<div class='sublabel'>
|
11
|
+
Published <%= time_ago_in_words(post.updated_at) %> ago
|
12
|
+
by <strong><%= post.author %></strong>
|
13
|
+
<%= '[DRAFT]' if !post.is_published? %>
|
14
|
+
<% post.tags.each do |tag| %>
|
15
|
+
<span class="tag"><%= tag.name %></span>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</li>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<li>
|
2
|
+
<div class='item'>
|
3
|
+
<div class='action_links'>
|
4
|
+
<%= link_to pluralize(post.comments_count, 'comment'), sofa_blog_admin_post_comments_path(post) %>
|
5
|
+
<%= link_to 'Edit', edit_sofa_blog_admin_post_path(post) %>
|
6
|
+
<%= link_to 'Delete', '', :method => :delete, :confirm => 'Are you sure?' %>
|
7
|
+
</div>
|
8
|
+
<div class='label'>
|
9
|
+
<%= link_to post.title.titleize, edit_sofa_blog_admin_post_path(post) %>
|
10
|
+
<div class='sublabel'>
|
11
|
+
Published <%= time_ago_in_words(post.updated_at) %> ago
|
12
|
+
by <strong><%= post.author %></strong>
|
13
|
+
<%= '[DRAFT]' if !post.is_published? %>
|
14
|
+
<% post.tags.each do |tag| %>
|
15
|
+
<span class="tag"><%= tag.name %></span>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</li>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
if defined?(Bundler)
|
6
|
+
# If you precompile assets before deploying to production, use this line
|
7
|
+
Bundler.require *Rails.groups(:assets => %w(development test))
|
8
|
+
# If you want your assets lazily compiled in production, use this line
|
9
|
+
# Bundler.require(:default, :assets, Rails.env)
|
10
|
+
end
|
11
|
+
|
12
|
+
module SofaBlog
|
13
|
+
class Application < Rails::Application
|
14
|
+
|
15
|
+
require 'sofa_blog'
|
16
|
+
|
17
|
+
# Settings in config/environments/* take precedence over those specified here.
|
18
|
+
# Application configuration should go into files in config/initializers
|
19
|
+
# -- all .rb files in that directory are automatically loaded.
|
20
|
+
|
21
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
22
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
23
|
+
|
24
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
25
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
26
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
27
|
+
|
28
|
+
# Activate observers that should always be running.
|
29
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
30
|
+
|
31
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
32
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
33
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
34
|
+
|
35
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
36
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
37
|
+
# config.i18n.default_locale = :de
|
38
|
+
|
39
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
40
|
+
config.encoding = "utf-8"
|
41
|
+
|
42
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
43
|
+
config.filter_parameters += [:password]
|
44
|
+
|
45
|
+
# Enable the asset pipeline
|
46
|
+
config.assets.enabled = true
|
47
|
+
end
|
48
|
+
end
|
data/config/boot.rb
ADDED
data/config/database.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,33 @@
|
|
1
|
+
defined?(SofaBlog::Application) && SofaBlog::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Do not compress assets
|
26
|
+
config.assets.compress = false
|
27
|
+
|
28
|
+
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
|
29
|
+
config.assets.allow_debugging = true
|
30
|
+
|
31
|
+
# Expands the lines which load the assets
|
32
|
+
config.assets.debug = true
|
33
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
defined?(SofaBlog::Application) && SofaBlog::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
+
config.serve_static_assets = false
|
13
|
+
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Specifies the header that your server uses for sending files
|
18
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
19
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
20
|
+
|
21
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
22
|
+
# config.force_ssl = true
|
23
|
+
|
24
|
+
# See everything in the log (default is :info)
|
25
|
+
# config.log_level = :debug
|
26
|
+
|
27
|
+
# Use a different logger for distributed setups
|
28
|
+
# config.logger = SyslogLogger.new
|
29
|
+
|
30
|
+
# Use a different cache store in production
|
31
|
+
# config.cache_store = :mem_cache_store
|
32
|
+
|
33
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
34
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
35
|
+
|
36
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
37
|
+
# config.assets.precompile += %w( search.js )
|
38
|
+
|
39
|
+
# Disable delivery errors, bad email addresses will be ignored
|
40
|
+
# config.action_mailer.raise_delivery_errors = false
|
41
|
+
|
42
|
+
# Enable threaded mode
|
43
|
+
# config.threadsafe!
|
44
|
+
|
45
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
46
|
+
# the I18n.default_locale when a translation can not be found)
|
47
|
+
config.i18n.fallbacks = true
|
48
|
+
|
49
|
+
# Send deprecation notices to registered listeners
|
50
|
+
config.active_support.deprecation = :notify
|
51
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
defined?(SofaBlog::Application) && SofaBlog::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
29
|
+
# ActionMailer::Base.deliveries array.
|
30
|
+
config.action_mailer.delivery_method = :test
|
31
|
+
|
32
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
33
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
34
|
+
# like if you have constraints or database-specific column types
|
35
|
+
# config.active_record.schema_format = :sql
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
|
40
|
+
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
|
41
|
+
config.assets.allow_debugging = true
|
42
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
SofaBlog.configure do |config|
|
2
|
+
|
3
|
+
# set the cms admin path if you have changed it for CMS
|
4
|
+
# config.admin_route_prefix = 'admin'
|
5
|
+
|
6
|
+
# Controller that should be used for admin area
|
7
|
+
# config.admin_controller = 'ApplicationController'
|
8
|
+
|
9
|
+
# Form builder
|
10
|
+
# config.form_builder = 'SofaBlog::FormBuilder'
|
11
|
+
|
12
|
+
end
|