code cleaning
This commit is contained in:
parent
1beb84161c
commit
d64f23e294
5 changed files with 19 additions and 89 deletions
3
Gemfile
3
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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 @@ class Admin::ProjectsController < ApplicationController
|
|||
@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 @@ class Admin::ProjectsController < ApplicationController
|
|||
@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
|
||||
|
|
|
@ -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 @@ class Admin::TeamMembersController < ApplicationController
|
|||
@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 @@ class Admin::TeamMembersController < ApplicationController
|
|||
@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 @@ class Admin::TeamMembersController < ApplicationController
|
|||
@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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue