You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
class ItemBanksController < ApplicationController
|
|
|
|
include PaginateHelper
|
|
|
|
before_action :require_login
|
|
|
|
|
|
|
|
def index
|
|
|
|
items = ItemBankQuery.call(params)
|
|
|
|
@items_count = items.size
|
|
|
|
@items = paginate items.includes(:item_analysis, :user)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
item = ItemBank.new(user: current_user)
|
|
|
|
ItemBank::SaveItemService.call(item, form_params)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def form_params
|
|
|
|
params.permit(:repertoire_id, :sub_repertoire_id, :item_type, :difficulty, :name, tag_repertoire_id: [], choices: [])
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|