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.
- Loading branch information
Showing
227 changed files
with
4,504 additions
and
5,025 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 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,18 @@ | ||
class CommentsController < ApplicationController | ||
before_filter :load_new_comment, :only => [:create] | ||
|
||
protected | ||
def load_new_comment | ||
@comment = Comment.new(params[:comment]) | ||
end | ||
|
||
public | ||
def create | ||
if @comment.save | ||
flash[:notice] = "Comment was submitted successfully." | ||
else | ||
flash[:error] = "There was a problem with your comment." | ||
end | ||
redirect_to params[:return_path] | ||
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,27 @@ | ||
module CommentsHelper | ||
def show_comments_for(commentable) | ||
if commentable.settings["allow_comments"] | ||
render :partial => 'shared/comments', :locals => { :commentable => commentable } | ||
end | ||
end | ||
|
||
def show_comment_form_for(commentable, options={}) | ||
raise "No return path specified" unless options[:return_path] | ||
if commentable.settings["allow_comments"] | ||
comment = Comment.new | ||
comment.commentable = commentable | ||
render :partial => 'shared/comment_form', :locals => { :comment => comment, :commentable => commentable, :return_path => options[:return_path] } | ||
end | ||
end | ||
|
||
def show_comment(comment) | ||
render :partial => 'shared/comment', :locals => { :comment => comment } | ||
end | ||
|
||
def show_comment_info_link_for(commentable, options={}) | ||
raise "No path specified" unless options[:path] | ||
if commentable.settings["allow_comments"] | ||
render :partial => 'shared/comment_info_link', :locals => { :commentable => commentable, :path => options[:path] } | ||
end | ||
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,5 @@ | ||
module DashboardHelper | ||
def render_dashboard_box dashboard_box | ||
render :partial => 'shared/render_dashboard_box', :locals => { :dashboard_box => dashboard_box } | ||
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,14 @@ | ||
# Shamelessly taken from Typo (http://www.typosphere.org) | ||
|
||
module GravatarHelper | ||
# Generate the image tag for a commenters gravatar based on their email address | ||
# Valid options are described at http://www.gravatar.com/implement.php | ||
def gravatar_tag(email, options={}) | ||
options.update(:gravatar_id => Digest::MD5.hexdigest(email.strip)) | ||
options[:default] = CGI::escape(options[:default]) if options.include?(:default) | ||
options[:size] ||= 60 | ||
|
||
image_tag("http://www.gravatar.com/avatar.php?" << | ||
options.map { |key,value| "#{key}=#{value}" }.sort.join("&"), :class => "gravatar") | ||
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,38 @@ | ||
# 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" | ||
named_scope :for, lambda{ |klass| { :conditions => ["commentable_type = ?", klass] } } | ||
|
||
# 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
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,12 @@ | ||
<%= title "Dashboard" %> | ||
|
||
<div class='twocol'> | ||
<% Ansuz::PluginManagerInstance.admin_dashboard_boxes.in_groups(2).each_with_index do |half, i| %> | ||
<div class='col <%= "left" if i==0 %>'> | ||
<% half.compact.each do |dashboard_box| %> | ||
<%= render_dashboard_box dashboard_box %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<div class='clear'></div> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
app/views/admin/default_dashboard_boxes/_at_a_glance.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,13 @@ | ||
<ul class='at-a-glance'> | ||
<% Ansuz::PluginManagerInstance.at_a_glance_entries.each do |entry| %> | ||
<li> | ||
<em><%= entry[2].call %></em> | ||
<% if entry[1] # they provided an url | ||
%> | ||
<%= link_to entry[0], entry[1] %> | ||
<% else %> | ||
<%= entry[0] %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> |
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<% if page.page_plugins.any? -%> | ||
<% page.page_plugins.each_with_index do |plugin, i| -%> | ||
<%# render :partial => plugin.module_class.view_partial, :locals => { :plugin_module => plugin.module } -%> | ||
<div class='page-plugin page-plugin-<%= i -%>'> | ||
<%= render :partial => plugin.module.view_partial, :locals => { :plugin_module => plugin.module } -%> | ||
<% if logged_in? && get_setting('show_inline_edit_links') %> | ||
<div class='clear'></div> | ||
<% if current_user.can_author_content? %> | ||
<%= link_to "[Edit]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> | ||
<% elsif current_user.can_approve_content? %> | ||
<%= link_to "[Manage Content]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> | ||
<div class='page <%= page.permalinkable_title %>'> | ||
<% if page.page_plugins.any? -%> | ||
<% page.page_plugins.each_with_index do |plugin, i| -%> | ||
<%# render :partial => plugin.module_class.view_partial, :locals => { :plugin_module => plugin.module } -%> | ||
<div class='page-plugin page-plugin-<%= i -%>'> | ||
<%= render :partial => plugin.module.view_partial, :locals => { :plugin_module => plugin.module } -%> | ||
<% if logged_in? && get_setting('show_inline_edit_links') %> | ||
<div class='clear'></div> | ||
<% if current_user.can_author_content? %> | ||
<%= link_to "[Edit]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> | ||
<% elsif current_user.can_approve_content? %> | ||
<%= link_to "[Manage Content]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end -%> | ||
<% end -%> | ||
<% 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
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,14 @@ | ||
<div class='comment <%= cycle('odd', 'even') -%>'> | ||
<div class='grav'> | ||
<%= content_tag(:div, gravatar_tag(comment.email)) if comment.email %> | ||
</div> | ||
<div class='contents'> | ||
<div class='supplemental'> | ||
<cite><strong><%= comment.website.blank? ? comment.name : link_to(comment.name, comment.website) -%></cite></strong> | ||
said <%= distance_of_time_in_words(Time.now, comment.created_at) %> | ||
</div> | ||
<%= sanitize(comment.comments) %> | ||
</div> | ||
<div class='clear'></div> | ||
</div> | ||
<div class='clear'></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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<% form_for comment do |f| %> | ||
<h3>Post a Comment</h3> | ||
<table class='subdued'> | ||
<%= f.hidden_field(:commentable_type) %> | ||
<%= f.hidden_field(:commentable_id) %> | ||
<%= hidden_field_tag(:return_path, return_path) %> | ||
<%= form_row "Name:", f.text_field(:name) %> | ||
<%= form_row "Email:", f.text_field(:email) %> | ||
<%= form_row "Website:", f.text_field(:website) %> | ||
<%= form_row "Comments:", f.text_area(:comments) %> | ||
<%= form_row "", submit_tag("Post Comment") %> | ||
</table> | ||
<% 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 @@ | ||
<%= link_to pluralize(commentable.comments.count, "comment"), path + "#comments" %> |
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,8 @@ | ||
<div class='comments' id='comments'> | ||
<% if commentable.comments.any? %> | ||
<h3>Comments</h3> | ||
<% commentable.comments.find(:all, :order => 'created_at DESC').each do |comment| %> | ||
<%= show_comment(comment) %> | ||
<% end %> | ||
<% 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<% render :layout => 'shared/dashboard_box', :locals => { :title => dashboard_box[0] } do %> | ||
<%= render :partial => dashboard_box[1] %> | ||
<% 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,23 @@ | ||
# Linux example follows: | ||
development: | ||
adapter: mysql | ||
database: ansuz_development | ||
username: root | ||
password: | ||
host: localhost | ||
#socket: /tmp/mysql.sock | ||
socket: /var/run/mysqld/mysqld.sock | ||
|
||
test: | ||
database: ansuz_test | ||
adapter: mysql | ||
username: root | ||
host: localhost | ||
socket: /var/run/mysqld/mysqld.sock | ||
|
||
production: | ||
adapter: mysql | ||
database: ansuz_production | ||
username: root | ||
password: | ||
host: localhost |
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
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
Oops, something went wrong.