# Class MilestonesController < ProjectResourceController

- app/controllers/milestones_controller.rb

Methods

A
  - authorize_admin_milestone!
C
  - create
D
  - destroy
E
  - edit
I
  - index
M
  - milestone,
  - module_enabled
N
  - new
S
  - show
U
  - update

Instance Public methods
create() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 44
    def create
      @milestone = @project.milestones.new(params[:milestone])
      @milestone.author_id_of_changes = current_user.id

      if @milestone.save
        redirect_to project_milestone_path(@project, @milestone)
      else
        render "new"
      end
    end

destroy() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 70
    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() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 29
    def edit
      respond_with(@milestone)
    end

index() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 13
    def index
      @milestones = case params[:f]
                    when 'all'; @project.milestones.order("closed, due_date DESC")
                    when 'closed'; @project.milestones.closed.order("due_date DESC")
                    else @project.milestones.active.order("due_date ASC")
                    end

      @milestones = @milestones.includes(:project)
      @milestones = @milestones.page(params[:page]).per(20)
    end

new() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 24
    def new
      @milestone = @project.milestones.new
      respond_with(@milestone)
    end

show() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 33
    def show
      @issues = @milestone.issues
      @users = UserDecorator.decorate(@milestone.participants)
      @merge_requests = @milestone.merge_requests

      respond_to do |format|
        format.html
        format.js
      end
    end

update() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 55
    def update
      @milestone.update_attributes(params[:milestone].merge(author_id_of_changes: current_user.id))

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

Instance Protected methods
authorize_admin_milestone!() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 87
    def authorize_admin_milestone!
      return render_404 unless can?(current_user, :admin_milestone, @project)
    end

milestone() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 83
    def milestone
      @milestone ||= @project.milestones.find(params[:id])
    end

module_enabled() Link

Source: show

    # File app/controllers/milestones_controller.rb, line 91
    def module_enabled
      return render_404 unless @project.issues_enabled
    end