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 %>

+
<%= memo.content.html_safe %>
<%= User.find(memo.author_id).try(:show_name) %> <%= time_from_now memo.updated_at %> @@ -86,6 +86,12 @@
+ + + + + + <% if false %> <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 5eb64b918..98e1391c5 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -81,7 +81,7 @@ diff --git a/app/views/games/_shixun_comment_block.html.erb b/app/views/games/_shixun_comment_block.html.erb index 6a39b71a4..4b463b2e6 100644 --- a/app/views/games/_shixun_comment_block.html.erb +++ b/app/views/games/_shixun_comment_block.html.erb @@ -1,43 +1,43 @@
  • <%= 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 %>
  • \ No newline at end of file diff --git a/app/views/games/_shixun_comment_list.html.erb b/app/views/games/_shixun_comment_list.html.erb index d4a50066d..b4d6c217a 100644 --- a/app/views/games/_shixun_comment_list.html.erb +++ b/app/views/games/_shixun_comment_list.html.erb @@ -13,7 +13,7 @@ <%= 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 %> <% if dis.try(:challenge_id).present? %> - [第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关] + [第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关] <% end %> <%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %> @@ -78,17 +78,16 @@ \ No newline at end of file diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index d43a20612..6a638ac62 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -18,7 +18,7 @@
  • <%= link_to "全部实训", shixuns_path, :class => "new-nav-a font-16" %>
  • <%= link_to "实训路径", subjects_path, :class => "new-nav-a font-16" %>
  • <%= link_to "在线课堂", courses_path, :class => "new-nav-a font-16" %>
  • - +
  • <%= link_to "论坛", forums_path, :class => "new-nav-a font-16" %>
  • diff --git a/app/views/messages/_message_reply.html.erb b/app/views/messages/_message_reply.html.erb index 9410832e6..02d9e36e9 100644 --- a/app/views/messages/_message_reply.html.erb +++ b/app/views/messages/_message_reply.html.erb @@ -1,7 +1,7 @@
    <% if !comment.parent.nil? && !comment.parent.parent.nil? %>
    - <%= render :partial => 'student_work/homework_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> + <%= render :partial => 'messages/message_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %>
    <% end %> <%= render :partial => 'student_work/homework_reply_detail', :locals => {:comment => comment, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> diff --git a/app/views/projects/_reply_to.html.erb b/app/views/projects/_reply_to.html.erb index 97cc0c853..84811dd85 100644 --- a/app/views/projects/_reply_to.html.erb +++ b/app/views/projects/_reply_to.html.erb @@ -1,6 +1,6 @@
    <% if User.current.logged? %> -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    <% if @type == 'Message' %> diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index 966c5ff0b..72471053a 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -6,7 +6,7 @@
    -
      +
        <% if @path.present? %> 根目录/ <% diff --git a/app/views/shixuns/index.html.erb b/app/views/shixuns/index.html.erb index 5492adbf2..cee2e50e1 100644 --- a/app/views/shixuns/index.html.erb +++ b/app/views/shixuns/index.html.erb @@ -90,6 +90,10 @@ +
      • + + +
    @@ -98,7 +102,7 @@
  • 所有状态 -