diff --git a/app/controllers/licenses_controller.rb b/app/controllers/licenses_controller.rb new file mode 100644 index 000000000..8639d7f32 --- /dev/null +++ b/app/controllers/licenses_controller.rb @@ -0,0 +1,5 @@ +class LicensesController < ApplicationController + def index + @licenses = License.search(params[:name]).without_content + end +end diff --git a/app/models/license.rb b/app/models/license.rb index dd1f27e83..952c4a13d 100644 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -1,2 +1,3 @@ class License < ApplicationRecord + include Projectable end diff --git a/app/views/licenses/index.json.jbuilder b/app/views/licenses/index.json.jbuilder new file mode 100644 index 000000000..706262a61 --- /dev/null +++ b/app/views/licenses/index.json.jbuilder @@ -0,0 +1 @@ +json.licenses @licenses, :id, :name diff --git a/config/routes.rb b/config/routes.rb index e58d43b86..ed5a2e719 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,6 +25,7 @@ Rails.application.routes.draw do resources :project_categories, only: [:index, :show] resources :project_languages, only: [:index, :show] resources :ignores, only: [:index, :show] + resources :licenses, only: [:index, :show] # resources :memos do # member do