labels_controller.rb 627 Bytes
Newer Older
1
class Projects::LabelsController < Projects::ApplicationController
randx's avatar
randx committed
2 3
  before_filter :module_enabled

4
  before_filter :authorize_labels!
randx's avatar
randx committed
5 6 7 8

  respond_to :js, :html

  def index
9
    @labels = @project.issues_labels
randx's avatar
randx committed
10 11
  end

12
  def generate
13
    Gitlab::IssuesLabels.generate(@project)
14

15 16 17 18 19
    if params[:redirect] == 'issues'
      redirect_to project_issues_path(@project)
    elsif params[:redirect] == 'merge_requests'
      redirect_to project_merge_requests_path(@project)
    end
20 21
  end

randx's avatar
randx committed
22 23 24
  protected

  def module_enabled
25 26 27
    unless @project.issues_enabled || @project.merge_requests_enabled
      return render_404
    end
randx's avatar
randx committed
28 29
  end
end