From d64f23e29419c92c36a0f64917563336ed6012e3 Mon Sep 17 00:00:00 2001
From: gitlabhq <m@gitlabhq.com>
Date: Thu, 27 Oct 2011 16:44:29 +0300
Subject: [PATCH] code cleaning

---
 Gemfile                                       |  3 +-
 Gemfile.lock                                  |  2 -
 app/controllers/admin/projects_controller.rb  | 44 ++++---------------
 .../admin/team_members_controller.rb          | 44 ++++---------------
 app/controllers/admin/users_controller.rb     | 15 -------
 5 files changed, 19 insertions(+), 89 deletions(-)

diff --git a/Gemfile b/Gemfile
index 77a00659ac7b1..46320d221f288 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,7 +5,7 @@ gem 'rails', '3.1.0'
 gem 'sqlite3'
 gem 'devise', "1.4.7"
 gem 'stamp'
-gem 'will_paginate', '~> 3.0'
+gem 'kaminari'
 gem 'haml-rails'
 gem 'jquery-rails'
 gem 'grit', :git => 'git://github.com/gitlabhq/grit.git'
@@ -16,7 +16,6 @@ gem 'faker'
 gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git'
 gem "inifile"
 gem "pygments.rb", "0.2.3"
-gem "kaminari"
 gem "thin"
 gem "git"
 gem "acts_as_list"
diff --git a/Gemfile.lock b/Gemfile.lock
index 5ba3445975275..44faaad7b70ef 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -232,7 +232,6 @@ GEM
       multi_json (>= 1.0.2)
     warden (1.0.5)
       rack (>= 1.0)
-    will_paginate (3.0.0)
     xpath (0.1.4)
       nokogiri (~> 1.3)
 
@@ -274,4 +273,3 @@ DEPENDENCIES
   thin
   turn
   uglifier
-  will_paginate (~> 3.0)
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb
index 5575261959a69..a71136398fa9c 100644
--- a/app/controllers/admin/projects_controller.rb
+++ b/app/controllers/admin/projects_controller.rb
@@ -4,29 +4,14 @@ class Admin::ProjectsController < ApplicationController
 
   def index
     @admin_projects = Project.page(params[:page])
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @admin_projects }
-    end
   end
 
   def show
     @admin_project = Project.find_by_code(params[:id])
-
-    respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @admin_project }
-    end
   end
 
   def new
     @admin_project = Project.new
-
-    respond_to do |format|
-      format.html # new.html.erb
-      format.json { render json: @admin_project }
-    end
   end
 
   def edit
@@ -37,28 +22,20 @@ def create
     @admin_project = Project.new(params[:project])
     @admin_project.owner = current_user
 
-    respond_to do |format|
-      if @admin_project.save
-        format.html { redirect_to [:admin, @admin_project], notice: 'Project was successfully created.' }
-        format.json { render json: @admin_project, status: :created, location: @admin_project }
-      else
-        format.html { render action: "new" }
-        format.json { render json: @admin_project.errors, status: :unprocessable_entity }
-      end
+    if @admin_project.save
+      redirect_to [:admin, @admin_project], notice: 'Project was successfully created.'
+    else
+      render :action => "new"
     end
   end
 
   def update
     @admin_project = Project.find_by_code(params[:id])
 
-    respond_to do |format|
-      if @admin_project.update_attributes(params[:project])
-        format.html { redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.' }
-        format.json { head :ok }
-      else
-        format.html { render action: "edit" }
-        format.json { render json: @admin_project.errors, status: :unprocessable_entity }
-      end
+    if @admin_project.update_attributes(params[:project])
+      redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
+    else
+      render :action => "edit"
     end
   end
 
@@ -66,9 +43,6 @@ def destroy
     @admin_project = Project.find_by_code(params[:id])
     @admin_project.destroy
 
-    respond_to do |format|
-      format.html { redirect_to admin_projects_url }
-      format.json { head :ok }
-    end
+    redirect_to admin_projects_url
   end
 end
diff --git a/app/controllers/admin/team_members_controller.rb b/app/controllers/admin/team_members_controller.rb
index bca9bfebbfd20..8ae32bc661317 100644
--- a/app/controllers/admin/team_members_controller.rb
+++ b/app/controllers/admin/team_members_controller.rb
@@ -4,29 +4,14 @@ class Admin::TeamMembersController < ApplicationController
 
   def index
     @admin_team_members = UsersProject.page(params[:page]).per(100).order("project_id DESC")
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @admin_team_members }
-    end
   end
 
   def show
     @admin_team_member = UsersProject.find(params[:id])
-
-    respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @admin_team_member }
-    end
   end
 
   def new
     @admin_team_member = UsersProject.new(params[:team_member])
-
-    respond_to do |format|
-      format.html # new.html.erb
-      format.json { render json: @admin_team_member }
-    end
   end
 
   def edit
@@ -37,14 +22,10 @@ def create
     @admin_team_member = UsersProject.new(params[:team_member])
     @admin_team_member.project_id = params[:team_member][:project_id]
 
-    respond_to do |format|
-      if @admin_team_member.save
-        format.html { redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.' }
-        format.json { render json: @admin_team_member, status: :created, location: @team_member }
-      else
-        format.html { render action: "new" }
-        format.json { render json: @admin_team_member.errors, status: :unprocessable_entity }
-      end
+    if @admin_team_member.save
+      redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.'
+    else
+      render action: "new"
     end
   end
 
@@ -52,14 +33,10 @@ def update
     @admin_team_member = UsersProject.find(params[:id])
     @admin_team_member.project_id = params[:team_member][:project_id]
 
-    respond_to do |format|
-      if @admin_team_member.update_attributes(params[:team_member])
-        format.html { redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully updated.' }
-        format.json { head :ok }
-      else
-        format.html { render action: "edit" }
-        format.json { render json: @admin_team_member.errors, status: :unprocessable_entity }
-      end
+    if @admin_team_member.update_attributes(params[:team_member])
+      redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully updated.'
+    else
+      render action: "edit"
     end
   end
 
@@ -67,9 +44,6 @@ def destroy
     @admin_team_member = UsersProject.find(params[:id])
     @admin_team_member.destroy
 
-    respond_to do |format|
-      format.html { redirect_to admin_team_members_url }
-      format.json { head :ok }
-    end
+    redirect_to admin_team_members_url
   end
 end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index e9ad1e559838e..f6304e15ce0a7 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -4,29 +4,14 @@ class Admin::UsersController < ApplicationController
 
   def index
     @admin_users = User.page(params[:page])
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @admin_users }
-    end
   end
 
   def show
     @admin_user = User.find(params[:id])
-
-    respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @admin_user }
-    end
   end
 
   def new
     @admin_user = User.new(:projects_limit => 10)
-
-    respond_to do |format|
-      format.html # new.html.erb
-      format.json { render json: @admin_user }
-    end
   end
 
   def edit
-- 
GitLab