This repository has been archived by the owner on Aug 14, 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.
First pass at turning bumble into a rails 3 engine
- Loading branch information
Showing
156 changed files
with
293 additions
and
6,772 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 |
---|---|---|
@@ -1,17 +1,4 @@ | ||
source :rubygems | ||
source "http://rubygems.org" | ||
|
||
gem 'rails', '3.0.4' | ||
gem 'will_paginate', '~>3.0.pre2' | ||
gem 'gravtastic', '~>2.1.3' | ||
gem 'authlogic', '~>2.1.1' | ||
gem 'rdiscount' | ||
gem 'haml', '~>3.0.0' | ||
gem 'texticle' | ||
gem 'paperclip', '2.3.4' | ||
gem 'pg' | ||
gem 'aws-s3' | ||
gem 'permalink_fu' | ||
|
||
group :production do | ||
gem 'hassle', :git => 'git://github.com/koppen/hassle.git' | ||
end | ||
# Specify your gem's dependencies in bumble.gemspec | ||
gemspec |
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 |
---|---|---|
@@ -1,7 +1 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require File.expand_path('../config/application', __FILE__) | ||
require 'rake' | ||
|
||
Bumble::Application.load_tasks | ||
require 'bundler/gem_tasks' |
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 @@ | ||
# Bumble | ||
|
||
Blogging plugin provided as a rails engine |
2 changes: 1 addition & 1 deletion
2
app/controllers/application_controller.rb → app/controllers/bumble_controller.rb
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,67 +1,99 @@ | ||
class CommentsController < ApplicationController | ||
class CommentsController < BumbleController | ||
|
||
before_filter :require_user, :only => [:edit, :update, :destroy] | ||
|
||
make_resourceful do | ||
actions :all | ||
belongs_to :post | ||
before :create do | ||
current_object.user = current_user | ||
end | ||
|
||
response_for :index do |format| | ||
format.html { redirect_to post_path(parent_object, :anchor => 'comments') } | ||
format.atom {} | ||
format.js { render current_objects } | ||
end | ||
def create | ||
@post = Post.find(params[:post_id]) | ||
@comment = Comment.new(params[:comment]) | ||
@comment.user = current_user | ||
@comment.request = request | ||
@comment.post = @post | ||
|
||
response_for :show do |format| | ||
format.html { redirect_to post_path(parent_object, :anchor => dom_id(current_object)) } | ||
end | ||
|
||
response_for :destroy do |format| | ||
format.html do | ||
flash[:notice] = 'Record deleted!' | ||
redirect_to post_path(parent_object) | ||
end | ||
end | ||
|
||
response_for :update do |format| | ||
format.html do | ||
flash[:notice] = 'Save successful!' | ||
redirect_to post_path(parent_object, :anchor => dom_id(current_object)) | ||
if @comment.save | ||
respond_to do |format| | ||
format.html do | ||
if @comment.approved? | ||
flash[:notice] = 'Create successful!' | ||
else | ||
flash[:notice] = "Your comment looks like spam, it will show up once it's been approved." | ||
end | ||
redirect_to post_path(@post, :anchor => dom_id(@comment)) | ||
end | ||
format.js do | ||
if @comment.approved? | ||
render @comment, :content_type => :html | ||
else | ||
render :text => "Your comment looks like spam, it will show up once it's been approved.", :status => 406, :content_type => :html | ||
end | ||
end | ||
end | ||
end | ||
|
||
response_for :create do |format| | ||
format.html do | ||
flash[:notice] = 'Create successful!' | ||
redirect_to post_path(parent_object, :anchor => dom_id(current_object)) | ||
else | ||
respond_to do |format| | ||
format.html { render :action => "new" } | ||
format.js { render :text => @comment.errors.full_messages.join(', ').capitalize, :status => 403, :content_type => :html } | ||
end | ||
format.js { render current_object, :content_type => :html } | ||
end | ||
|
||
response_for :create_fails do |format| | ||
format.html { render :action => "new" } | ||
format.js { render :text => current_object.errors.full_messages.join(', ').capitalize, :status => 403, :content_type => :html } | ||
end | ||
|
||
def index | ||
@post = Post.find(params[:post_id]) | ||
@comments = @post.comments | ||
respond_to do |format| | ||
format.html { redirect_to post_path(@post, :anchor => 'comments') } | ||
format.atom {} | ||
format.js { render @comments } | ||
end | ||
|
||
response_for :destroy do |format| | ||
end | ||
|
||
def destroy | ||
@comment = Comment.find(params[:id]) | ||
@comment.destroy | ||
respond_to do |format| | ||
format.html do | ||
flash[:notice] = 'Record deleted!' | ||
redirect_to post_path(current_object.post) | ||
redirect_to post_path(@comment.post) | ||
end | ||
format.js { render :nothing => true } | ||
end | ||
end | ||
|
||
def update | ||
@post = Post.find(params[:post_id]) | ||
@comment = Comment.find(params[:id]) | ||
if @comment.update_attributes(params[:comment]) | ||
respond_to do |format| | ||
format.html do | ||
flash[:notice] = 'Save successful!' | ||
redirect_to post_path(@post, :anchor => dom_id(@comment)) | ||
end | ||
end | ||
else | ||
render :action => 'edit' | ||
end | ||
end | ||
|
||
def edit | ||
@comment = Comment.find(params[:id]) | ||
end | ||
|
||
def new | ||
@comment = Comment.new | ||
end | ||
|
||
private | ||
def show | ||
@comment = Comment.find(params[:id]) | ||
redirect_to post_path(@comment.post, :anchor => dom_id(@comment)) | ||
end | ||
|
||
def parent_model | ||
current_user ? super : Post.published.all_public | ||
def approve | ||
@comment = Comment.find(params[:id]) | ||
@comment.mark_as_ham! | ||
redirect_to post_path(@comment.post, :anchor => dom_id(@comment)) | ||
end | ||
|
||
def parent_object | ||
@parent_object ||= parent_model.find_by_permalink_or_id(params["#{parent_name}_id"]) | ||
def reject | ||
@comment = Comment.find(params[:id]) | ||
@comment.mark_as_spam! | ||
redirect_to post_path(@comment.post, :anchor => dom_id(@comment)) | ||
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
Oops, something went wrong.