blob: fd3c944b2892c28893c8fe60548943adabbc9854 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
class TeamMembersController < ApplicationController
before_filter :project
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_team_member!
before_filter :authorize_admin_team_member!, :only => [:new, :create, :destroy, :update]
def show
@team_member = project.users_projects.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
format.json { render json: @team_member }
end
end
def new
@team_member = project.users_projects.new
respond_to do |format|
format.html # new.html.erb
format.js
format.json { render json: @team_member }
end
end
def create
@team_member = UsersProject.new(params[:team_member])
@team_member.project = project
respond_to do |format|
if @team_member.save
format.html { redirect_to @team_member, notice: 'Team member was successfully created.' }
format.js
format.json { render json: @team_member, status: :created, location: @team_member }
else
format.html { render action: "new" }
format.js
format.json { render json: @team_member.errors, status: :unprocessable_entity }
end
end
end
def update
@team_member = project.users_projects.find(params[:id])
@team_member.update_attributes(params[:team_member])
respond_to do |format|
format.js
format.html { redirect_to team_project_path(@project)}
end
end
def destroy
@team_member = project.users_projects.find(params[:id])
@team_member.destroy
respond_to do |format|
format.html { redirect_to root_path }
format.json { head :ok }
format.js { render :nothing => true }
end
end
end
|