Class: ProjectsController

Inherits:
ApplicationController
  • Object
show all
Includes:
ControllerMixins::Authorization
Defined in:
app/controllers/projects_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/projects_controller.rb', line 14

def create
  if @project.save
    flash[:notice] = t(:project_created_successfully)
    redirect_to @project
  else
    flash.now[:error] = t(:project_created_unsuccessfully)
    render :new
  end
end

#editObject



32
33
# File 'app/controllers/projects_controller.rb', line 32

def edit
end

#newObject



11
12
# File 'app/controllers/projects_controller.rb', line 11

def new
end

#showObject



24
25
26
27
28
29
30
# File 'app/controllers/projects_controller.rb', line 24

def show
  @bucket = Ticket.for_project(@project).sort_by_name

  @incomplete_tickets = @bucket.incomplete
  @complete_tickets = @bucket.complete
  @work_units = WorkUnit.for_project(@project).order("work_units.created_at DESC")
end

#updateObject



35
36
37
38
39
40
41
42
43
# File 'app/controllers/projects_controller.rb', line 35

def update
  if @project.update_attributes(params[:project])
    flash[:notice] = t(:project_updated_successfully)
    redirect_to @project
  else
    flash.now[:error] = t(:project_updated_unsuccessfully)
    render :edit
  end
end