Merge branch 'develop' into dev_cs
This commit is contained in:
commit
87285f5b45
|
|
@ -107,12 +107,15 @@ class CoursesController < ApplicationController
|
|||
def sync_students
|
||||
school_id = User.find(@course.tea_id).try(:user_extensions).try(:school_id)
|
||||
@import_attachments = Attachment.where(:container_id => @course.id, :container_type => "ImportStudent")
|
||||
@had_import_count = 0
|
||||
@list_count = 0
|
||||
if @import_attachments.present?
|
||||
@import_attachments.each do |attachment|
|
||||
path = attachment.disk_directory
|
||||
name = attachment.disk_filename
|
||||
if name.split(".").last == "xls" || name.split(".").last == "xlsx"
|
||||
lists = readData("files/#{path}/#{name}")
|
||||
@list_count += lists.count
|
||||
lists.each do |list|
|
||||
logger.info("#{list[0]}---#{list[1]}")
|
||||
user = User.find_by_sql("SELECT u.* FROM `users` u, `user_extensions` ue where u.id = ue.user_id and CONCAT(u.lastname,u.firstname) ='#{list[1]}' and ue.school_id='#{school_id}' and ue.student_id='#{list[0]}'").first
|
||||
|
|
@ -122,10 +125,10 @@ class CoursesController < ApplicationController
|
|||
members << Member.new(:role_ids => [10], :user_id => user.id)
|
||||
@course.members << members
|
||||
StudentsForCourse.create(:student_id => user.id, :course_id => @course.id)
|
||||
@had_import_count += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@members = @course.members.joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id asc").select{|m| m.roles.to_s.include?("Student")}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ class DiscussesController < ApplicationController
|
|||
def create
|
||||
if @model
|
||||
if params[:reply_id].blank?
|
||||
@model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :praise_count => 0)
|
||||
@model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :praise_count => 0, :challenge_id => params[:challenge_id])
|
||||
else
|
||||
@model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :parent_id => params[:reply_id], :root_id => params[:reply_id], :praise_count => 0)
|
||||
@model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :parent_id => params[:reply_id], :root_id => params[:reply_id], :praise_count => 0, :challenge_id => params[:challenge_id])
|
||||
end
|
||||
if params[:dis_type] == "Shixun"
|
||||
redirect_to shixun_discuss_shixun_path(@model)
|
||||
redirect_to shixun_discuss_shixun_path(@model, :challenge_id => params[:challenge_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -543,8 +543,11 @@ update
|
|||
# token值解密
|
||||
# gitlab_token = aes_dicrypt("priEn3UwXfJs3Pmy", token)
|
||||
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @shixun.gpid.to_s + "/repository/archive?&private_token=" + token
|
||||
|
||||
login = User.find_by_mail("educoder@163.com").try(:login)
|
||||
if @shixun.fork_from.present?
|
||||
login = User.find_by_mail("eduforge@163.com").try(:login)
|
||||
else
|
||||
login = User.find_by_mail("educoder@163.com").try(:login)
|
||||
end
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
@repos_url = git_shixun_url(@shixun, login)
|
||||
# @repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class ShixunsController < ApplicationController
|
|||
def statistics_students
|
||||
|
||||
end
|
||||
|
||||
# push代码的时候会触发gitlab hook
|
||||
def ghook
|
||||
# shixun_modify_status_without_publish(@shixun, 1)
|
||||
|
|
@ -223,7 +224,7 @@ class ShixunsController < ApplicationController
|
|||
ShixunMember.create!(:user_id => member, :shixun_id => @shixun.id, :role => 2)
|
||||
u = s.g.add_team_member(@shixun.gpid, gid, 40) # 3代表角色master
|
||||
if u.blank?
|
||||
raise("同步Gitlab数据错误")
|
||||
raise("同步Gitlab数据失败")
|
||||
end
|
||||
end
|
||||
@collaborators = @shixun.collaborators
|
||||
|
|
@ -407,7 +408,7 @@ class ShixunsController < ApplicationController
|
|||
myshixun.update_column(:gpid, gshixun.id) if myshixun.try(:gpid).blank? # 为了防止多次fork
|
||||
rep = Repository.create!(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)
|
||||
rep.update_column(:type, "Repository::Gitlab")
|
||||
rep_url = Base64.urlsafe_encode64(git_shixun_url_ip @shixun, "educoder") # 注意:educoder为默认给实训创建版本库的用户,如果换成别的用户,名字要相应的修改
|
||||
rep_url = Base64.urlsafe_encode64(git_shixun_url_ip @shixun, (@shixun.try(:fork_from).blank? ? "educoder" : "eduforge")) # 注意:educoder为默认给实训创建版本库的用户,如果换成别的用户,名字要相应的修改
|
||||
logger.info("start openGameInstance")
|
||||
uri = "#{shixun_tomcat}/bridge/game/openGameInstance"
|
||||
logger.info("end openGameInstance")
|
||||
|
|
@ -490,6 +491,7 @@ class ShixunsController < ApplicationController
|
|||
#@shixun.major_id = params[:major_id]
|
||||
@shixun.trainee = params[:trainee]
|
||||
@shixun.webssh = params[:webssh].to_i
|
||||
@shixun.can_copy = params[:can_copy].to_i
|
||||
@shixun.identifier = identifier
|
||||
# if params[:course_id]
|
||||
# params[:course_id].each do |course_id|
|
||||
|
|
@ -518,9 +520,9 @@ class ShixunsController < ApplicationController
|
|||
s = Trustie::Gitlab::Sync.new
|
||||
gproject = s.create_shixun(@shixun, repository)
|
||||
raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功,则抛出异常
|
||||
g = Gitlab.client
|
||||
hook_url = Setting.protocol + "://" + Setting.host_name + "/shixuns/#{@shixun.identifier}" + "/ghook"
|
||||
g.add_project_hook(@shixun.gpid, hook_url)
|
||||
# g = Gitlab.client
|
||||
# hook_url = Setting.protocol + "://" + Setting.host_name + "/shixuns/#{@shixun.identifier}" + "/ghook"
|
||||
# g.add_project_hook(@shixun.gpid, hook_url)
|
||||
redirect_to shixun_path @shixun, notice: l(:notice_successful_create)
|
||||
rescue Exception => e
|
||||
respond_to do |format|
|
||||
|
|
@ -532,6 +534,119 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def copy
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
new_shixun = Shixun.new
|
||||
new_shixun.attributes = @shixun.attributes.dup.except("id","user_id","visits","gpid","status", "identifier", "homepage_show")
|
||||
new_shixun.user_id = User.current.id
|
||||
new_shixun.identifier = generate_identifier
|
||||
new_shixun.status = 0
|
||||
new_shixun.fork_from = @shixun.id
|
||||
new_shixun.save!
|
||||
# 同步复制版本库,先fork再修改版本库名
|
||||
# eduforge用户作为版本库的创建者
|
||||
repository = Repository.new
|
||||
repository.shixun = new_shixun
|
||||
repository.type = 'Repository::Gitlab'
|
||||
repository.identifier = new_shixun.identifier.downcase
|
||||
repository.project_id = -1
|
||||
repository.save!
|
||||
g = Gitlab.client
|
||||
user_gid = User.find_by_mail("eduforge@163.com").try(:gid)
|
||||
gshixun = g.fork(@shixun.gpid, user_gid)
|
||||
raise "版本库创建失败" if gshixun.try(:id).blank?
|
||||
gshixun = g.edit_project(gshixun.id, new_shixun.identifier, new_shixun.identifier)
|
||||
raise "版本库创建失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier)
|
||||
new_shixun.update_column(:gpid, gshixun.id)
|
||||
|
||||
# 同步复制合作者,合作者加入到gitlab
|
||||
@shixun.shixun_members.each do |shixun_member|
|
||||
if ShixunMember.where(:shixun_id => new_shixun.try(:id), :user_id => shixun_member.user_id).blank?
|
||||
ShixunMember.create!(:user_id => shixun_member.try(:user_id), :shixun_id => new_shixun.try(:id),
|
||||
:role => (shixun_member.try(:user_id) == User.current.id ? 1 : 2))
|
||||
end
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
gid = User.find(shixun_member.user_id).try(:gid)
|
||||
u = s.g.add_team_member(gshixun.id, gid, 40) # 3代表角色master
|
||||
if u.blank?
|
||||
raise("同步Gitlab数据失败")
|
||||
end
|
||||
end
|
||||
# 同步复制关卡
|
||||
if @shixun.challenges.present?
|
||||
@shixun.challenges.each do |challenge|
|
||||
new_challenge = Challenge.new
|
||||
new_challenge.attributes = challenge.attributes.dup.except("id","shixun_id","user_id")
|
||||
new_challenge.user_id = User.current.id
|
||||
new_challenge.shixun_id = new_shixun.id
|
||||
new_challenge.save!
|
||||
if challenge.st == 0 # 评测题
|
||||
# 同步测试集
|
||||
if challenge.test_sets.present?
|
||||
challenge.test_sets.each do |test_set|
|
||||
new_test_set = TestSet.new
|
||||
new_test_set.attributes = test_set.attributes.dup.except("id","challenge_id")
|
||||
new_test_set.challenge_id = new_challenge.id
|
||||
new_test_set.save!
|
||||
end
|
||||
end
|
||||
# 同步关卡标签
|
||||
challenge_tags = ChallengeTag.where("challenge_id =? and challenge_choose_id is null", challenge.id)
|
||||
if challenge_tags.present?
|
||||
challenge_tags.each do |challenge_tag|
|
||||
ChallengeTag.create!(:challenge_id => new_challenge.id, :name => challenge_tag.try(:name))
|
||||
end
|
||||
end
|
||||
elsif challenge.st == 1 # 选择题
|
||||
if challenge.challenge_chooses.present?
|
||||
challenge.challenge_chooses.each do |challenge_choose|
|
||||
new_challenge_choose = ChallengeChoose.new
|
||||
new_challenge_choose.attributes = challenge_choose.attributes.dup.except("id","challenge_id")
|
||||
new_challenge_choose.challenge_id = new_challenge.id
|
||||
new_challenge_choose.save!
|
||||
# 每一题的选项
|
||||
if challenge_choose.challenge_questions.present?
|
||||
challenge_choose.challenge_questions.each do |challenge_question|
|
||||
new_challenge_question = ChallengeQuestion.new
|
||||
new_challenge_question.attributes = challenge_question.attributes.dup.except("id","challenge_choose_id")
|
||||
new_challenge_question.challenge_choose_id = new_challenge_choose.id
|
||||
new_challenge_question.save!
|
||||
end
|
||||
end
|
||||
# 每一题的知识标签
|
||||
st_challenge_tags = ChallengeTag.where(:challenge_id => challenge.id, :challenge_choose_id => challenge_choose.id)
|
||||
if st_challenge_tags.present?
|
||||
st_challenge_tags.each do |st_challenge_tag|
|
||||
ChallengeTag.create!(:challenge_id => new_challenge.id, :name => st_challenge_tag.try(:name), :challenge_choose_id => new_challenge_choose.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# 中间层创建测试集
|
||||
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
|
||||
gameInfo = new_shixun.gameInfo
|
||||
uri ="#{shixun_tomcat}/bridge/game/publishGame"
|
||||
params = {gameInfo:gameInfo}
|
||||
res = uri_exec uri, params
|
||||
if res && res['code'].to_i != 0
|
||||
raise("实训云平台繁忙(繁忙等级:90)")
|
||||
end
|
||||
flash[:notice] = "实训复制成功"
|
||||
redirect_to shixun_challenges_path(new_shixun)
|
||||
rescue Exception => e
|
||||
logger.info("copy shixun failed ##{e.message}")
|
||||
flash[:notice] = "#{e.message}"
|
||||
g.delete_project(gshixun.id) if gshixun.try(:id).present? # 异常后,如果已经创建了版本库需要删除该版本库
|
||||
redirect_to shixun_challenges_path(@shixun)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html{redirect_to shixun_challenges_path(@shixun)}
|
||||
|
|
@ -564,6 +679,7 @@ class ShixunsController < ApplicationController
|
|||
@shixun.language = params[:language]
|
||||
@shixun.trainee = params[:trainee]
|
||||
@shixun.webssh = params[:webssh].to_i
|
||||
@shixun.can_copy = params[:can_copy].to_i
|
||||
# if params[:course_id]
|
||||
# @shixun.shixun_major_courses.destroy_all
|
||||
# params[:course_id].each do |course_id|
|
||||
|
|
@ -606,6 +722,8 @@ class ShixunsController < ApplicationController
|
|||
@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1
|
||||
@offset ||= @discusses_pages.offset
|
||||
@discusses = paginateHelper @discusses, @limit
|
||||
#@game_challenge = params[:challenge_id].blank? ? Challenge.find(@discusses.challenge_id) : Challenge.find(params[:challenge_id])
|
||||
@game_challenge = Challenge.find(params[:challenge_id].to_i)
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class Discuss < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
attr_accessible :user_id, :content, :dis_id, :dis_type, :parent_id, :praise_count, :root_id
|
||||
attr_accessible :user_id, :content, :dis_id, :dis_type, :parent_id, :praise_count, :root_id, :challenge_id
|
||||
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
class Shixun < ActiveRecord::Base
|
||||
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language, :identifier, :authentication,
|
||||
:myshixun_count, :propaedeutics, :trainee, :major_id, :homepage_show, :webssh, :hidden
|
||||
:myshixun_count, :propaedeutics, :trainee, :major_id, :homepage_show, :webssh, :hidden, :fork_from, :can_copy
|
||||
|
||||
has_many :users, :through => :shixun_members
|
||||
has_many :shixun_members, :dependent => :destroy
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
<script src="/javascripts/jquery.datetimepicker.js" type="text/javascript"></script>
|
||||
<div class="task-popup" style="width:450px;">
|
||||
<div class="task-popup-title clearfix">
|
||||
<h3 class="fl color-grey">上传文件</h3>
|
||||
<a href="javascript:void(0);" onclick="$('#datetimepicker_mask').datetimepicker('destroy');" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
</div>
|
||||
<div class="task-popup-content clear">
|
||||
<div class="ml15">
|
||||
本次新加入<%= @had_import_count %>个学生,还有<%= @list_count - @had_import_count %>个学生没有加入
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1 +1,6 @@
|
|||
$("#setting_teacher_list").html("<%= j(render :partial => 'courses/settings/all_student_list') %>").show();
|
||||
$("#setting_teacher_list").hide();
|
||||
$("#setting_student_list").html("<%= j(render :partial => 'courses/settings/all_student_list') %>").show();
|
||||
<% if @had_import_count > 0 %>
|
||||
var htmlvalue = '<%= escape_javascript(render :partial => 'courses/settings/import_students_result', :locals => {:course => @course}) %>';
|
||||
pop_box_new(htmlvalue, 440, 490);
|
||||
<% end %>
|
||||
|
|
@ -204,8 +204,8 @@
|
|||
console.log(data.score);
|
||||
console.log(data.tag_count);
|
||||
console.log($("#shixun_exp_<%=@game_challenge.id %>")[0]);
|
||||
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+"+ data.score + "</span>");
|
||||
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='color-light-green mr5'>+"+ data.gold + "</span>");
|
||||
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+"+ data.final_score + "</span>");
|
||||
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='"+ (data.gold < 0 ? "u-color-light-red" : "color-light-green") +" mr5'>"+ (data.gold < 0 ? data.gold : ("+" + data.gold)) + "</span>");
|
||||
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+"+ data.tag_count + "</span>");
|
||||
icon.find("i").attr("class", "fa fa-unlock fr font-18 mt5 color-light-green w20_center");
|
||||
icon.find("a:last").attr("title", "已完成");
|
||||
|
|
|
|||
|
|
@ -33,15 +33,15 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<li id="tab_nav_4">
|
||||
<a href="<%= shixun_discuss_shixun_path(@myshixun.shixun) %>" class="tab_type" style="font-size: 16px" data-remote="true">
|
||||
<a href="<%= shixun_discuss_shixun_path(@myshixun.shixun, :challenge_id => @game_challenge.id) %>" class="tab_type" style="font-size: 16px" data-remote="true">
|
||||
评论<span id="discusses_count" class="edu-cir-grey1" style="line-height: 18px!important;"><%= @discusses_count if @discusses_count > 0%></span>
|
||||
</a>
|
||||
<%#= link_to '', shixun_discuss_shixun_path(@myshixun.shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
|
||||
</li>
|
||||
<% if @st == 0 %>
|
||||
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.score %></span>
|
||||
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.score.to_i %></span>
|
||||
<% else %>
|
||||
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.choose_score %></span>
|
||||
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.choose_score.to_i %></span>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@
|
|||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">知识点<span class="ml5"><%= challenge.choose_tags_num %></span></span>
|
||||
<% end %>
|
||||
<% elsif game.try(:status) == 2 %>
|
||||
<%# final_score = (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : game.final_score.to_i %>
|
||||
<%# gold_score = @myshixun.shixun.status <= 1 ? 0 : (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) %>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_exp_<%=challenge.id %>">经验值<span class="color-light-green ml5">+<%= @final_score %></span></span>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_grade_<%=challenge.id %>">金币<span class="<%= @gold < 0 ? "u-color-light-red" : "color-light-green" %> ml5"><%= @gold < 0 ? @gold : "+"+@gold.to_s %></span></span>
|
||||
<% final_score = (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : game.final_score.to_i %>
|
||||
<% gold_score = @myshixun.shixun.status <= 1 ? 0 : (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) %>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_exp_<%=challenge.id %>">经验值<span class="color-light-green ml5">+<%= final_score %></span></span>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_grade_<%=challenge.id %>">金币<span class="<%= gold_score < 0 ? "u-color-light-red" : "color-light-green" %> ml5"><%= gold_score < 0 ? gold_score : "+"+gold_score.to_s %></span></span>
|
||||
<span class="color-dark-grey font-12 mr15 info-partly" id="shixun_tag_<%=challenge.id %>">技能标签<span class="color-light-green ml5">+<%= (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : challenge.challenge_tags.count %></span></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<li class="comment-input fl" id="shixun_comment_block">
|
||||
<%= form_for('', :url => {:controller => 'discusses', :action => 'create', :dis_id => @shixun.id, :dis_type => "Shixun"}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
|
||||
<%= form_for('', :url => {:controller => 'discusses', :action => 'create', :dis_id => @shixun.id, :dis_type => "Shixun", :challenge_id => @game_challenge.try(:id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
|
||||
<textarea id="comment_news" name="content" placeholder="我想说点什么~" MultiLine = True ScrollBars = 2 type="text"></textarea>
|
||||
<input type="hidden" id="dis_reply_id" name="reply_id" value="">
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@
|
|||
<div class="fl comment_item_one ml10">
|
||||
<p class="clearfix">
|
||||
<%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %>
|
||||
<span class="fl color-grey font-12 mt3"><%= time_from_now dis.created_at %></span>
|
||||
|
||||
<span class="fl color-grey font-12 mt3 mr20"><%= time_from_now dis.created_at %></span>
|
||||
<% if dis.try(:challenge_id).present? %>
|
||||
<span class="fl color-grey font-12 mt3">[第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关]</span>
|
||||
<% end %>
|
||||
<span class="fr color-grey font-12 color_Purple_grey" id="dis_praise_<%= dis.id %>">
|
||||
<%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,13 @@
|
|||
<label style="top:6px" class="color-grey" for="websh">(勾选则给学员的实践任务提供命令行窗口,否则不提供)</label>
|
||||
</span>
|
||||
</li>
|
||||
<li class="clearfix mb15">
|
||||
<label class="panel-form-label fl">复制 </label>
|
||||
<span class="fl mr20">
|
||||
<input type="checkbox" <%= @shixun.can_copy ? 'checked' : "" %> name="can_copy" value="1" id="can_copy" class="ml5 mr5 magic-checkbox" >
|
||||
<label style="top:6px" class="color-grey" for="can_copy">(勾选则给实训合作者提供复制实训功能,否则不提供)</label>
|
||||
</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-blue fr" onclick="submit_new_project();">提交</a>
|
||||
<%= link_to "取消", shixuns_path, :class => "task-btn fr mr10" %>
|
||||
|
|
@ -199,7 +206,7 @@
|
|||
placeholder: "请输入完成实训任务依赖的背景知识",
|
||||
imageUpload : true,
|
||||
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
|
||||
imageUploadURL : "<%#= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>" //url
|
||||
imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>" //url
|
||||
});
|
||||
//////////////////////////////////////////////////////////////
|
||||
//提交新建项目
|
||||
|
|
|
|||
|
|
@ -50,7 +50,13 @@
|
|||
<label style="top:6px" class="color-grey" for="webssh">(勾选则给学员的实践任务提供命令行窗口,否则不提供)</label>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<li class="clearfix mb15">
|
||||
<label class="panel-form-label fl">复制 </label>
|
||||
<span class="fl mr20">
|
||||
<input type="checkbox" <%= @shixun.can_copy ? 'checked' : "" %> name="can_copy" value="<%= @shixun.can_copy ? 1 : 0 %>" id="can_copy" class="ml5 mr5 magic-checkbox" >
|
||||
<label style="top:6px" class="color-grey" for="can_copy">(勾选则给实训合作者提供复制实训功能,否则不提供)</label>
|
||||
</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-green fr " onclick="submit_edit_shixun(<%= @shixun.id %>);">保存</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,13 @@
|
|||
<!--<%#= @shixun.language %>-->
|
||||
<!--</div>-->
|
||||
</li>
|
||||
<li class="clearfix mb15">
|
||||
<label class="panel-form-label fl">复制 </label>
|
||||
<span class="fl mr20">
|
||||
<input type="checkbox" <%= @shixun.can_copy ? 'checked' : "" %> name="can_copy" value="<%= @shixun.can_copy ? 1 : 0 %>" id="can_copy" disabled="disabled" class="ml5 mr5 magic-checkbox" >
|
||||
<label style="top:6px" class="color-grey" for="can_copy">(勾选则给实训合作者提供复制实训功能,否则不提供)</label>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,15 +29,16 @@
|
|||
<%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15 ", :id => "shixun_operation", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to '发送至', search_user_courses_shixun_path(@shixun), :remote => true, :class => "fr shixun-task-btn task-btn-green mr15" %>
|
||||
<%# if User.current.manager_of_shixun?(@shixun) %>
|
||||
<%#= link_to "复制", copy_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15", :target => "_blank" %>
|
||||
<%# end %>
|
||||
<% elsif @shixun.status == 3 %>
|
||||
<% unless myshixun.blank? %>
|
||||
<%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15 ", :id => "shixun_operation", :remote => true %>
|
||||
<% end %>
|
||||
<a href="javascript:void(0);" class="fr shixun-task-ban-btn mr15">已关闭</a>
|
||||
<% end %>
|
||||
<%# if @shixun.can_copy && User.current.manager_of_shixun?(@shixun) %>
|
||||
<%#= link_to "复制", copy_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15" %>
|
||||
<!--<a href="javascript:void(0);" onclick="op_confirm_box_loading('<%#= copy_shixun_path(@shixun) %>', '复制将在后台执行</br>平台将为你创建一个新的同名实训和内容,请问是否继续?');" class = "fr shixun-task-btn task-btn-green mr15">复制</a>-->
|
||||
<%# end %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% unless User.current.manager_of_shixun?(@shixun) %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class AddForkFromToShixuns < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :shixuns, :fork_from, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddCanCopyToShixuns < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :shixuns, :can_copy, :boolean, :default => true
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddChallengeIdToDiscusses < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :discusses, :challenge_id, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -85,8 +85,8 @@ class Gitlab::Client
|
|||
# public (optional) - if true same as setting visibility_level = 20
|
||||
# visibility_level (optional)
|
||||
|
||||
def edit_project(id, visibility_level, default_branch)
|
||||
put("/projects/#{id}", :body => {:visibility_level => visibility_level, :default_branch => default_branch})
|
||||
def edit_project(id, name, path)
|
||||
put("/projects/#{id}", :body => {:name => name, :path => path})
|
||||
end
|
||||
|
||||
# Deletes a project.
|
||||
|
|
|
|||
|
|
@ -253,6 +253,13 @@ function op_confirm_box(url, str){
|
|||
pop_box_new(htmlvalue, 578, 205);
|
||||
}
|
||||
|
||||
function op_confirm_box_loading(url, str){
|
||||
var htmlvalue = '<div class="task-popup" style="width:578px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
|
||||
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
|
||||
'<a href="'+ url +'" class="task-btn task-btn-blue fr" onclick="hideModal();$(\'.loading_all\').show();">确定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 578, 205);
|
||||
}
|
||||
|
||||
// 两个按钮 点击确认跳转, 提示信息有两行
|
||||
function s_op_confirm_box(url, str){
|
||||
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
.active-class .search .open{padding-top:6px;}
|
||||
.active-class .search b{cursor:pointer;}
|
||||
.active-class .search span input{border:none;outline:none;padding-right:80px;display:none;}
|
||||
.active-class .content .sub-con{width:23.7%;border:1px solid #eee;background:#fff;margin: 0 1.5% 1.5% 0px;box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);}
|
||||
.active-class .content .sub-con{width:23.69%;border:1px solid #eee;background:#fff;margin: 0 1.5% 1.5% 0px;box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);}
|
||||
.active-class .content .sub-con:nth-child(4n+0){margin:0 0 1.5% 0;}
|
||||
.active-class .content .sub-con:hover{box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.15);cursor: pointer;-webkit-animation: bounce-down 1s linear 1;animation: bounce-down 1s linear 1;}
|
||||
.active-class .content .sub-con .top{height:154px;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue