class MilestonesController

Public Instance Methods

create() click to toggle source
# File app/controllers/milestones_controller.rb, line 42
def create
  @milestone = @project.milestones.new(params[:milestone])

  if @milestone.save
    redirect_to project_milestone_path(@project, @milestone)
  else
    render "new"
  end
end
destroy() click to toggle source
# File app/controllers/milestones_controller.rb, line 67
def destroy
  return access_denied! unless can?(current_user, :admin_milestone, @milestone)

  @milestone.destroy

  respond_to do |format|
    format.html { redirect_to project_milestones_path }
    format.js { render nothing: true }
  end
end
edit() click to toggle source
# File app/controllers/milestones_controller.rb, line 28
def edit
  respond_with(@milestone)
end
index() click to toggle source
# File app/controllers/milestones_controller.rb, line 13
def index
  @milestones = case params[:f]
                when 'all'; @project.milestones
                else @project.milestones.active
                end

  @milestones = @milestones.includes(:project).order("due_date")
  @milestones = @milestones.page(params[:page]).per(20)
end
new() click to toggle source
# File app/controllers/milestones_controller.rb, line 23
def new
  @milestone = @project.milestones.new
  respond_with(@milestone)
end
show() click to toggle source
# File app/controllers/milestones_controller.rb, line 32
def show
  @issues = @milestone.issues
  @users = @milestone.participants

  respond_to do |format|
    format.html
    format.js
  end
end
update() click to toggle source
# File app/controllers/milestones_controller.rb, line 52
def update
  @milestone.update_attributes(params[:milestone])

  respond_to do |format|
    format.js
    format.html do
      if @milestone.valid?
        redirect_to [@project, @milestone]
      else
        render :edit
      end
    end
  end
end

Protected Instance Methods

authorize_admin_milestone!() click to toggle source
# File app/controllers/milestones_controller.rb, line 84
def authorize_admin_milestone!
  return render_404 unless can?(current_user, :admin_milestone, @project)
end
milestone() click to toggle source
# File app/controllers/milestones_controller.rb, line 80
def milestone
  @milestone ||= @project.milestones.find(params[:id])
end
module_enabled() click to toggle source
# File app/controllers/milestones_controller.rb, line 88
def module_enabled
  return render_404 unless @project.issues_enabled
end