comfy_blog 0.1.6 → 0.1.7

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -18,7 +18,7 @@ class Blog::Post < ActiveRecord::Base
18
18
  :uniqueness => { :scope => [:year, :month] }
19
19
 
20
20
  # -- Scopes ---------------------------------------------------------------
21
- default_scope order('created_at DESC')
21
+ default_scope order('published_at DESC')
22
22
 
23
23
  scope :published, where(:is_published => true)
24
24
  scope :for_year, lambda { |year|
@@ -36,7 +36,8 @@ class Blog::Post < ActiveRecord::Base
36
36
 
37
37
  # -- Callbacks ------------------------------------------------------------
38
38
  before_validation :set_slug,
39
- :set_date
39
+ :set_date,
40
+ :set_published_at
40
41
  after_save :sync_tags,
41
42
  :sync_categories
42
43
 
@@ -61,6 +62,10 @@ protected
61
62
  self.month ||= Time.zone.now.month
62
63
  end
63
64
 
65
+ def set_published_at
66
+ self.published_at ||= Time.zone.now
67
+ end
68
+
64
69
  def sync_tags
65
70
  return unless tag_names
66
71
  self.taggings.for_tags.destroy_all
@@ -15,6 +15,7 @@
15
15
  <%= form.text_field :tag_names, :label => link_to('Tags', admin_blog_tags_path) %>
16
16
  <%= form.text_area :excerpt, :class => 'short' %>
17
17
  <%= form.text_area :content, :class => 'rich_text' %>
18
+ <%= form.text_field :published_at, :class => 'datetime' %>
18
19
 
19
20
  <% if defined?(ComfortableMexicanSofa) %>
20
21
  <% content_for :right_column do %>
@@ -26,11 +27,11 @@
26
27
  <%= form.simple_field nil, nil, :class => 'submit_element' do %>
27
28
  <%= form.check_box :is_published, :disable_builder => true %>
28
29
  <%= form.label_for :is_published %>
29
- <%= form.submit (@post.new_record? ? 'Create post' : 'Update post'), :disable_builder => true %>
30
+ <%= form.submit @post.new_record?? 'Create post' : 'Update post', :disable_builder => true %>
30
31
  <% end %>
31
32
 
32
33
  <% else %>
33
34
  <%= form.check_box :is_published %>
34
- <%= form.submit (@post.new_record? ? 'Create post' : 'Update post') %>
35
+ <%= form.submit @post.new_record?? 'Create post' : 'Update post' %>
35
36
  <% end %>
36
37
 
data/comfy_blog.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "comfy_blog"
8
- s.version = "0.1.6"
8
+ s.version = "0.1.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc."]
12
- s.date = "2012-03-15"
12
+ s.date = "2012-04-12"
13
13
  s.description = ""
14
14
  s.email = "oleg@twg.ca"
15
15
  s.extra_rdoc_files = [
@@ -109,7 +109,7 @@ Gem::Specification.new do |s|
109
109
  s.homepage = "http://github.com/comfy/comfy-blog"
110
110
  s.licenses = ["MIT"]
111
111
  s.require_paths = ["lib"]
112
- s.rubygems_version = "1.8.10"
112
+ s.rubygems_version = "1.8.21"
113
113
  s.summary = "ComfyBlog is a blog engine for Rails 3.1 apps (and ComfortableMexicanSofa)"
114
114
 
115
115
  if s.respond_to? :specification_version then
@@ -10,6 +10,7 @@ class CreateComfyBlog < ActiveRecord::Migration
10
10
  t.integer :year, :null => false, :limit => 4
11
11
  t.integer :month, :null => false, :limit => 2
12
12
  t.boolean :is_published, :null => false, :default => true
13
+ t.datetime :published_at, :null => false
13
14
  t.timestamps
14
15
  end
15
16
  add_index :blog_posts, [:is_published, :year, :month, :slug],
data/db/schema.rb CHANGED
@@ -19,8 +19,8 @@ ActiveRecord::Schema.define(:version => 1) do
19
19
  t.string "email", :null => false
20
20
  t.text "content"
21
21
  t.boolean "is_published", :default => false, :null => false
22
- t.datetime "created_at"
23
- t.datetime "updated_at"
22
+ t.datetime "created_at", :null => false
23
+ t.datetime "updated_at", :null => false
24
24
  end
25
25
 
26
26
  add_index "blog_comments", ["post_id", "created_at"], :name => "index_blog_comments_on_post_id_and_created_at"
@@ -35,8 +35,9 @@ ActiveRecord::Schema.define(:version => 1) do
35
35
  t.integer "year", :limit => 4, :null => false
36
36
  t.integer "month", :limit => 2, :null => false
37
37
  t.boolean "is_published", :default => true, :null => false
38
- t.datetime "created_at"
39
- t.datetime "updated_at"
38
+ t.datetime "published_at", :null => false
39
+ t.datetime "created_at", :null => false
40
+ t.datetime "updated_at", :null => false
40
41
  end
41
42
 
42
43
  add_index "blog_posts", ["created_at"], :name => "index_blog_posts_on_created_at"
@@ -5,4 +5,5 @@ default:
5
5
  author: Default Author
6
6
  is_published: true
7
7
  year: 2012
8
- month: 1
8
+ month: 1
9
+ published_at: <%= 2.days.ago %>
@@ -50,6 +50,12 @@ class PostTest < ActiveSupport::TestCase
50
50
  assert_equal Time.now.month, post.month
51
51
  end
52
52
 
53
+ def test_set_published_at
54
+ post = Blog::Post.new
55
+ post.send(:set_published_at)
56
+ assert post.published_at.present?
57
+ end
58
+
53
59
  def test_sync_tags
54
60
  post = blog_posts(:default)
55
61
  assert_equal 'tag', post.tag_names
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfy_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-15 00:00:00.000000000Z
13
+ date: 2012-04-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70282754223980 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70282754223980
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 3.1.0
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: rails_autolink
28
- requirement: &70282754223500 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: 1.0.4
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *70282754223500
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.4
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: jquery-rails
39
- requirement: &70282754223020 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ! '>='
@@ -44,7 +54,12 @@ dependencies:
44
54
  version: 1.0.0
45
55
  type: :runtime
46
56
  prerelease: false
47
- version_requirements: *70282754223020
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.0.0
48
63
  description: ''
49
64
  email: oleg@twg.ca
50
65
  executables: []
@@ -156,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
171
  version: '0'
157
172
  segments:
158
173
  - 0
159
- hash: 2422141203898734413
174
+ hash: 2132240465952250888
160
175
  required_rubygems_version: !ruby/object:Gem::Requirement
161
176
  none: false
162
177
  requirements:
@@ -165,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
180
  version: '0'
166
181
  requirements: []
167
182
  rubyforge_project:
168
- rubygems_version: 1.8.10
183
+ rubygems_version: 1.8.21
169
184
  signing_key:
170
185
  specification_version: 3
171
186
  summary: ComfyBlog is a blog engine for Rails 3.1 apps (and ComfortableMexicanSofa)