updated readme

This commit is contained in:
Mike Kelley
2011-08-27 01:41:48 -06:00
commit 17fee3c6d5
98 changed files with 11421 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end

View File

@@ -0,0 +1,26 @@
class CategoriesController < ApplicationController
load_and_authorize_resource :category
def create
if @category.save
flash[:notice] = "Category was successfully created."
redirect_to forums_url
else
render :action => 'new'
end
end
def update
if @category.update_attributes(params[:category])
flash[:notice] = "Category was updated successfully."
redirect_to forums_url
end
end
def destroy
if @category.destroy
flash[:notice] = "Category was deleted."
redirect_to forums_url
end
end
end

View File

@@ -0,0 +1,27 @@
class ForumsController < ApplicationController
load_and_authorize_resource :category
load_and_authorize_resource :forum, :through => :category, :shallow => true
def create
if @forum.save
flash[:notice] = "Forum was successfully created."
redirect_to forums_url
else
render :action => 'new'
end
end
def update
if @forum.update_attributes(params[:forum])
flash[:notice] = "Forum was updated successfully."
redirect_to forum_url(@forum)
end
end
def destroy
if @forum.destroy
flash[:notice] = "Category was deleted."
redirect_to forums_url
end
end
end

View File

@@ -0,0 +1,45 @@
class PostsController < ApplicationController
load_and_authorize_resource :topic
load_and_authorize_resource :post, :through => :topic, :shallow => true
def new
if params[:quote]
quote_post = Post.find(params[:quote])
if quote_post
@post.body = "[quote]#{quote_post.body}[/quote]"
end
end
end
def create
@post.user = current_user
if @post.save
flash[:notice] = "Post was successfully created."
redirect_to topic_path(@post.topic)
else
render :action => 'new'
end
end
def update
if @post.update_attributes(params[:post])
flash[:notice] = "Post was successfully updated."
redirect_to topic_path(@post.topic)
end
end
def destroy
if @post.topic.posts_count > 1
if @post.destroy
flash[:notice] = "Post was successfully destroyed."
redirect_to topic_path(@post.topic)
end
else
if @post.topic.destroy
flash[:notice] = "Topic was successfully deleted."
redirect_to forum_path(@post.forum)
end
end
end
end

View File

@@ -0,0 +1,34 @@
class TopicsController < ApplicationController
load_and_authorize_resource :forum
load_and_authorize_resource :topic, :through => :forum, :shallow => true
def show
@topic.hit! if @topic
end
def create
@topic.user = current_user
if @topic.save
flash[:notice] = "Topic was successfully created."
redirect_to topic_url(@topic)
else
render :action => 'new'
end
end
def update
if @topic.update_attributes(params[:topic])
flash[:notice] = "Topic was updated successfully."
redirect_to topic_url(@topic)
end
end
def destroy
if @topic.destroy
flash[:notice] = "Topic was deleted successfully."
redirect_to forum_url(@topic.forum)
end
end
end