Class: ProjectsController
Instance Method Summary
collapse
#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #save_current_project, #set_current_project, #unfurling?
Methods included from UrlHelper
#edit_release_path, #edit_release_url, #feature_path, #github_commit_range_url, #github_commit_url, #github_project_url, #github_url?, #goldmine_case_number_url, #link_to_project_feature, #new_release_url, #release_path, #release_url, #releases_path
Instance Method Details
#create ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/projects_controller.rb', line 40
def create
@project = Project.new(project_attributes)
if @project.save
redirect_to projects_path, notice: 'Project was successfully created.'
else
flash.now[:error] = @project.errors[:base].join("\n")
render action: "new"
end
end
|
#destroy ⇒ Object
71
72
73
74
75
76
|
# File 'app/controllers/projects_controller.rb', line 71
def destroy
@project = Project.find_by_slug!(params[:id])
@project.destroy
redirect_to projects_url
end
|
#edit ⇒ Object
32
33
34
35
36
37
|
# File 'app/controllers/projects_controller.rb', line 32
def edit
@project = Project.find_by_slug!(params[:id])
@project.roles.build(user: current_user) if @project.roles.none?
@title = "Edit #{@project.name}"
end
|
#index ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'app/controllers/projects_controller.rb', line 7
def index
@title = "Projects"
@projects = Project \
.includes(:owners)
.includes(:maintainers)
.unretired
.map { |project| ProjectDependencies.new(project) }
@test_runs = TestRun.most_recent.index_by(&:project_id)
@releases = Release.where(environment_name: "production").most_recent.index_by(&:project_id)
end
|
#new ⇒ Object
24
25
26
27
28
29
|
# File 'app/controllers/projects_controller.rb', line 24
def new
@title = "New Project"
@project = Project.new
@project.roles.build(user: current_user) if @project.roles.none?
end
|
#retire ⇒ Object
64
65
66
67
68
|
# File 'app/controllers/projects_controller.rb', line 64
def retire
@project = Project.find_by_slug!(params[:id])
@project.retire!
redirect_to projects_path, notice: "#{@project.name} was successfully retired."
end
|
#show ⇒ Object
19
20
21
|
# File 'app/controllers/projects_controller.rb', line 19
def show
redirect_to projects_path
end
|
#update ⇒ Object
52
53
54
55
56
57
58
59
60
61
|
# File 'app/controllers/projects_controller.rb', line 52
def update
@project = Project.find_by_slug!(params[:id])
if @project.update_attributes(project_attributes)
redirect_to projects_path, notice: 'Project was successfully updated.'
else
flash.now[:error] = @project.errors[:base].join("\n")
render action: "edit"
end
end
|