spud_blog 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.markdown +75 -0
- data/app/models/spud_post.rb +7 -1
- data/app/models/spud_post_category.rb +2 -0
- data/app/models/spud_post_comment.rb +3 -1
- data/lib/spud_blog/version.rb +1 -1
- metadata +23 -23
- data/README.rdoc +0 -3
data/Readme.markdown
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
Spud Blog
|
2
|
+
========
|
3
|
+
|
4
|
+
Spud Blog is a Blog Engine designed to be robust, easy to use, and light weight.
|
5
|
+
|
6
|
+
__NOTE:__ This project is still in its early infancy.
|
7
|
+
|
8
|
+
## Installation/Usage
|
9
|
+
|
10
|
+
1. In your Gemfile add the following
|
11
|
+
|
12
|
+
gem 'spud_core'
|
13
|
+
gem 'spud_blog'
|
14
|
+
|
15
|
+
2. Run bundle install
|
16
|
+
3. Copy in database migrations to your new rails project
|
17
|
+
|
18
|
+
bundle exec rake railties:install:migrations
|
19
|
+
rake db:migrate
|
20
|
+
|
21
|
+
4. run a rails server instance and point your browser to /spud/admin
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
Spud Blog current accepts the following configuration options.
|
26
|
+
|
27
|
+
Spud::Blog.configure do |config|
|
28
|
+
config.base_layout = 'blog'
|
29
|
+
config.blog_enabled = true
|
30
|
+
config.news_enabled = true
|
31
|
+
config.blog_path = 'blog'
|
32
|
+
config.news_path = 'news'
|
33
|
+
config.posts_per_page = 5
|
34
|
+
config.has_custom_fields = true
|
35
|
+
config.caching_enabled = true
|
36
|
+
config.caching_expires_in = 1.hour
|
37
|
+
end
|
38
|
+
|
39
|
+
## Customizing Views
|
40
|
+
|
41
|
+
A number of built-in views have been provided to help you get started with the frontend display. Customzing these views will require you to copy them into your local application, which can be accomplished by using the views generator.
|
42
|
+
|
43
|
+
rails generate spud:blog:views
|
44
|
+
|
45
|
+
__NOTE:__ The built-in views are likely to undergo changes as features are added to the blogging engine. If a new version of Spud Blog does not play nicely with your customized views, try backing up your views to an alternate location and running the views generator again to see what has changed.
|
46
|
+
|
47
|
+
## Javascript Driver
|
48
|
+
|
49
|
+
Spud Blog includes a small, unobtrusive javascript driver that adds functionality to the built-in views. Including the driver is optional, as all client-side views and controllers are designed to work whether you include it or not.
|
50
|
+
|
51
|
+
<%= javascript_include_tag 'spud/blog' %>
|
52
|
+
|
53
|
+
## Custom Fields
|
54
|
+
|
55
|
+
You may find that your blog requires a field that isn't included in the default `spud_post` model. Adding custom fields is easy.
|
56
|
+
|
57
|
+
1. Set `has_custom_fields` to true in your Spud Blog configuration
|
58
|
+
2. Create a migration adding the necessary column(s) to your database
|
59
|
+
|
60
|
+
class AddCaptionToPosts < ActiveRecord::Migration
|
61
|
+
def change
|
62
|
+
add_column :spud_posts, :caption, :string
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
3. Save a view partial at `app/views/spud/admin/posts/_custom_fields.html.erb` with the desired inputs
|
67
|
+
|
68
|
+
|
69
|
+
<div class="control-group">
|
70
|
+
<%= f.label :caption, 'Caption',:class => "control-label" %>
|
71
|
+
<div class="controls">
|
72
|
+
<%= f.text_field :caption %>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
|
data/app/models/spud_post.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class SpudPost < ActiveRecord::Base
|
2
2
|
searchable
|
3
|
+
|
4
|
+
|
3
5
|
has_and_belongs_to_many :categories,
|
4
6
|
:class_name => 'SpudPostCategory',
|
5
7
|
:join_table => 'spud_post_categories_posts',
|
@@ -7,10 +9,14 @@ class SpudPost < ActiveRecord::Base
|
|
7
9
|
belongs_to :author, :class_name => 'SpudUser', :foreign_key => 'spud_user_id'
|
8
10
|
has_many :comments, :class_name => 'SpudPostComment'
|
9
11
|
has_many :spud_permalinks,:as => :attachment
|
10
|
-
|
12
|
+
|
13
|
+
|
14
|
+
scope :publicly, where('visible = true AND published_at <= ?', Time.now.utc).order('published_at desc')
|
11
15
|
validates_presence_of :title, :content, :published_at, :spud_user_id, :url_name
|
12
16
|
validates_uniqueness_of :url_name
|
13
17
|
before_validation :set_url_name
|
18
|
+
attr_accessible :is_news,:published_at,:title,:content,:spud_user_id,:url_name,:visible,:comments_enabled,:meta_keywords,:meta_description
|
19
|
+
|
14
20
|
|
15
21
|
def self.public_posts(page, per_page)
|
16
22
|
return where('visible = ? AND published_at <= ?', true,Time.now.utc).order('published_at desc').includes(:comments, :categories).paginate(:page => page, :per_page => per_page)
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class SpudPostComment < ActiveRecord::Base
|
2
2
|
|
3
3
|
validates_presence_of :author, :content
|
4
|
-
|
4
|
+
belongs_to :post, :class_name => 'SpudPost', :foreign_key => 'spud_post_id'
|
5
5
|
|
6
|
+
|
7
|
+
attr_accessible :author,:content,:spud_post_id
|
6
8
|
end
|
data/lib/spud_blog/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spud_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70095236128480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70095236128480
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: spud_core
|
27
|
-
requirement: &
|
27
|
+
requirement: &70095236127960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: 0.9.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70095236127960
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: spud_permalinks
|
41
|
-
requirement: &
|
41
|
+
requirement: &70095236127240 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: 0.0.1
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *70095236127240
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: mysql2
|
52
|
-
requirement: &
|
52
|
+
requirement: &70095236126820 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ! '>='
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
version: '0'
|
58
58
|
type: :development
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *70095236126820
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
|
-
requirement: &
|
63
|
+
requirement: &70095236126320 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
@@ -68,10 +68,10 @@ dependencies:
|
|
68
68
|
version: '0'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
|
-
version_requirements: *
|
71
|
+
version_requirements: *70095236126320
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: rspec-rails
|
74
|
-
requirement: &
|
74
|
+
requirement: &70095236125860 !ruby/object:Gem::Requirement
|
75
75
|
none: false
|
76
76
|
requirements:
|
77
77
|
- - ! '>='
|
@@ -79,10 +79,10 @@ dependencies:
|
|
79
79
|
version: '0'
|
80
80
|
type: :development
|
81
81
|
prerelease: false
|
82
|
-
version_requirements: *
|
82
|
+
version_requirements: *70095236125860
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: factory_girl
|
85
|
-
requirement: &
|
85
|
+
requirement: &70095236125320 !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
87
87
|
requirements:
|
88
88
|
- - =
|
@@ -90,10 +90,10 @@ dependencies:
|
|
90
90
|
version: 2.5.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
|
-
version_requirements: *
|
93
|
+
version_requirements: *70095236125320
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: mocha
|
96
|
-
requirement: &
|
96
|
+
requirement: &70095236124760 !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
99
|
- - =
|
@@ -101,10 +101,10 @@ dependencies:
|
|
101
101
|
version: 0.10.3
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
|
-
version_requirements: *
|
104
|
+
version_requirements: *70095236124760
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: database_cleaner
|
107
|
-
requirement: &
|
107
|
+
requirement: &70095236124300 !ruby/object:Gem::Requirement
|
108
108
|
none: false
|
109
109
|
requirements:
|
110
110
|
- - =
|
@@ -112,7 +112,7 @@ dependencies:
|
|
112
112
|
version: 0.7.1
|
113
113
|
type: :development
|
114
114
|
prerelease: false
|
115
|
-
version_requirements: *
|
115
|
+
version_requirements: *70095236124300
|
116
116
|
description: Spud blogging/news and rss engine.
|
117
117
|
email:
|
118
118
|
- greg@westlakedesign.com
|
@@ -194,7 +194,7 @@ files:
|
|
194
194
|
- lib/tasks/spud_blog_tasks.rake
|
195
195
|
- MIT-LICENSE
|
196
196
|
- Rakefile
|
197
|
-
-
|
197
|
+
- Readme.markdown
|
198
198
|
- test/dummy/app/assets/javascripts/application.js
|
199
199
|
- test/dummy/app/assets/stylesheets/application.css
|
200
200
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: '0'
|
240
240
|
segments:
|
241
241
|
- 0
|
242
|
-
hash:
|
242
|
+
hash: -779019676480040355
|
243
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
244
|
none: false
|
245
245
|
requirements:
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
segments:
|
250
250
|
- 0
|
251
|
-
hash:
|
251
|
+
hash: -779019676480040355
|
252
252
|
requirements: []
|
253
253
|
rubyforge_project:
|
254
254
|
rubygems_version: 1.8.15
|
data/README.rdoc
DELETED