Welcome to mirror list, hosted at ThFree Co, Russian Federation.

templates_controller.rb « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 694b468c8d37c775cc4cfcb19ba0b18966b25017 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Projects::TemplatesController < Projects::ApplicationController
  before_action :authenticate_user!, :get_template_class

  def show
    template = @template_type.find(params[:key], project)

    respond_to do |format|
      format.json { render json: template.to_json }
    end
  end

  private

  def get_template_class
    template_types = { issue: Gitlab::Template::IssueTemplate, merge_request: Gitlab::Template::MergeRequestTemplate }.with_indifferent_access
    @template_type = template_types[params[:template_type]]
    render json: [], status: 404 unless @template_type
  end
end