aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2011-12-14 15:47:22 -0800
committerPhilip Arndt <parndt@gmail.com>2011-12-14 15:47:22 -0800
commitcc316ceb5bdc6d00ab9fc7dfa4172a6504c06dde (patch)
tree63c6b654e48a88b5abaa93f63e7ca9dff7508d1c /app
parent3a7a9198a45a6f97866160cd862f44edd72bcba3 (diff)
parent04b49b2371c555363c25081564f02890dc85fa3b (diff)
downloadrefinerycms-blog-cc316ceb5bdc6d00ab9fc7dfa4172a6504c06dde.tar.gz
refinerycms-blog-cc316ceb5bdc6d00ab9fc7dfa4172a6504c06dde.tar.bz2
refinerycms-blog-cc316ceb5bdc6d00ab9fc7dfa4172a6504c06dde.zip
Merge pull request #157 from substantial/add_author_attribution
Add author attribution
Diffstat (limited to 'app')
-rw-r--r--app/controllers/refinery/admin/blog/posts_controller.rb10
-rw-r--r--app/views/refinery/admin/blog/posts/_form.html.erb9
2 files changed, 13 insertions, 6 deletions
diff --git a/app/controllers/refinery/admin/blog/posts_controller.rb b/app/controllers/refinery/admin/blog/posts_controller.rb
index 8b3816d..4645f3f 100644
--- a/app/controllers/refinery/admin/blog/posts_controller.rb
+++ b/app/controllers/refinery/admin/blog/posts_controller.rb
@@ -34,6 +34,10 @@ module Refinery
render :json => @tags.flatten
end
+ def new
+ @blog_post = ::Refinery::Blog::Post.new(:author => current_refinery_user)
+ end
+
def create
# if the position field exists, set this object as last object, given the conditions of this class.
if Refinery::Blog::Post.column_names.include?("position")
@@ -42,12 +46,6 @@ module Refinery
})
end
- if Refinery::Blog::Post.column_names.include?("user_id")
- params[:blog_post].merge!({
- :user_id => current_refinery_user.id
- })
- end
-
if (@blog_post = Refinery::Blog::Post.create(params[:blog_post])).valid?
(request.xhr? ? flash.now : flash).notice = t(
'refinery.crudify.created',
diff --git a/app/views/refinery/admin/blog/posts/_form.html.erb b/app/views/refinery/admin/blog/posts/_form.html.erb
index 822ec8a..f20c0cc 100644
--- a/app/views/refinery/admin/blog/posts/_form.html.erb
+++ b/app/views/refinery/admin/blog/posts/_form.html.erb
@@ -89,6 +89,15 @@
<%= f.text_field :custom_url, :class => "widest" %>
</div>
+ <div class='field'>
+ <span class='label_with_help'>
+ <%= f.label :user_id, t('.author') %>
+ <%= refinery_help_tag t('.author_help') %>
+ <br/>
+ <%= f.collection_select :user_id, ::Refinery::User.all, :id, :username %>
+ </span>
+ </div>
+
</div>
<div class='hemisquare right_side'>
<%= render :partial => '/seo_meta/form', :locals => {:form => f} %>