BigW Consortium Gitlab

releases_controller.rb 676 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
class Projects::ReleasesController < Projects::ApplicationController
  # Authorize
  before_action :require_non_empty_project
  before_action :authorize_download_code!
  before_action :authorize_push_code!
  before_action :tag
  before_action :release

  def edit
  end

  def update
13
    release.update_attributes(release_params)
14

15
    redirect_to namespace_project_tag_path(@project.namespace, @project, @tag.name)
16 17 18 19 20 21 22 23 24 25 26
  end

  private

  def tag
    @tag ||= @repository.find_tag(params[:tag_id])
  end

  def release
    @release ||= @project.releases.find_or_initialize_by(tag: @tag.name)
  end
27 28 29 30

  def release_params
    params.require(:release).permit(:description)
  end
31
end