mezuro_plugin_myprofile_controller.rb
1.48 KB
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
class MezuroPluginMyprofileController < MyProfileController
append_view_path File.join(File.dirname(__FILE__) + '/../views')
def index
@projects = MezuroPlugin::Project.by_profile(profile)
end
def new
@project = MezuroPlugin::Project.new
end
def create
@project = MezuroPlugin::Project.new(params[:project])
if @project.save
session[:notice] = _('Project successfully registered')
redirect_to :action => 'index'
else
render :action => 'new'
end
end
def edit
@project = MezuroPlugin::Project.find(params[:id])
end
def update
@project = MezuroPlugin::Project.find(params[:id])
if @project.update_attributes(params[:project])
session[:notice] = _('Project successfully updated')
redirect_to :action => 'index'
else
render :action => 'edit'
end
end
def show
@project = MezuroPlugin::Project.find_by_identifier params[:identifier]
@total_metrics = @project.total_metrics if @project != nil
@statistical_metrics = @project.statistical_metrics if @project != nil
@svn_error = @project.svn_error if (@project != nil && @project.svn_error)
end
def destroy
@project = MezuroPlugin::Project.by_profile(profile).find(params[:id])
if request.post?
if @project.destroy
session[:notice] = _('Project successfully removed.')
else
session[:notice] = _('Project was not successfully removed.')
end
redirect_to :action => 'index'
end
end
end