spud_blog 0.8.12 → 0.8.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/Rakefile +2 -13
  2. data/Readme.markdown +38 -1
  3. data/app/assets/stylesheets/spud/admin/posts.css +4 -2
  4. data/app/controllers/blog_controller.rb +16 -5
  5. data/app/controllers/news_controller.rb +14 -3
  6. data/app/controllers/spud/admin/news_posts_controller.rb +5 -3
  7. data/app/controllers/spud/admin/posts_controller.rb +4 -2
  8. data/app/helpers/spud/admin/posts_helper.rb +7 -0
  9. data/app/models/spud_post.rb +36 -1
  10. data/app/models/spud_post_site.rb +9 -0
  11. data/app/views/spud/admin/posts/_form.html.erb +78 -62
  12. data/db/migrate/20120713150446_create_spud_post_sites.rb +11 -0
  13. data/lib/spud_blog/version.rb +1 -1
  14. data/test/fixtures/spud_post_sites.yml +9 -0
  15. data/test/unit/spud_post_site_test.rb +7 -0
  16. metadata +56 -76
  17. data/test/dummy/README.rdoc +0 -261
  18. data/test/dummy/Rakefile +0 -7
  19. data/test/dummy/app/assets/javascripts/application.js +0 -15
  20. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  21. data/test/dummy/app/controllers/application_controller.rb +0 -3
  22. data/test/dummy/app/helpers/application_helper.rb +0 -2
  23. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  24. data/test/dummy/config/application.rb +0 -59
  25. data/test/dummy/config/boot.rb +0 -10
  26. data/test/dummy/config/database.yml +0 -15
  27. data/test/dummy/config/environment.rb +0 -10
  28. data/test/dummy/config/environments/development.rb +0 -37
  29. data/test/dummy/config/environments/production.rb +0 -67
  30. data/test/dummy/config/environments/test.rb +0 -37
  31. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  32. data/test/dummy/config/initializers/inflections.rb +0 -15
  33. data/test/dummy/config/initializers/mime_types.rb +0 -5
  34. data/test/dummy/config/initializers/secret_token.rb +0 -7
  35. data/test/dummy/config/initializers/session_store.rb +0 -8
  36. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  37. data/test/dummy/config/locales/en.yml +0 -5
  38. data/test/dummy/config/routes.rb +0 -4
  39. data/test/dummy/config.ru +0 -4
  40. data/test/dummy/db/schema.rb +0 -64
  41. data/test/dummy/public/404.html +0 -26
  42. data/test/dummy/public/422.html +0 -26
  43. data/test/dummy/public/500.html +0 -25
  44. data/test/dummy/public/favicon.ico +0 -0
  45. data/test/dummy/script/rails +0 -6
data/Rakefile CHANGED
@@ -20,21 +20,10 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
24
  load 'rails/tasks/engine.rake'
25
25
 
26
-
27
-
28
26
  Bundler::GemHelper.install_tasks
29
27
 
30
- require 'rake/testtask'
31
-
32
- Rake::TestTask.new(:test) do |t|
33
- t.libs << 'lib'
34
- t.libs << 'test'
35
- t.pattern = 'test/**/*_test.rb'
36
- t.verbose = false
37
- end
38
-
28
+ require 'rake'
39
29
 
40
- task :default => :spec
data/Readme.markdown CHANGED
@@ -72,4 +72,41 @@ You may find that your blog requires a field that isn't included in the default
72
72
  <%= f.text_field :caption %>
73
73
  </div>
74
74
  </div>
75
-
75
+
76
+ ## Extending the Post Model
77
+
78
+ Rails engines allow you to extend or even completely override classes by adding them to your local application. Source files found in your local app's path will take precedence over those found within the Spud Blog gem. Lets say you wanted to extend the SpudPost model.
79
+
80
+ 1. Create a file at `app/models/spud_post.rb`
81
+ 2. Add the following code:
82
+
83
+ # Use this helper method to pull in the SpudPost source code from the engine
84
+ Spud::Blog::Engine.require_model('spud_post')
85
+
86
+ # Add your own methods to SpudPost
87
+ class SpudPost
88
+ attr_accessible :caption
89
+ def byline
90
+ return "'#{self.title}' was posted by #{self.author.full_name} on #{self.display_date}"
91
+ end
92
+ end
93
+
94
+ Testing
95
+ -----------------
96
+
97
+ Spud uses RSpec for testing. Get the tests running with a few short commands:
98
+
99
+ 1. Create and migrate the databases:
100
+
101
+ rake db:create
102
+ rake db:migrate
103
+
104
+ 2. Load the schema in to the test database:
105
+
106
+ rake app:db:test:prepare
107
+
108
+ 3. Run the tests with RSpec
109
+
110
+ rspec spec
111
+
112
+ After the tests have completed the current code coverage stats is available by opening ```/coverage/index.html``` in a browser.
@@ -6,7 +6,6 @@
6
6
  #spud_post_categories_form{
7
7
  list-style-type: none;
8
8
  margin: 15px 0 15px 20px;
9
- padding: 0 0 0 20px;
10
9
  height: 200px;
11
10
  width: 400px;
12
11
  background: white;
@@ -30,7 +29,7 @@
30
29
  margin: 15px 0 15px 20px;
31
30
  padding: 10px 20px;
32
31
  overflow: hidden;
33
- width: 380 px;
32
+ width: 380px;
34
33
  }
35
34
  #spud_post_new_category_form h5{
36
35
  margin: 0 0 5px;
@@ -47,4 +46,7 @@
47
46
  }
48
47
  #spud_post_new_category_form input[type=button]{
49
48
  margin-left: 55px;
49
+ }
50
+ #spud_post_site_options label{
51
+ padding: 5px 10px 0 0;
50
52
  }
@@ -23,6 +23,9 @@ class BlogController < ApplicationController
23
23
 
24
24
  def index
25
25
  @posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page)
26
+ if Spud::Core.config.multisite_mode_enabled
27
+ @posts = @posts.for_spud_site(current_site_id)
28
+ end
26
29
  respond_with @posts
27
30
  end
28
31
 
@@ -41,7 +44,11 @@ class BlogController < ApplicationController
41
44
 
42
45
  def category
43
46
  if @post_category = SpudPostCategory.find_by_url_name(params[:category_url_name])
44
- @posts = @post_category.posts_with_children.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
47
+ if Spud::Core.config.multisite_mode_enabled
48
+ @posts = @post_category.posts_with_children.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page).for_spud_site(current_site_id).from_archive(params[:archive_date])
49
+ else
50
+ @posts = @post_category.posts_with_children.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
51
+ end
45
52
  else
46
53
  redirect_to blog_path
47
54
  return
@@ -52,7 +59,11 @@ class BlogController < ApplicationController
52
59
  end
53
60
 
54
61
  def archive
55
- @posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
62
+ if Spud::Core.config.multisite_mode_enabled
63
+ @posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page).for_spud_site(current_site_id).from_archive(params[:archive_date])
64
+ else
65
+ @posts = SpudPost.public_blog_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
66
+ end
56
67
  respond_with @posts do |format|
57
68
  format.html { render 'index' }
58
69
  end
@@ -74,17 +85,17 @@ class BlogController < ApplicationController
74
85
  end
75
86
  @comment = @post.comments.new(params[:spud_post_comment])
76
87
  @comment.approved = true
77
- flash[:notice] = 'Your comment has been posted, however it will not appear until it is approved.' if @comment.save
88
+ flash[:notice] = 'Your comment has been posted.' if @comment.save
78
89
  respond_with @comment do |format|
79
90
  format.html { redirect_to blog_post_path(@post.url_name, :anchor => 'spud_post_comment_form') }
80
91
  end
81
92
  end
82
93
 
83
- private
94
+ private
84
95
 
85
96
  def find_post
86
97
  @post = SpudPost.find_by_url_name(params[:id])
87
- if @post.blank? || @post.is_private?
98
+ if @post.blank? || @post.is_private? || (Spud::Core.config.multisite_mode_enabled && !@post.spud_site_ids.include?(current_site_id))
88
99
  flash[:error] = "Post not found!"
89
100
  redirect_to blog_path and return false
90
101
  end
@@ -21,6 +21,9 @@ class NewsController < ApplicationController
21
21
 
22
22
  def index
23
23
  @posts = SpudPost.public_news_posts(params[:page], Spud::Blog.config.posts_per_page)
24
+ if Spud::Core.config.multisite_mode_enabled
25
+ @posts = @posts.for_spud_site(current_site_id)
26
+ end
24
27
  respond_with @posts
25
28
  end
26
29
 
@@ -39,7 +42,11 @@ class NewsController < ApplicationController
39
42
 
40
43
  def category
41
44
  if @post_category = SpudPostCategory.find_by_url_name(params[:category_url_name])
42
- @posts = @post_category.posts_with_children.public_news_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
45
+ if Spud::Core.config.multisite_mode_enabled
46
+ @posts = @post_category.posts_with_children.public_news_posts(params[:page], Spud::Blog.config.posts_per_page).for_spud_site(current_site_id).from_archive(params[:archive_date])
47
+ else
48
+ @posts = @post_category.posts_with_children.public_news_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
49
+ end
43
50
  else
44
51
  redirect_to news_path
45
52
  return
@@ -50,7 +57,11 @@ class NewsController < ApplicationController
50
57
  end
51
58
 
52
59
  def archive
53
- @posts = SpudPost.public_news_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
60
+ if Spud::Core.config.multisite_mode_enabled
61
+ @posts = SpudPost.public_news_posts(params[:page], Spud::Blog.config.posts_per_page).for_spud_site(current_site_id).from_archive(params[:archive_date])
62
+ else
63
+ @posts = SpudPost.public_news_posts(params[:page], Spud::Blog.config.posts_per_page).from_archive(params[:archive_date])
64
+ end
54
65
  respond_with @posts do |format|
55
66
  format.html { render 'index' }
56
67
  end
@@ -58,7 +69,7 @@ class NewsController < ApplicationController
58
69
 
59
70
  def show
60
71
  @post = SpudPost.find_by_url_name(params[:id])
61
- if @post.blank? || @post.is_private?
72
+ if @post.blank? || @post.is_private? || (Spud::Core.config.multisite_mode_enabled && !@post.spud_site_ids.include?(current_site_id))
62
73
  flash[:error] = "Post not found!"
63
74
  redirect_to news_path and return false
64
75
  else
@@ -19,24 +19,26 @@ class Spud::Admin::NewsPostsController < Spud::Admin::ApplicationController
19
19
 
20
20
  def update
21
21
  @categories = SpudPostCategory.grouped
22
+ params[:spud_post][:spud_site_ids] ||= []
22
23
  if @post.update_attributes(params[:spud_post])
23
24
  flash[:notice] = 'News Post was successfully updated.'
24
- end
25
+ end
25
26
  respond_with @post, :location => spud_admin_news_posts_path
26
27
  end
27
28
 
28
29
  def new
29
30
  @categories = SpudPostCategory.grouped
30
- @post = SpudPost.new(:published_at => Time.zone.now, :spud_user_id => current_user.id, :is_news => true, :comments_enabled => false)
31
+ @post = SpudPost.new(:published_at => Time.zone.now, :spud_user_id => current_user.id, :is_news => true, :comments_enabled => false, :spud_site_ids => [current_site_id])
31
32
  respond_with @post
32
33
  end
33
34
 
34
35
  def create
35
36
  @categories = SpudPostCategory.grouped
37
+ params[:spud_post][:spud_site_ids] ||= []
36
38
  @post = SpudPost.new(params[:spud_post])
37
39
  if @post.save
38
40
  flash[:notice] = 'News Post was successfully created.'
39
- end
41
+ end
40
42
  respond_with @post, :location => spud_admin_news_posts_path
41
43
  end
42
44
 
@@ -19,6 +19,7 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
19
19
 
20
20
  def update
21
21
  @categories = SpudPostCategory.grouped
22
+ params[:spud_post][:spud_site_ids] ||= []
22
23
  if @post.update_attributes(params[:spud_post])
23
24
  flash[:notice] = 'Post was successfully updated.'
24
25
  end
@@ -27,12 +28,13 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
27
28
 
28
29
  def new
29
30
  @categories = SpudPostCategory.grouped
30
- @post = SpudPost.new(:published_at => Time.zone.now, :spud_user_id => current_user.id)
31
+ @post = SpudPost.new(:published_at => Time.zone.now, :spud_user_id => current_user.id, :spud_site_ids => [current_site_id])
31
32
  respond_with @post
32
33
  end
33
34
 
34
35
  def create
35
36
  @categories = SpudPostCategory.grouped
37
+ params[:spud_post][:spud_site_ids] ||= []
36
38
  @post = SpudPost.new(params[:spud_post])
37
39
  if @post.save
38
40
  flash[:notice] = 'Post was successfully created.'
@@ -43,7 +45,7 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
43
45
  def destroy
44
46
  if @post.destroy
45
47
  flash[:notice] = 'Post was successfully deleted.'
46
- end
48
+ end
47
49
  respond_with @post, :location => spud_admin_posts_path
48
50
  end
49
51
 
@@ -9,7 +9,14 @@ module Spud::Admin::PostsHelper
9
9
  else
10
10
  return []
11
11
  end
12
+ end
13
+
14
+ def spud_post_site_check_box_tag(site, post)
15
+ return check_box_tag 'spud_post[spud_site_ids][]', site[:site_id], post.spud_site_ids.include?(site[:site_id]), :id => "spud_post_site_id_#{site[:site_id]}"
16
+ end
12
17
 
18
+ def spud_post_site_label_tag(site)
19
+ return label_tag "spud_post_site_id_#{site[:site_id]}", site[:site_name], :class => 'checkbox inline'
13
20
  end
14
21
 
15
22
  end
@@ -8,14 +8,22 @@ class SpudPost < ActiveRecord::Base
8
8
  belongs_to :author, :class_name => 'SpudUser', :foreign_key => 'spud_user_id'
9
9
  has_many :comments, :class_name => 'SpudPostComment'
10
10
  has_many :spud_permalinks,:as => :attachment
11
+ has_many :spud_post_sites, :dependent => :destroy
11
12
 
12
13
  scope :publicly, where('visible = true AND published_at <= ?', Time.now.utc).order('published_at desc')
13
14
  scope :future_posts, where('visible = true AND published_at > ?', Time.now.utc)
14
15
  validates_presence_of :title, :content, :published_at, :spud_user_id, :url_name
15
16
  validates_uniqueness_of :url_name
16
17
  before_validation :set_url_name
18
+
19
+ after_save :set_spud_site_ids
17
20
 
18
- attr_accessible :is_news,:published_at,:title,:content,:spud_user_id,:url_name,:visible,:comments_enabled,:meta_keywords,:meta_description,:category_ids
21
+ attr_accessible :is_news,:published_at,:title,:content,:spud_user_id,:url_name,:visible,:comments_enabled,:meta_keywords,:meta_description,:category_ids, :spud_site_ids
22
+ attr_accessor :spud_site_ids
23
+
24
+ def self.for_spud_site(spud_site_id)
25
+ return joins(:spud_post_sites).where(:spud_post_sites => {:spud_site_id => spud_site_id})
26
+ end
19
27
 
20
28
  def self.public_posts(page, per_page)
21
29
  return where('visible = ? AND published_at <= ?', true,Time.now.utc).order('published_at desc').includes(:categories).paginate(:page => page, :per_page => per_page)
@@ -100,9 +108,36 @@ class SpudPost < ActiveRecord::Base
100
108
  return !is_public?
101
109
  end
102
110
 
111
+ # Spud site ids getter
112
+ def spud_site_ids
113
+ if @spud_site_ids.nil?
114
+ @spud_site_ids = spud_post_sites.collect{ |site| site.spud_site_id }
115
+ end
116
+ return @spud_site_ids
117
+ end
118
+
119
+ # Spud site ids setter
120
+ def spud_site_ids=(site_ids)
121
+ if site_ids.is_a?(Array)
122
+ @spud_site_ids = site_ids.collect{ |id| id.to_i }
123
+ else
124
+ raise 'Site ids must be an Array'
125
+ end
126
+ end
127
+
103
128
  private
104
129
 
105
130
  def set_url_name
106
131
  self.url_name = "#{self.published_at.strftime('%Y-%m-%d')}-#{self.title.parameterize}"
107
132
  end
133
+
134
+ def set_spud_site_ids
135
+ if Spud::Core.multisite_mode_enabled
136
+ _spud_post_sites = []
137
+ self.spud_site_ids.each do |site_id|
138
+ _spud_post_sites << SpudPostSite.new(:spud_post_id => id, :spud_site_id => site_id)
139
+ end
140
+ self.spud_post_sites = _spud_post_sites
141
+ end
142
+ end
108
143
  end
@@ -0,0 +1,9 @@
1
+ class SpudPostSite < ActiveRecord::Base
2
+ attr_accessible :spud_post_id, :spud_site_id
3
+ belongs_to :spud_post
4
+
5
+ def spud_site
6
+ return Spud::Core.site_config_for_id(spud_site_id)
7
+ end
8
+
9
+ end
@@ -7,80 +7,96 @@
7
7
  </div>
8
8
  </fieldset>
9
9
 
10
- <div>
11
- <%= f.text_area :content,:style => "width:100%;", :class => 'tinymce full-width' %>
12
- </div>
10
+ <div>
11
+ <%= f.text_area :content,:style => "width:100%;", :class => 'tinymce full-width' %>
12
+ </div>
13
13
 
14
- <fieldset>
15
- <legend>Categories</legend>
16
- <input type="hidden" name="spud_post[category_ids][]" value="" />
17
- <ul id="spud_post_categories_form">
18
- <%= render :partial => '/spud/admin/posts/category', :collection => @categories[0] %>
19
- </ul>
20
- </fieldset>
14
+ <fieldset>
15
+ <legend>Categories</legend>
16
+ <input type="hidden" name="spud_post[category_ids][]" value="" />
17
+ <ul id="spud_post_categories_form">
18
+ <%= render :partial => '/spud/admin/posts/category', :collection => @categories[0] %>
19
+ </ul>
20
+ </fieldset>
21
21
 
22
- <% if Spud::Blog.config.has_custom_fields %>
23
- <fieldset>
24
- <legend>Custom Fields</legend>
25
- <%= render :partial => '/spud/admin/posts/custom_fields', :locals => {:f => f} %>
26
- </fieldset>
27
- <% end %>
22
+ <% if Spud::Blog.config.has_custom_fields %>
23
+ <fieldset>
24
+ <legend>Custom Fields</legend>
25
+ <%= render :partial => '/spud/admin/posts/custom_fields', :locals => {:f => f} %>
26
+ </fieldset>
27
+ <% end %>
28
28
 
29
- <fieldset>
30
- <legend>Advanced</legend>
31
-
32
- <div class="control-group">
33
- <%= f.label :published_at, 'Publish Date', :class=>"control-label" %>
34
- <div class="controls">
35
- <%= f.text_field :published_at,:value => f.object.published_at.strftime("%Y-%m-%d %H:%M") , :class => 'spud_form_date_picker' %>
36
- </div>
29
+ <% if Spud::Core.config.multisite_mode_enabled %>
30
+ <fieldset id="spud_post_site_options">
31
+ <legend>Sites</legend>
32
+ <div class="control-group">
33
+ <div class="controls">
34
+ <span class="help-block"><b>Choose which websites you would like to publish to:</b></span>
35
+ <%= spud_post_site_check_box_tag(Spud::Core.default_site_config, @post) %>
36
+ <%= spud_post_site_label_tag(Spud::Core.default_site_config) %>
37
+ <% Spud::Core.config.multisite_config.each do |site| %>
38
+ <%= spud_post_site_check_box_tag(site, @post) %>
39
+ <%= spud_post_site_label_tag(site) %>
40
+ <% end %>
41
+ </div>
42
+ </div>
43
+ </fieldset>
44
+ <% end %>
45
+
46
+ <fieldset>
47
+ <legend>Advanced</legend>
48
+
49
+ <div class="control-group">
50
+ <%= f.label :published_at, 'Publish Date', :class=>"control-label" %>
51
+ <div class="controls">
52
+ <%= f.text_field :published_at,:value => f.object.published_at.strftime("%Y-%m-%d %H:%M") , :class => 'spud_form_date_picker' %>
37
53
  </div>
38
- <%if @current_user.super_admin%>
39
- <div class="control-group">
40
- <%= f.label :spud_user_id, 'Author', :class=>"control-label" %>
41
- <div class="controls">
42
- <%=f.select :spud_user_id,options_for_select(SpudUser.order(:first_name,:last_name,:login).all.collect{|user| [user.full_name,user.id]},f.object.spud_user_id)%>
43
- </div>
44
- </div>
45
- <%else%>
46
- <%= f.hidden_field :spud_user_id %>
47
- <%end%>
54
+ </div>
55
+ <%if @current_user.super_admin%>
48
56
  <div class="control-group">
49
- <%= f.label :visible, :class=>"control-label" %>
57
+ <%= f.label :spud_user_id, 'Author', :class=>"control-label" %>
50
58
  <div class="controls">
51
- <%= f.check_box :visible %>
59
+ <%=f.select :spud_user_id,options_for_select(SpudUser.order(:first_name,:last_name,:login).all.collect{|user| [user.full_name,user.id]},f.object.spud_user_id)%>
52
60
  </div>
53
61
  </div>
54
- <div class="control-group">
55
- <%= f.label :meta_keywords, 'Keywords', :class=>"control-label" %>
56
- <div class="controls">
57
- <%= f.text_field :meta_keywords ,:style=>"width:600px;" %>
58
- <span class="help-block">A Comma seperated list of keywords for search engines. Keep it short (no more than 10 keywords)</span>
59
- </div>
62
+ <%else%>
63
+ <%= f.hidden_field :spud_user_id %>
64
+ <%end%>
65
+ <div class="control-group">
66
+ <%= f.label :visible, :class=>"control-label" %>
67
+ <div class="controls">
68
+ <%= f.check_box :visible %>
60
69
  </div>
61
- <div class="control-group">
62
- <%= f.label :meta_description, 'Description', :class=>"control-label" %>
63
- <div class="controls">
64
- <%= f.text_area :meta_description, :style =>"width:600px;height:40px;"%>
65
- <span class="help-block">A short description of the article. This is what appears on a search engines search result page.</span>
66
- </div>
70
+ </div>
71
+ <div class="control-group">
72
+ <%= f.label :meta_keywords, 'Keywords', :class=>"control-label" %>
73
+ <div class="controls">
74
+ <%= f.text_field :meta_keywords ,:style=>"width:600px;" %>
75
+ <span class="help-block">A Comma seperated list of keywords for search engines. Keep it short (no more than 10 keywords)</span>
67
76
  </div>
68
- <% unless @post.is_news %>
69
- <div class="control-group">
70
- <%= f.label :comments_enabled,"Comments Enabled", :class=>"control-label" %>
71
- <div class="controls">
72
- <%= f.check_box :comments_enabled %>
73
- </div>
77
+ </div>
78
+ <div class="control-group">
79
+ <%= f.label :meta_description, 'Description', :class=>"control-label" %>
80
+ <div class="controls">
81
+ <%= f.text_area :meta_description, :style =>"width:600px;height:40px;"%>
82
+ <span class="help-block">A short description of the article. This is what appears on a search engines search result page.</span>
74
83
  </div>
75
- <% end %>
76
- </ol>
77
- </fieldset>
78
- <%= f.hidden_field :is_news %>
79
-
80
- <div class="form-actions">
81
- <%=f.submit "Save Post", :class=>"btn btn-primary form-btn","data-loading-text"=>"Saving..."%> or <%=link_to "cancel",request.referer, :class => "btn"%>
82
- </div>
84
+ </div>
85
+ <% unless @post.is_news %>
86
+ <div class="control-group">
87
+ <%= f.label :comments_enabled,"Comments Enabled", :class=>"control-label" %>
88
+ <div class="controls">
89
+ <%= f.check_box :comments_enabled %>
90
+ </div>
91
+ </div>
92
+ <% end %>
93
+ </ol>
94
+ </fieldset>
95
+ <%= f.hidden_field :is_news %>
83
96
 
97
+ <div class="form-actions">
98
+ <%=f.submit "Save Post", :class=>"btn btn-primary form-btn","data-loading-text"=>"Saving..."%> or <%=link_to "cancel",request.referer, :class => "btn"%>
99
+ </div>
84
100
 
85
101
  <script type="text/javascript">
86
102
  $(document).ready(Spud.Admin.Posts.edit);
@@ -0,0 +1,11 @@
1
+ class CreateSpudPostSites < ActiveRecord::Migration
2
+ def change
3
+ create_table :spud_post_sites do |t|
4
+ t.integer :spud_post_id, :null => false
5
+ t.integer :spud_site_id, :null => false
6
+ t.timestamps
7
+ end
8
+ add_index :spud_post_sites, :spud_post_id
9
+ add_index :spud_post_sites, :spud_site_id
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = "0.8.12"
3
+ VERSION = "0.8.13"
4
4
  end
5
5
  end
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ spud_post_id: 1
5
+ spud_site_id: 1
6
+
7
+ two:
8
+ spud_post_id: 1
9
+ spud_site_id: 1
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class SpudPostSiteTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end