gitlabhq/app/controllers/admin/team_members_controller.rb

51 lines
1.3 KiB
Ruby
Raw Normal View History

2011-10-08 23:36:38 +02:00
class Admin::TeamMembersController < ApplicationController
2011-11-02 16:21:17 +01:00
layout "admin"
2011-10-08 23:36:38 +02:00
before_filter :authenticate_user!
before_filter :authenticate_admin!
def index
@admin_team_members = UsersProject.page(params[:page]).per(100).order("project_id DESC")
end
def show
@admin_team_member = UsersProject.find(params[:id])
end
def new
@admin_team_member = UsersProject.new(params[:team_member])
end
def edit
@admin_team_member = UsersProject.find(params[:id])
end
def create
@admin_team_member = UsersProject.new(params[:team_member])
@admin_team_member.project_id = params[:team_member][:project_id]
2011-10-27 15:44:29 +02:00
if @admin_team_member.save
redirect_to admin_team_member_path(@admin_team_member), notice: 'UsersProject was successfully created.'
else
render action: "new"
2011-10-08 23:36:38 +02:00
end
end
def update
@admin_team_member = UsersProject.find(params[:id])
@admin_team_member.project_id = params[:team_member][:project_id]
2011-10-27 15:44:29 +02:00
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"
2011-10-08 23:36:38 +02:00
end
end
def destroy
@admin_team_member = UsersProject.find(params[:id])
@admin_team_member.destroy
2011-10-27 15:44:29 +02:00
redirect_to admin_team_members_url
2011-10-08 23:36:38 +02:00
end
end