This repository has been archived by the owner on Aug 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added admin dashboard, api for adding boxes to the admin dashboard. A…
…dded recent comments dashboard box to the blog plugin, as a proof of concept.
- Loading branch information
Josh Adams
committed
Jan 27, 2009
1 parent
5aa3349
commit 36e276d
Showing
12 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Admin::DashboardsController < Admin::BaseController | ||
# NOTE: Can grab a user-specific settings collection here, or we could make it site-specific. Should be decided. | ||
|
||
def show | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# This was copied from the acts_as_commentable plugin, and I'm changing it a bit - JA | ||
class Comment < ActiveRecord::Base | ||
belongs_to :commentable, :polymorphic => true | ||
|
||
# NOTE: install the acts_as_votable plugin if you | ||
# want user to vote on the quality of comments. | ||
#acts_as_voteable | ||
|
||
# NOTE: Comments belong to a user | ||
belongs_to :user | ||
|
||
named_scope :recent, :limit => 5, :order => "created_at DESC" | ||
|
||
# Helper class method to lookup all comments assigned | ||
# to all commentable types for a given user. | ||
def self.find_comments_by_user(user) | ||
find(:all, | ||
:conditions => ["user_id = ?", user.id], | ||
:order => "created_at DESC" | ||
) | ||
end | ||
|
||
# Helper class method to look up all comments for | ||
# commentable class name and commentable id. | ||
def self.find_comments_for_commentable(commentable_str, commentable_id) | ||
find(:all, | ||
:conditions => ["commentable_type = ? and commentable_id = ?", commentable_str, commentable_id], | ||
:order => "created_at DESC" | ||
) | ||
end | ||
|
||
# Helper class method to look up a commentable object | ||
# given the commentable class name and id | ||
def self.find_commentable(commentable_str, commentable_id) | ||
commentable_str.constantize.find(commentable_id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<%= title "Dashboard" %> | ||
<% Ansuz::PluginManagerInstance.admin_dashboard_boxes.each do |dashboard_box| %> | ||
<% render :layout => 'shared/dashboard_box', :locals => { :title => dashboard_box[0] } do %> | ||
<%= render :partial => dashboard_box[1] %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class='dashboard_box'> | ||
<h3><%= title -%></h3> | ||
<div class='subdued contents'> | ||
<%= yield -%> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
vendor/plugins/ansuz_blog/app/views/articles/_recent_comments_admin_dashboard_box.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class='comments'> | ||
<% Comment.recent.each do |comment| %> | ||
<%= show_comment comment %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters