知识点增加创建者

dev_jupyter
cxt 5 years ago
parent c2e47d2062
commit 86e637a6f9

@ -8,7 +8,7 @@ class Admins::TagDisciplinesController < Admins::BaseController
def create
name = params[:name].to_s.strip
return render_error('名称重复') if current_sub_discipline.tag_disciplines.where(name: name).exists?
TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id)
TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id, user_id: current_user.id)
render_ok
end

@ -1,5 +1,6 @@
class TagDiscipline < ApplicationRecord
belongs_to :sub_discipline
belongs_to :user
has_many :tag_discipline_containers, dependent: :destroy
def discipline

@ -2,7 +2,8 @@
<thead class="thead-light">
<tr>
<th width="6%">序号</th>
<th width="54%" class="text-left">知识点</th>
<th width="42%" class="text-left">知识点</th>
<th width="12%">创建者</th>
<th width="8%">实践课程</th>
<th width="8%">实训</th>
<th width="8%">题库</th>
@ -15,6 +16,13 @@
<tr class="tag-discipline-item tag-discipline-item-<%= tag.id %>">
<td><%= index + 1 %></td>
<td class="text-left"><%= tag.name %></td>
<td>
<% if tag.user.present? %>
<%= link_to tag.user.real_name, user_path(tag.user), :target => "_blank" %>
<% else %>
--
<% end %>
</td>
<td>
<% disabled = !(tag.sub_discipline&.subject && tag.discipline&.subject) %>
<%= check_box_tag :subject,!tag.subject,tag.subject,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %>

@ -1,5 +1,5 @@
class AddUserIdToTagDiscipline < ActiveRecord::Migration[5.2]
def change
add_column :tag_disciplines, :user_id, :integer
end
end

Loading…
Cancel
Save