diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 337f951aa..8abb426a9 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -147,7 +147,8 @@ class ForumsController < ApplicationController reorder(order). preload(:author, {:last_reply => :author}). all - @forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;") + + #@forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;") @my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count @my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count @errors = params[:errors] diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index d8422beaa..ee40a76bd 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -22,6 +22,7 @@ class GamesController < ApplicationController myshixun_user_login = User.where(:id => @myshixun.user_id).first.try(:login) myshixun_rep_identifier = Repository.where(:myshixun_id => @myshixun.id, :type => "Repository::Gitlab").first.try(:identifier) gitlab_address = Redmine::Configuration['gitlab_address'] + myshixun_domain = Redmine::Configuration['myshixun_domain'] gitlab_myshixun_url = git_myshixun_url(@myshixun, @myshixun.try(:user_id)) shixun = @myshixun.shixun gitlab_shixun_url = git_shixun_url(shixun, (shixun.try(:fork_from).blank? ? "educoder" : "eduforge")) @@ -33,7 +34,7 @@ class GamesController < ApplicationController script = "cd #{path} git clone #{gitlab_address.to_s+'/'+myshixun_user_login+'/'+ myshixun_rep_identifier}.git cd #{myshixun_rep_identifier}/ - git remote set-url origin https://#{shixun.fork_from.blank? ? "educoder" : "eduforge"}:xinhu1ji2qu3@testbdgit.trustie.net/#{myshixun_user_login}/#{myshixun_rep_identifier}.git + git remote set-url origin https://#{shixun.fork_from.blank? ? "educoder" : "eduforge"}:xinhu1ji2qu3@#{myshixun_domain}/#{myshixun_user_login}/#{myshixun_rep_identifier}.git git remote add remote_origin #{gitlab_shixun_url} #git pull git pull remote_origin master diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index aa2857ae1..7e54df3f1 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1532,7 +1532,7 @@ end @sub_type = 5 @type = trial_authorization_status params[:type] # sql = select * from apply_actions where dealer_id is null - @authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type,:dealer_id =>'').order("created_at desc") + @authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc") search = params[:search] unless search.blank? @authorizations = @authorizations.where(:container_id => Shixun.where(:id => @authorizations.map(&:container_id)).where("name like '%#{search}%'").map(&:id)).order("created_at desc") diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 7e9662563..b96c1774f 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -165,10 +165,9 @@ class MemosController < ApplicationController @flag = false respond_to do |format| - if( #@memo.update_column(:subject, params[:memo][:subject]) && - @memo.update_column(:content, params[:memo][:content]) && - @memo.update_column(:sticky, params[:memo][:sticky]) && - @memo.update_column(:lock, params[:memo][:lock]) && + if( @memo.update_column(:content, params[:memo][:content]) && + @memo.update_column(:sticky, params[:memo][:sticky].to_i) && + @memo.update_column(:lock, params[:memo][:lock].to_i) && @memo.update_column(:subject,params[:memo][:subject]) && @memo.update_column(:updated_at,Time.now)) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 77b25309f..2fb901d77 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -140,7 +140,7 @@ class ShixunsController < ApplicationController @content = params[:content] 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) + # shixun_modify_status_without_publish(@shixun, 1) # end respond_to do |format| format.js diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1f545fd9e..2a73e648e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -326,6 +326,11 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @type = 'Memo' + when 'Challenge' + @reply = Discuss.find params[:reply_id] + @user_activity_id = params[:user_activity_id] + @activity_id = params[:activity_id] + @type = 'Challenge' end respond_to do |format| format.js @@ -452,6 +457,20 @@ class UsersController < ApplicationController comment.subject = "#{@root.subject}" comment.root_id = reply.root_id reply.children << comment + when 'Challenge' + @game_challenge = Challenge.where(:id => reply.challenge_id).first + @root = reply.root + comment = Discuss.new + comment.user_id = User.current.id + comment.content = params[:reply_message] + comment.root_id = reply.root_id + comment.challenge_id = reply.challenge_id + comment.dis_type = "Shixun" + comment.dis_id = @game_challenge.shixun.try(:id) + comment.praise_count = 0 + reply.children << comment + @discusses = @game_challenge.shixun.discusses.reorder("created_at desc") + @discusses_count = @discusses.count end update_course_activity(@root.class.to_s,@root.id) update_user_activity(@root.class.to_s,@root.id) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9cfcfd972..78c0920a3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2099,7 +2099,7 @@ module ApplicationHelper elsif @organization title << (@organization.name.nil? ? "创新源于实践" : @organization.name) elsif @forum || params[:controller] == "forums" - title << "问吧" + title << "论坛" elsif @my_syllabuses title << "我的课堂" elsif @user @@ -4550,6 +4550,8 @@ def get_reply_by_type type, reply_id reply = JournalsForMessage.find reply_id when 'Memo' reply = Memo.find reply_id + when 'Challenge' + reply = Discuss.find reply_id end reply end diff --git a/app/models/discuss.rb b/app/models/discuss.rb index effd1cb26..af5f96601 100644 --- a/app/models/discuss.rb +++ b/app/models/discuss.rb @@ -7,4 +7,12 @@ class Discuss < ActiveRecord::Base acts_as_tree :foreign_key => 'parent_id' belongs_to :dis, :polymorphic => true validates_presence_of :dis, :user, :content + + def creator_user + User.find(self.user_id) + end + + def content_detail + self.content + end end diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index cc9304f7a..103fafdb3 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -17,7 +17,8 @@
<% unless @exercise.is_public %> - <% end %> + + <% end %> <%= @exercise.exercise_name %>
<%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %> @@ -42,8 +43,9 @@ <%= link_to "导出成绩", student_exercise_list_exercise_path(@exercise, :course_id => @course.id, :format => 'xls'), :id => "export_exercise_work", :class => "fr white-btn orange-btn ml10 mt8" %> diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 7aa89bdab..a3cbaa03e 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -41,7 +41,7 @@ 顶 <% end %> -<%= memo.content.html_safe %>
+