Class: ProjectsController
Instance Method Summary
collapse
included
#current_ability
#parent, #voluntary_application_javascripts, #voluntary_application_repository_path, #voluntary_application_stylesheets
included
Instance Method Details
#create ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/projects_controller.rb', line 25
def create
@project = Project.new(params[:project])
@project.user_id = current_user.id
if @project.save
redirect_to @project, notice: t('general.form.successfully_created')
else
render :new
end
end
|
#destroy ⇒ Object
47
48
49
50
|
# File 'app/controllers/projects_controller.rb', line 47
def destroy
@project.destroy
redirect_to projects_url, notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
36
37
|
# File 'app/controllers/projects_controller.rb', line 36
def edit
end
|
#index ⇒ Object
10
11
12
13
|
# File 'app/controllers/projects_controller.rb', line 10
def index
@parent = find_parent Project::PARENT_TYPES
@projects = @parent ? @parent.projects.order(:name) : Project.order(:name)
end
|
#new ⇒ Object
20
21
22
23
|
# File 'app/controllers/projects_controller.rb', line 20
def new
@parent = find_parent Project::PARENT_TYPES
@project = @parent ? @parent.projects.new : Project.new
end
|
#resource ⇒ Object
52
53
54
|
# File 'app/controllers/projects_controller.rb', line 52
def resource
@project
end
|
#show ⇒ Object
15
16
17
18
|
# File 'app/controllers/projects_controller.rb', line 15
def show
@project = Project.includes(:areas, :comments).friendly.find(params[:id])
@comments = @project.
end
|
#update ⇒ Object
39
40
41
42
43
44
45
|
# File 'app/controllers/projects_controller.rb', line 39
def update
if @project.update_attributes(params[:project])
redirect_to @project, notice: t('general.form.successfully_updated')
else
render :edit
end
end
|