diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0c09e0c08..d23bd4e0f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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")} diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index ba3c12665..e99d7b374 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -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 diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 1fb024611..bcc2d3e63 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -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" diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index d9a46da0a..7f21c0544 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -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 diff --git a/app/models/discuss.rb b/app/models/discuss.rb index dbf0f99ec..effd1cb26 100644 --- a/app/models/discuss.rb +++ b/app/models/discuss.rb @@ -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 diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 40c2237f0..7ba0ae5ca 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -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 diff --git a/app/views/courses/settings/_import_students_result.html.erb b/app/views/courses/settings/_import_students_result.html.erb new file mode 100644 index 000000000..6dbbc7330 --- /dev/null +++ b/app/views/courses/settings/_import_students_result.html.erb @@ -0,0 +1,12 @@ + +
+
+

上传文件

+ +
+
+
+ 本次新加入<%= @had_import_count %>个学生,还有<%= @list_count - @had_import_count %>个学生没有加入 +
+
+
diff --git a/app/views/courses/sync_students.js.erb b/app/views/courses/sync_students.js.erb index 1e5f43280..f81be12be 100644 --- a/app/views/courses/sync_students.js.erb +++ b/app/views/courses/sync_students.js.erb @@ -1 +1,6 @@ -$("#setting_teacher_list").html("<%= j(render :partial => 'courses/settings/all_student_list') %>").show(); \ No newline at end of file +$("#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 %> \ No newline at end of file diff --git a/app/views/games/_code_actions.html.erb b/app/views/games/_code_actions.html.erb index 47f53c442..239fa8d8d 100644 --- a/app/views/games/_code_actions.html.erb +++ b/app/views/games/_code_actions.html.erb @@ -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("经验值+"+ data.score + ""); - $("#shixun_grade_<%=@game_challenge.id %>").html("金币+"+ data.gold + ""); + $("#shixun_exp_<%=@game_challenge.id %>").html("经验值+"+ data.final_score + ""); + $("#shixun_grade_<%=@game_challenge.id %>").html("金币"+ (data.gold < 0 ? data.gold : ("+" + data.gold)) + ""); $("#shixun_tag_<%=@game_challenge.id %>").html("技能标签+"+ data.tag_count + ""); icon.find("i").attr("class", "fa fa-unlock fr font-18 mt5 color-light-green w20_center"); icon.find("a:last").attr("title", "已完成"); diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index a78757022..a6acdaa1c 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -33,15 +33,15 @@ <% end %>
  • - + 评论<%= @discusses_count if @discusses_count > 0%> <%#= link_to '', shixun_discuss_shixun_path(@myshixun.shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
  • <% if @st == 0 %> - 经验值:<%= @game_challenge.score %> + 经验值:<%= @game_challenge.score.to_i %> <% else %> - 经验值:<%= @game_challenge.choose_score %> + 经验值:<%= @game_challenge.choose_score.to_i %> <% end %> diff --git a/app/views/games/_games_list.html.erb b/app/views/games/_games_list.html.erb index e12654052..ed0ac1851 100644 --- a/app/views/games/_games_list.html.erb +++ b/app/views/games/_games_list.html.erb @@ -48,10 +48,10 @@ 知识点<%= challenge.choose_tags_num %> <% 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) %> - 经验值+<%= @final_score %> - 金币 ml5"><%= @gold < 0 ? @gold : "+"+@gold.to_s %> + <% 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) %> + 经验值+<%= final_score %> + 金币 ml5"><%= gold_score < 0 ? gold_score : "+"+gold_score.to_s %> 技能标签+<%= (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : challenge.challenge_tags.count %> <% end %> diff --git a/app/views/games/_shixun_comment_block.html.erb b/app/views/games/_shixun_comment_block.html.erb index 53fc4caaf..6a39b71a4 100644 --- a/app/views/games/_shixun_comment_block.html.erb +++ b/app/views/games/_shixun_comment_block.html.erb @@ -1,5 +1,5 @@
  • - <%= 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| %> <% end %> diff --git a/app/views/games/_shixun_comment_list.html.erb b/app/views/games/_shixun_comment_list.html.erb index ebad14776..3739212ba 100644 --- a/app/views/games/_shixun_comment_list.html.erb +++ b/app/views/games/_shixun_comment_list.html.erb @@ -11,8 +11,10 @@

    <%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %> - <%= time_from_now dis.created_at %> - + <%= time_from_now dis.created_at %> + <% if dis.try(:challenge_id).present? %> + [第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关] + <% end %> <%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %> diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index 4bf50e168..6deb9b5b6 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -102,6 +102,13 @@

  • +
  • + + + name="can_copy" value="1" id="can_copy" class="ml5 mr5 magic-checkbox" > + + +
  • 提交 <%= 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 }); ////////////////////////////////////////////////////////////// //提交新建项目 diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb index 6d3741c93..1e8dadbac 100644 --- a/app/views/shixuns/_settings_edit.html.erb +++ b/app/views/shixuns/_settings_edit.html.erb @@ -50,7 +50,13 @@
  • - +
  • + + + name="can_copy" value="<%= @shixun.can_copy ? 1 : 0 %>" id="can_copy" class="ml5 mr5 magic-checkbox" > + + +
  • 保存
  • diff --git a/app/views/shixuns/_settings_show.html.erb b/app/views/shixuns/_settings_show.html.erb index fca669be8..1c7b6a309 100644 --- a/app/views/shixuns/_settings_show.html.erb +++ b/app/views/shixuns/_settings_show.html.erb @@ -58,6 +58,13 @@ +
  • + + + name="can_copy" value="<%= @shixun.can_copy ? 1 : 0 %>" id="can_copy" disabled="disabled" class="ml5 mr5 magic-checkbox" > + + +
  • diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index 403c3e965..e13c99d5d 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -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 %> 已关闭 <% 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" %> + + <%# end %> <% end %>
    <% unless User.current.manager_of_shixun?(@shixun) %> diff --git a/db/migrate/20170920065705_add_fork_from_to_shixuns.rb b/db/migrate/20170920065705_add_fork_from_to_shixuns.rb new file mode 100644 index 000000000..63730a310 --- /dev/null +++ b/db/migrate/20170920065705_add_fork_from_to_shixuns.rb @@ -0,0 +1,5 @@ +class AddForkFromToShixuns < ActiveRecord::Migration + def change + add_column :shixuns, :fork_from, :integer + end +end diff --git a/db/migrate/20170921084836_add_can_copy_to_shixuns.rb b/db/migrate/20170921084836_add_can_copy_to_shixuns.rb new file mode 100644 index 000000000..1720ab4fb --- /dev/null +++ b/db/migrate/20170921084836_add_can_copy_to_shixuns.rb @@ -0,0 +1,5 @@ +class AddCanCopyToShixuns < ActiveRecord::Migration + def change + add_column :shixuns, :can_copy, :boolean, :default => true + end +end diff --git a/db/migrate/20170922015144_add_challenge_id_to_discusses.rb b/db/migrate/20170922015144_add_challenge_id_to_discusses.rb new file mode 100644 index 000000000..190ac94f4 --- /dev/null +++ b/db/migrate/20170922015144_add_challenge_id_to_discusses.rb @@ -0,0 +1,5 @@ +class AddChallengeIdToDiscusses < ActiveRecord::Migration + def change + add_column :discusses, :challenge_id, :integer + end +end diff --git a/lib/gitlab-cli/lib/gitlab/client/projects.rb b/lib/gitlab-cli/lib/gitlab/client/projects.rb index 2cc96c4d1..a773c29bb 100644 --- a/lib/gitlab-cli/lib/gitlab/client/projects.rb +++ b/lib/gitlab-cli/lib/gitlab/client/projects.rb @@ -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. diff --git a/public/javascripts/edu/application.js b/public/javascripts/edu/application.js index b90880a8a..2c4e5ded7 100644 --- a/public/javascripts/edu/application.js +++ b/public/javascripts/edu/application.js @@ -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 = '

    提示

    '+ + '

    ' + str + '

    取消'+ + '确定
    '; + pop_box_new(htmlvalue, 578, 205); +} + // 两个按钮 点击确认跳转, 提示信息有两行 function s_op_confirm_box(url, str){ var htmlvalue = '

    提示

    '+ diff --git a/public/stylesheets/css/ketang.css b/public/stylesheets/css/ketang.css index 6f5e0a6e6..1105b771a 100644 --- a/public/stylesheets/css/ketang.css +++ b/public/stylesheets/css/ketang.css @@ -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;}