Compare commits
1 Commits
master
...
dev_gitlab
| Author | SHA1 | Date |
|---|---|---|
|
|
1fc8e54b1d |
|
|
@ -108,6 +108,8 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 实训状态低于未发布,则强制重置实训,已发布则记录修改的文件路径,便于TPI中重置代码
|
||||
# repository_path数据没有就增加,tpi重置完成将status置为0,便于统计用户行为
|
||||
def entry_update
|
||||
g = Gitlab.client
|
||||
@path = params[:path]
|
||||
|
|
@ -116,6 +118,13 @@ class ShixunsController < ApplicationController
|
|||
code_file = g.edit_file(@shixun.gpid, :content => params[:content], :file_path => @path, :branch_name => @rev, :commit_message => "shixun entry")
|
||||
if @shixun.try(:status).to_i < 2
|
||||
shixun_modify_status_without_publish(@shixun, 1)
|
||||
else
|
||||
@shixun.myshixuns.each do |myshixun|
|
||||
# 不重复增加记录,但可能会有多条
|
||||
if RepositoryPath.where(:myshixun_id => myshixun.id, :path => @path, :status => 1).first.blank?
|
||||
RepositoryPath.create(:path => @path, :myshixun_id => myshixun.id, :user_id => User.current.id, :status => 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
class RepositoryPath < ActiveRecord::Base
|
||||
attr_accessible :myshixun_id, :path, :status, :user_id
|
||||
end
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @shixun.try(:status).to_i < 2 %>
|
||||
<% if @shixun.try(:status).to_i < 2 || User.current.admin? %>
|
||||
<% if params[:controller] == "shixuns" && params[:action] == "entry_edit" %>
|
||||
<a href="javascript:void(0);" onclick="$('#shixun_entry_update_id').submit();" class = "fl mr5">保存</a>
|
||||
<% elsif params[:action] == "shixun_entry" || params[:action] == "entry_update" %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
class CreateRepositoryPaths < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :repository_paths do |t|
|
||||
t.string :path
|
||||
t.integer :myshixun_id
|
||||
t.integer :user_id
|
||||
t.integer :status
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue