Skip to content
Browse files

updates for dashboard changes

  • Loading branch information...
1 parent b80c6ce commit 49dae8ff45d5b2f6eaf515f74131f4a5eac7f0b9 @saturnflyer committed Oct 11, 2010
Showing with 13 additions and 0 deletions.
  1. +10 −0 app/helpers/admin/blog_helper.rb
  2. +2 −0 app/views/admin/dashboard/_new_post_link.html.haml
  3. +1 −0 blog_extension.rb
View
10 app/helpers/admin/blog_helper.rb
@@ -9,6 +9,16 @@ def new_blog_post_url
result
end
+ def new_blog_post_path
+ result = ''
+ if valid_user_blog_location?(current_user.blog_location)
+ result = new_admin_page_child_path(user_blog_page)
+ elsif valid_user_blog_location?(@config['blog.location.default'])
+ result = new_admin_page_child_path(user_blog_page(@config['blog.location.default']))
+ end
+ result
+ end
+
def valid_user_blog_location?(location)
!location.blank? && !user_blog_page(location).blank?
end
View
2 app/views/admin/dashboard/_new_post_link.html.haml
@@ -0,0 +1,2 @@
+- unless new_blog_post_path.blank?
+ = link_to "Create a new post", new_blog_post_path
View
1 blog_extension.rb
@@ -23,6 +23,7 @@ def activate
if admin.respond_to?(:dashboard)
admin.dashboard.index.add :current_user_draft_pages_top, 'new_page_link'
admin.dashboard.index.add :current_user_published_pages_top, 'new_page_link'
+ admin.dashboard.index.add :user_action_list, 'new_post_link'
Admin::DashboardController.class_eval{
helper Admin::BlogHelper
}

0 comments on commit 49dae8f

Please sign in to comment.
Something went wrong with that request. Please try again.