Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion CHUCKSLIST-TODO
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TODO for v0.2 and beyond (in no particular order)
6. Add RSS feed for each category (instead of just a main one)
7. add ability to upload image(s) with your ad
8. add more tests (we started strong but then got sidetracked)
9. should we consider making ChucksList an ENGINE - such as
9. should we consider making ChucksList an ENGINE - such as
10. ability to flag posts as spam/miscategorized/etc.
11. do more to enforce banned authors (ban the IP?)
12. enhance functions for managing authors and ads in admin section
12 changes: 6 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Refer to /doc/INSTALL for setup instructions.

COPYRIGHT AND LICENSE
---------------------
ChucksList is Copyright (c) 2008 by Alexander Barbara and Kevin Ewe.
ChucksList is Copyright (c) 2008 by Alexander Barbara and Kevin Ewe.

ChucksList is open source software made available under the GNU GPL License v3. Refer to /doc/LICENSE for details.


WARRANTY
--------
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Expand Down
6 changes: 3 additions & 3 deletions app/controllers/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def signup
return unless request.post?
@user.save!
if !logged_in?
self.current_user = @user
self.current_user = @user
end
#redirect_back_or_default(:controller => '/account', :action => 'index')
#TODO - do redirection to calling page
Expand All @@ -39,11 +39,11 @@ def signup
flash[:notice] = "Thanks for signing up!"
redirect_to :controller => 'main', :action => 'index'
end

rescue ActiveRecord::RecordInvalid
render :action => 'signup'
end

def logout
self.current_user.forget_me if logged_in?
cookies.delete :auth_token
Expand Down
76 changes: 38 additions & 38 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
class AdminController < ApplicationController
include AuthenticatedSystem

before_filter :login_required

def index
if (!current_user.isAdmin)
redirect_to :controller => 'main', :action => 'index'
end
end

def manager
#@ads = Ad.find(:all)
@display_data = Ad.display_paged_data(params[:page])
end

def authors
@display_data = Author.display_paged_data(params[:page])
end

def category
@display_data = Category.display_paged_data(params[:page])
@parents = ParentCategory.find(:all)
@parent_categories = @parents.collect { |p| [p.name, p.id] }
end

def create_category
if request.post? && params[:new_category] != ""
begin
Expand All @@ -37,7 +37,7 @@ def create_category
end
redirect_to :action => 'category'
end

def delete_cat
if request.post?
cat = Category.find(params[:id])
Expand All @@ -47,11 +47,11 @@ def delete_cat
end
redirect_to :action => 'category'
end

def parent_category
@display_data = ParentCategory.display_paged_data(params[:page])
end

def create_parent_category
if request.post? && params[:parent_category] != ""
begin
Expand All @@ -65,7 +65,7 @@ def create_parent_category
end
redirect_to :action => 'parent_category'
end

def del_parent
#Add check for child dependencies in the model
if request.post?
Expand All @@ -75,7 +75,7 @@ def del_parent
redirect_to :action => 'parent_category'
end
end

def delete_author_and_ads
@author = Author.find_by_id(params[:id])
if request.post? && !@author.nil?
Expand All @@ -87,12 +87,12 @@ def delete_author_and_ads
end
redirect_to :action => "authors"
end


def user
@display_data = User.display_paged_data(params[:page])
end

def delete_user
#simple check to prevent last user to be deleted
if request.post? && User.count > 1
Expand All @@ -102,7 +102,7 @@ def delete_user
end
redirect_to :action => 'user'
end

def toggle_user_admin
if request.post?
user = User.find(params[:id])
Expand All @@ -117,7 +117,7 @@ def toggle_user_admin
end
redirect_to :action => 'user'
end

def expire_ad
if request.post?
ad = Ad.find(params[:id])
Expand All @@ -126,7 +126,7 @@ def expire_ad
end
redirect_to :action => 'manager'
end

def extend_ad
if request.post?
ad = Ad.find(params[:id])
Expand All @@ -135,7 +135,7 @@ def extend_ad
end
redirect_to :action => 'manager'
end

def reset_ad
if request.post?
ad = Ad.find(params[:id])
Expand All @@ -144,7 +144,7 @@ def reset_ad
end
redirect_to :action => 'manager'
end

def delete_ad
if request.post?
ad = Ad.find(params[:id])
Expand All @@ -153,17 +153,17 @@ def delete_ad
end
redirect_to :action => 'manager'
end

def destroy
if logged_in?
reset_session
flash[:notice] = 'You have successfully logged out'
flash[:notice] = 'You have successfully logged out'
end
redirect_to :controller => 'main', :action => 'index'
end

def change_password
if (params[:old_password].empty? || params[:new_password].empty? )
if (params[:old_password].empty? || params[:new_password].empty? )
flash[:warning] = 'Passwords cannot be empty'
render :action => 'pwd'
else
Expand All @@ -173,7 +173,7 @@ def change_password
begin
current_user.save!
flash[:notice] = 'Password successfully changed'
redirect_to :action => "index"
redirect_to :action => "index"
rescue ActiveRecord::RecordInvalid => e
flash[:warning] = "Could not change your password: #{e}"
render :action => 'pwd'
Expand All @@ -182,9 +182,9 @@ def change_password
flash[:warning] = 'You supplied the wrong password'
render :action => 'pwd'
end
end
end
end

def reset_password
@user = User.find_by_id(params[:id])
if request.post? && logged_in? && current_user.isAdmin && !@user.nil?
Expand All @@ -200,7 +200,7 @@ def reset_password
redirect_to :controller => "main", :action => "index"
end
end

def ban_user
@user = User.find_by_id(params[:id])
if request.post? && logged_in? && current_user.isAdmin && !@user.nil?
Expand All @@ -211,7 +211,7 @@ def ban_user
end
end
end

def unban_user
@user = User.find_by_id(params[:id])
if request.post? && logged_in? && current_user.isAdmin && !@user.nil?
Expand All @@ -222,17 +222,17 @@ def unban_user
end
end
end
# not needed for now


# not needed for now
# def edit_category
# @category = Category.find_by_id(params[:id])
# if @category.nil?
# flash[:warning] = 'Error Editing Category'
# redirect_to :action => 'index'
# end
# end

def update_category
# update the category
@category = Category.find_by_id(params[:id])
Expand All @@ -248,14 +248,14 @@ def update_category
flash[:warning] = "Error Updating Category"
end
end

# fail gracefully if non ajax
# (if we make this function ajax)
#respond_to do |format|
# format.html { redirect_to :action => "category" }
# format.js # will just execute the RJS
#end

redirect_to :action => 'category'
end

Expand All @@ -267,7 +267,7 @@ def update_category
# redirect_to :action => 'index'
# end
# end

def update_ad
@ad = Ad.find_by_id(params[:id])
if @ad.nil?
Expand All @@ -285,7 +285,7 @@ def update_ad
end
redirect_to :action => 'manager'
end

def update_parent_category
# update the category
@parent_category = ParentCategory.find_by_id(params[:id])
Expand Down Expand Up @@ -325,6 +325,6 @@ def update_parent_category
# redirect_to :action => 'user'
# end



end
Loading