diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 1f8cdd275..d8fc9ce28 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -175,8 +175,10 @@ class AdminController < ApplicationController def courses @name = params[:name].to_s.strip.downcase if @name && @name != "" - @courses = Course.select{ |course| course.teacher && ((course.teacher.show_name).include?(@name) || course.name.include?(@name))} - @courses = @courses.sort{|x, y| y.created_at <=> x.created_at} + all_user_ids = Course.all.map{|course| course.tea_id} + user_str_ids = search_user_by_name all_user_ids, @name + user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")" + @courses = Course.where("tea_id in #{user_ids} or name like '%#{@name}%'").reorder("created_at desc") else @courses = Course.order('created_at desc') end diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index a47ddf787..69a1b829c 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -14,17 +14,17 @@ class MemosController < ApplicationController # layout 'base_memos' def quote - @subject = @memo.subject - @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') - - @content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)}
  " - @content << @memo.content.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "\n\n
" - @content = "
" << @content - #@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> " - #@content << @memo.content.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" - #@content_html = textilizable(@content) - @temp = Memo.new - @temp.content = @content + # @subject = @memo.subject + # @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') + # + # @content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)}
  " + # @content << @memo.content.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "
\n\n
" + # @content = "
" << @content + # #@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> " + # #@content << @memo.content.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + # #@content_html = textilizable(@content) + # @temp = Memo.new + # @temp.content = @content end def new @@ -47,6 +47,8 @@ class MemosController < ApplicationController @quote = params[:quote] end + + #unless params[:quote].nil? # @quote = params[:quote][:quote] #end @@ -55,6 +57,10 @@ class MemosController < ApplicationController @memo.forum_id = params[:forum_id] @memo.author_id = User.current.id + if params[:memo][:parent_id] + @memo.root_id = (Memo.find params[:memo][:parent_id]).root_id.nil? ? params[:memo][:parent_id].to_i : (Memo.find params[:memo][:parent_id]).root_id + end + @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) @memo.content = @quote + @memo.content respond_to do |format| @@ -111,32 +117,37 @@ class MemosController < ApplicationController @memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示 @memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1)) - page = params[:page] - if params[:r] && page.nil? - offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count - page = 1 + offset / pre_count - else - - end - @reply_count = @memo.children.count - @reply_pages = Paginator.new @reply_count, pre_count, page - @replies = @memo.children. - includes(:author, :attachments). - reorder("#{Memo.table_name}.created_at DESC"). - limit(@reply_pages.per_page). - offset(@reply_pages.offset). - all + # page = params[:page] + # if params[:r] && page.nil? + # offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count + # page = 1 + offset / pre_count + # else + # end + + # @reply_count = @memo.children.count + # @reply_pages = Paginator.new @reply_count, pre_count, page + # @replies = @memo.children. + # includes(:author, :attachments). + # reorder("#{Memo.table_name}.created_at DESC"). + # limit(@reply_pages.per_page). + # offset(@reply_pages.offset). + # all + + @replies = Memo.where("root_id = #{@memo.id}").reorder("created_at desc") + @reply_count = @replies.count + @replies = get_no_children_comments_all @replies + @limit_count = @replies.count + @page = params[:page] ? params[:page].to_i + 1 : 0 + @limit = 10 + @replies = @replies[@page * @limit..@page * @limit + 9] @memo_new = Memo.new @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count - # @memo = Memo.find_by_id(params[:id]) - # @forum = Forum.find(params[:forum_id]) - # @replies = @memo.replies - # @mome_new = Memo.new respond_to do |format| + format.js format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums', format.json { render json: @memo } format.xml { render xml: @memo } diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index a1a085895..0a0a422a6 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,15 +1,19 @@ +# encoding: utf-8 # 如果你对改模块任何功能不清楚,请不要随便改 # @Hjqreturn class PullRequestsController < ApplicationController before_filter :authorize_logged before_filter :find_project_and_repository - before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, - :update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request] + before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request] + before_filter :member_allowed, :only => [:new, :create] + before_filter :manager_allowed, :only => [:accept_pull_request] layout "base_projects" include PullRequestsHelper include ApplicationHelper + require 'ostruct' + # 返回json格式 def index # project_menu_type 为了控制base顶部导航 @@ -92,7 +96,7 @@ class PullRequestsController < ApplicationController if compare_pull_request(source_branch, target_project_id, target_branch) # 如果传送了目标项目ID即向fork源项目发送请求 # if params[:forked_project_id] && params[:source_project] == "forked_project_name" - if !params[:target_project_id].blank? + if !params[:target_project_id].blank? && params[:target_project_id].to_i != @project.id target_project_id = params[:forked_project_id].to_i request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id) @fork_project_name = Project.find(params[:target_project_id]).try(:name) @@ -132,8 +136,14 @@ class PullRequestsController < ApplicationController format.js{redirect_to new_project_pull_request_path(:show_tip => tip)} end end + rescue Gitlab::Error::Forbidden => e + @message = l(:label_pull_request_forbidden) rescue Gitlab::Error::Conflict => e - @message = e.message + @message = l(:label_pull_request_conflic) + rescue Gitlab::Error::NotFound => e + @message = l(:label_pull_request_notfound) + rescue Exception => e + puts e end end @@ -319,23 +329,38 @@ class PullRequestsController < ApplicationController # id (required) - The ID of a project # merge_request_id (required) - The ID of MR def pull_request_changes - begin @type = params[:type] @changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes) - @changes_count = @changes.count + + + + @changes_count = @changes.count @limit = 10 @is_remote = true @count = @changes_count @pages = Paginator.new @count, @limit, params['page'] || 1 @offset ||= @pages.offset @changes = paginateHelper @changes, 10 - rescue Exception => e - @message = e.message - end + end private + # post 相关操作权限控制 + # 项目管理员可操作 + def manager_allowed + unless is_project_manager?(User.current.id, @project.id) + return render_403 + end + end + + # 项目成员可操作 + def member_allowed + unless User.current.member_of?(@project) + return render_403 + end + end + def send_message user_id, project_id, pull_request_id, status ForgeMessage.create(:user_id => user_id, :project_id => project_id, :forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true, :status => status) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 29176550a..f932748af 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -49,6 +49,7 @@ class RepositoriesController < ApplicationController helper :repositories include RepositoriesHelper helper :project_score + require 'ostruct' #@root_path = RepositoriesHelper::ROOT_PATH # require 'net/ssh' @@ -580,8 +581,12 @@ update def commit_diff # 顶部导航 @project_menu_type = 5 - @commit_diff = @g.commit_diff(@project.gpid, params[:changeset]) + diff = ActiveSupport::JSON.decode(@commit_diff.to_json).first + diff = OpenStruct.new(diff) + @diff_file = Trustie::Gitlab::Diff::File.new(diff) + + @commit_details = @g.commit(@project.gpid, params[:changeset]) render :layout => 'base_projects' end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 86c04e9e4..da7cfd849 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -164,6 +164,8 @@ class UsersController < ApplicationController @comment = Comment.find params[:comment].to_i when 'Journal','is_project_issue' @comment = Journal.find params[:comment].to_i + when 'Memo' + @comment = Memo.find params[:comment].to_i end @user_activity_id = params[:user_activity_id] @parent_id = params[:parent_id] if params[:parent_id] @@ -308,6 +310,15 @@ class UsersController < ApplicationController @root.update_column('updated_at', Time.now) @count = @root.journals_for_messages.count @comments = @root.journals_for_messages.reorder("created_on desc").limit(3) + when 'Memo' + @root = reply.root + comment = Memo.new + comment.author = User.current + comment.forum = reply.forum + comment.content = params[:reply_message] + comment.subject = "#{@root.subject}" + comment.root_id = reply.root_id + reply.children << comment 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 e9bbcaafe..678d3ed50 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3422,6 +3422,8 @@ def get_reply_by_type type, reply_id reply = Journal.find reply_id when 'Syllabus' reply = JournalsForMessage.find reply_id + when 'Memo' + reply = Memo.find reply_id end reply end diff --git a/app/helpers/pull_requests_helper.rb b/app/helpers/pull_requests_helper.rb index 983ab848c..fd90e01d1 100644 --- a/app/helpers/pull_requests_helper.rb +++ b/app/helpers/pull_requests_helper.rb @@ -19,6 +19,11 @@ module PullRequestsHelper PullRequest.where(:pull_request_id => pull_request_id).first end + # 通过gitlab项目id获取Trustie项目的用户名 + def find_gitlab_project gitlab_project_id + Project.find_by_gpid(gitlab_project_id).owner.try(:show_name) + end + def get_state state case state when "open","reopened" diff --git a/app/models/comment.rb b/app/models/comment.rb index 27a917b93..9a87201dc 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -40,7 +40,7 @@ class Comment < ActiveRecord::Base belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' validates_presence_of :commented, :author, :comments safe_attributes 'comments','parent_id','reply_id','comments_count' - after_create :send_mail, :act_as_system_message, :act_as_student_score + after_create :act_as_system_message, :act_as_student_score #:send_mail, after_destroy :down_course_score def act_as_system_message @@ -55,11 +55,11 @@ class Comment < ActiveRecord::Base # end end else # 项目相关 - if self.author_id != self.commented.author_id - self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false) - #content = strip_html self.comments.html_safe, 200 - #ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content - end + # if self.author_id != self.commented.author_id + # self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false) + # #content = strip_html self.comments.html_safe, 200 + # #ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content + # end end end diff --git a/app/models/journals_for_message_observer.rb b/app/models/journals_for_message_observer.rb index 0db2e0043..a576e605f 100644 --- a/app/models/journals_for_message_observer.rb +++ b/app/models/journals_for_message_observer.rb @@ -1,7 +1,7 @@ # Added by young class JournalsForMessageObserver < ActiveRecord::Observer def after_create(journals_for_message) - Mailer.run.journals_for_message_add(User.current, journals_for_message) + # Mailer.run.journals_for_message_add(User.current, journals_for_message) end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 8d8fa7085..c37004066 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -109,40 +109,40 @@ class Mailer < ActionMailer::Base # 邀请未注册用户加入项目 # 功能: 在加入项目的同时自动注册用户 def send_invite_in_project(email, project, invitor, first_name, last_name, gender) - @email = email - @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} " - @password = newpass(6) - - login = email - login = login.sub(/%40/,'@') - us = UsersService.new - # 自动激活用户 - user = us.register_auto(login, email, @password, first_name, last_name, gender) - InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email) - User.current = user unless User.current.nil? - @user = user - @token = Token.get_token_from_user(user, 'autologin') - @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value) - mail :to => email, :subject => @subject + # @email = email + # @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} " + # @password = newpass(6) + # + # login = email + # login = login.sub(/%40/,'@') + # us = UsersService.new + # # 自动激活用户 + # user = us.register_auto(login, email, @password, first_name, last_name, gender) + # InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email) + # User.current = user unless User.current.nil? + # @user = user + # @token = Token.get_token_from_user(user, 'autologin') + # @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value) + # mail :to => email, :subject => @subject end # 邀请已注册的用户加入项目 def request_member_to_project(email, project, invitor) - @subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} " - user = User.find_by_mail(email.to_s) - @invitor_name = "#{invitor.name}" - @project_name = "#{project.name}" - @user = user - @project = project - if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil? - InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email) - end - @token = Token.get_token_from_user(user, 'autologin') - @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value) - # 发送消息邀请 - send_message_request_member(user,project) + # @subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} " + # user = User.find_by_mail(email.to_s) + # @invitor_name = "#{invitor.name}" + # @project_name = "#{project.name}" + # @user = user + # @project = project + # if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil? + # InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email) # end - mail :to => email, :subject => @subject + # @token = Token.get_token_from_user(user, 'autologin') + # @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value) + # # 发送消息邀请 + # send_message_request_member(user,project) + # # end + # mail :to => email, :subject => @subject end # 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况) @@ -293,23 +293,23 @@ class Mailer < ActionMailer::Base # 公共讨论区发帖、回帖添加邮件发送信息 def forum_message_added(memo) - @memo = memo - redmine_headers 'Memo' => memo.id - @forum = memo.forum - @author = memo.author - @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id) - @issue_author_url = url_for(user_activities_url(@author)) - recipients ||= [] - #将帖子创建者邮箱地址加入数组 - recipients << @forum.creator.mail - #回复人邮箱地址加入数组 - recipients << @author.mail - # cc = wiki_content.page.wiki.watcher_recipients - recipients - - @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))) - mail :to => recipients, - :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]", - :filter => true + # @memo = memo + # redmine_headers 'Memo' => memo.id + # @forum = memo.forum + # @author = memo.author + # @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id) + # @issue_author_url = url_for(user_activities_url(@author)) + # recipients ||= [] + # #将帖子创建者邮箱地址加入数组 + # recipients << @forum.creator.mail + # #回复人邮箱地址加入数组 + # recipients << @author.mail + # # cc = wiki_content.page.wiki.watcher_recipients - recipients + # + # @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))) + # mail :to => recipients, + # :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]", + # :filter => true end # Builds a Mail::Message object used to email recipients of the added journals for message. @@ -318,64 +318,64 @@ class Mailer < ActionMailer::Base # 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil def journals_for_message_add(user, journals_for_message) - @user = journals_for_message.user # 留言人 - @mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言 - @mail = journals_for_message.at_user if journals_for_message.at_user - @message = journals_for_message.notes - @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}" - @issue_author_url = url_for(user_activities_url(@user)) - @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型 - # when :Bid - # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") - when :Project - return -1 if journals_for_message.jour.project_type == Project::ProjectType_project - project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") - when :Course - course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") - when :Contest - show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") - when :User - user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") - else - Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}" - return -1 - end - - # 验证用户的收取邮件的方式 - recipients ||= [] - recipients1 ||= [] - recipients1 = @mail.mail - recipients = journals_for_message.jour.author.mail - - # modify by nwb - #如果是直接留言并且留言对象是课程 - if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course - course = journals_for_message.jour - @author = journals_for_message.user - #课程的教师 - @members = course_all_member journals_for_message.jour - #收件人邮箱 - @recipients ||= [] - @members.each do |teacher| - @recipients << teacher.user.mail - end - mail :to => @recipients, - :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ", - :filter => true - # elsif journals_for_message.jour.class.to_s.to_sym == :Bid + # @user = journals_for_message.user # 留言人 + # @mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言 + # @mail = journals_for_message.at_user if journals_for_message.at_user + # @message = journals_for_message.notes + # @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}" + # @issue_author_url = url_for(user_activities_url(@user)) + # @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型 + # # when :Bid + # # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + # when :Project + # return -1 if journals_for_message.jour.project_type == Project::ProjectType_project + # project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + # when :Course + # course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + # when :Contest + # show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + # when :User + # user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + # else + # Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}" + # return -1 + # end + # + # # 验证用户的收取邮件的方式 + # recipients ||= [] + # recipients1 ||= [] + # recipients1 = @mail.mail + # recipients = journals_for_message.jour.author.mail + # + # # modify by nwb + # #如果是直接留言并且留言对象是课程 + # if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course + # course = journals_for_message.jour + # @author = journals_for_message.user + # #课程的教师 + # @members = course_all_member journals_for_message.jour + # #收件人邮箱 + # @recipients ||= [] + # @members.each do |teacher| + # @recipients << teacher.user.mail + # end + # mail :to => @recipients, + # :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ", + # :filter => true + # # elsif journals_for_message.jour.class.to_s.to_sym == :Bid + # # if !journals_for_message.jour.author.notify_about? journals_for_message + # # return -1 + # # end + # # + # # mail :to => recipients, :subject => @title,:filter => true + # elsif journals_for_message.jour.class.to_s.to_sym == :Contest # if !journals_for_message.jour.author.notify_about? journals_for_message # return -1 # end - # # mail :to => recipients, :subject => @title,:filter => true - elsif journals_for_message.jour.class.to_s.to_sym == :Contest - if !journals_for_message.jour.author.notify_about? journals_for_message - return -1 - end - mail :to => recipients, :subject => @title,:filter => true - else - mail :to => recipients1, :subject => @title,:filter => true - end + # else + # mail :to => recipients1, :subject => @title,:filter => true + # end end @@ -485,16 +485,16 @@ class Mailer < ActionMailer::Base # 用户申请加入项目邮件通知 def applied_project(applied) - @project =applied.project - redmine_headers 'Project' => @project, - 'User' => applied.user - @user = applied.user - recipients = @project.manager_recipients - s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) - @token = Token.get_token_from_user(@user, 'autologin') - @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members') - mail :to => recipients, - :subject => s + # @project =applied.project + # redmine_headers 'Project' => @project, + # 'User' => applied.user + # @user = applied.user + # recipients = @project.manager_recipients + # s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) + # @token = Token.get_token_from_user(@user, 'autologin') + # @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members') + # mail :to => recipients, + # :subject => s end def reminder(user, issues, days) @@ -555,14 +555,14 @@ class Mailer < ActionMailer::Base # document_added(document) => Mail::Message object # Mailer.document_added(document).deliver => sends an email to the document's project recipients def document_added(document) - redmine_headers 'Project' => document.project.identifier - @author = User.current - @document = document - @issue_author_url = url_for(user_activities_url(@author)) - @document_url = url_for(:controller => 'documents', :action => 'show', :id => document) - mail :to => document.recipients, - :subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}", - :filter => true + # redmine_headers 'Project' => document.project.identifier + # @author = User.current + # @document = document + # @issue_author_url = url_for(user_activities_url(@author)) + # @document_url = url_for(:controller => 'documents', :action => 'show', :id => document) + # mail :to => document.recipients, + # :subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}", + # :filter => true end # Builds a Mail::Message object used to email recipients of a project when an attachements are added. @@ -571,54 +571,54 @@ class Mailer < ActionMailer::Base # attachments_added(attachments) => Mail::Message object # Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients def attachments_added(attachments) - container = attachments.first.container - added_to = '' - added_to_url = '' - @author = attachments.first.author - @issue_author_url = url_for(user_activities_url(@author)) - case container.class.name - when 'Project' - added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container) - added_to = "#{l(:label_project)}: #{container}" - recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail } - when 'Course' - added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container) - added_to = "#{l(:label_course)}: #{container.name}" - recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail } - when 'Version' - added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project) - added_to = "#{l(:label_version)}: #{container.name}" - recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail } - when 'Document' - added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id) - added_to = "#{l(:label_document)}: #{container.title}" - recipients = container.recipients - end - if container.class.name == 'Course' - redmine_headers 'Course' => container.id - @attachments = attachments - @added_to = added_to - @added_to_url = added_to_url - mail :to => recipients, - :subject => "[#{container.name}] #{l(:label_attachment_new)}", - :filter => true - elsif container.class.name == 'Project' - redmine_headers 'Project' => container.id - @attachments = attachments - @added_to = added_to - @added_to_url = added_to_url - mail :to => recipients, - :subject => "[#{container.name}] #{l(:label_attachment_new)}", - :filter => true - else - redmine_headers 'Project' => container.project.identifier - @attachments = attachments - @added_to = added_to - @added_to_url = added_to_url - mail :to => recipients, - :subject => "[#{container.project.name}] #{l(:label_attachment_new)}", - :filter => true - end + # container = attachments.first.container + # added_to = '' + # added_to_url = '' + # @author = attachments.first.author + # @issue_author_url = url_for(user_activities_url(@author)) + # case container.class.name + # when 'Project' + # added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container) + # added_to = "#{l(:label_project)}: #{container}" + # recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail } + # when 'Course' + # added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container) + # added_to = "#{l(:label_course)}: #{container.name}" + # recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail } + # when 'Version' + # added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project) + # added_to = "#{l(:label_version)}: #{container.name}" + # recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail } + # when 'Document' + # added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id) + # added_to = "#{l(:label_document)}: #{container.title}" + # recipients = container.recipients + # end + # if container.class.name == 'Course' + # redmine_headers 'Course' => container.id + # @attachments = attachments + # @added_to = added_to + # @added_to_url = added_to_url + # mail :to => recipients, + # :subject => "[#{container.name}] #{l(:label_attachment_new)}", + # :filter => true + # elsif container.class.name == 'Project' + # redmine_headers 'Project' => container.id + # @attachments = attachments + # @added_to = added_to + # @added_to_url = added_to_url + # mail :to => recipients, + # :subject => "[#{container.name}] #{l(:label_attachment_new)}", + # :filter => true + # else + # redmine_headers 'Project' => container.project.identifier + # @attachments = attachments + # @added_to = added_to + # @added_to_url = added_to_url + # mail :to => recipients, + # :subject => "[#{container.project.name}] #{l(:label_attachment_new)}", + # :filter => true + # end end # Builds a Mail::Message object used to email recipients of a course when an homework are posted. @@ -650,15 +650,15 @@ class Mailer < ActionMailer::Base def news_added(news) if news.project - redmine_headers 'Project' => news.project.identifier - @author = news.author - @issue_author_url = url_for(user_activities_url(@author)) - message_id news - @news = news - @news_url = url_for(:controller => 'news', :action => 'show', :id => news) - mail :to => news.recipients, - :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}", - :filter => true + # redmine_headers 'Project' => news.project.identifier + # @author = news.author + # @issue_author_url = url_for(user_activities_url(@author)) + # message_id news + # @news = news + # @news_url = url_for(:controller => 'news', :action => 'show', :id => news) + # mail :to => news.recipients, + # :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}", + # :filter => true elsif news.course redmine_headers 'Course' => news.course.id @author = news.author @@ -681,17 +681,17 @@ class Mailer < ActionMailer::Base def news_comment_added(comment) news = comment.commented if news.project - redmine_headers 'Project' => news.project.identifier - @author = comment.author - @issue_author_url = url_for(user_activities_url(@author)) - message_id comment - @news = news - @comment = comment - @news_url = url_for(:controller => 'news', :action => 'show', :id => news) - mail :to => news.recipients, - :cc => news.watcher_recipients, - :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}", - :filter => true + # redmine_headers 'Project' => news.project.identifier + # @author = comment.author + # @issue_author_url = url_for(user_activities_url(@author)) + # message_id comment + # @news = news + # @comment = comment + # @news_url = url_for(:controller => 'news', :action => 'show', :id => news) + # mail :to => news.recipients, + # :cc => news.watcher_recipients, + # :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}", + # :filter => true elsif news.course redmine_headers 'Course' => news.course.id @author = comment.author @@ -714,37 +714,37 @@ class Mailer < ActionMailer::Base # message_posted(message) => Mail::Message object # Mailer.message_posted(message).deliver => sends an email to the recipients def message_posted(message) - if message.project - redmine_headers 'Project' => message.project.identifier, - 'Topic-Id' => (message.parent_id || message.id) - @author = message.author - @issue_author_url = url_for(user_activities_url(@author)) - message_id message - references message.parent unless message.parent.nil? - recipients = message.recipients - cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients) - @message = message - @message_url = url_for(message.event_url) - mail :to => recipients, - :cc => cc, - :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}", - :filter => true - elsif message.course - redmine_headers 'Course' => message.course.id, - 'Topic-Id' => (message.parent_id || message.id) - @author = message.author - @issue_author_url = url_for(user_activities_url(@author)) - message_id message - references message.parent unless message.parent.nil? - recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail } - cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients) - @message = message - @message_url = url_for(message.event_url) - mail :to => recipients, - :cc => cc, - :subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}", - :filter => true - end + # if message.project + # redmine_headers 'Project' => message.project.identifier, + # 'Topic-Id' => (message.parent_id || message.id) + # @author = message.author + # @issue_author_url = url_for(user_activities_url(@author)) + # message_id message + # references message.parent unless message.parent.nil? + # recipients = message.recipients + # cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients) + # @message = message + # @message_url = url_for(message.event_url) + # mail :to => recipients, + # :cc => cc, + # :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}", + # :filter => true + # elsif message.course + # redmine_headers 'Course' => message.course.id, + # 'Topic-Id' => (message.parent_id || message.id) + # @author = message.author + # @issue_author_url = url_for(user_activities_url(@author)) + # message_id message + # references message.parent unless message.parent.nil? + # recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail } + # cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients) + # @message = message + # @message_url = url_for(message.event_url) + # mail :to => recipients, + # :cc => cc, + # :subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}", + # :filter => true + # end end # Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was added. @@ -753,20 +753,20 @@ class Mailer < ActionMailer::Base # wiki_content_added(wiki_content) => Mail::Message object # Mailer.wiki_content_added(wiki_content).deliver => sends an email to the project's recipients def wiki_content_added(wiki_content) - redmine_headers 'Project' => wiki_content.project.identifier, - 'Wiki-Page-Id' => wiki_content.page.id - @author = wiki_content.author - message_id wiki_content - recipients = wiki_content.recipients - cc = wiki_content.page.wiki.watcher_recipients - recipients - @wiki_content = wiki_content - @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', - :project_id => wiki_content.project, - :id => wiki_content.page.title) - mail :to => recipients, - :cc => cc, - :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}", - :filter => true + # redmine_headers 'Project' => wiki_content.project.identifier, + # 'Wiki-Page-Id' => wiki_content.page.id + # @author = wiki_content.author + # message_id wiki_content + # recipients = wiki_content.recipients + # cc = wiki_content.page.wiki.watcher_recipients - recipients + # @wiki_content = wiki_content + # @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', + # :project_id => wiki_content.project, + # :id => wiki_content.page.title) + # mail :to => recipients, + # :cc => cc, + # :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}", + # :filter => true end # Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated. @@ -775,23 +775,23 @@ class Mailer < ActionMailer::Base # wiki_content_updated(wiki_content) => Mail::Message object # Mailer.wiki_content_updated(wiki_content).deliver => sends an email to the project's recipients def wiki_content_updated(wiki_content) - redmine_headers 'Project' => wiki_content.project.identifier, - 'Wiki-Page-Id' => wiki_content.page.id - @author = wiki_content.author - message_id wiki_content - recipients = wiki_content.recipients - cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients - @wiki_content = wiki_content - @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', - :project_id => wiki_content.project, - :id => wiki_content.page.title) - @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff', - :project_id => wiki_content.project, :id => wiki_content.page.title, - :version => wiki_content.version) - mail :to => recipients, - :cc => cc, - :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}", - :filter => true + # redmine_headers 'Project' => wiki_content.project.identifier, + # 'Wiki-Page-Id' => wiki_content.page.id + # @author = wiki_content.author + # message_id wiki_content + # recipients = wiki_content.recipients + # cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients + # @wiki_content = wiki_content + # @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', + # :project_id => wiki_content.project, + # :id => wiki_content.page.title) + # @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff', + # :project_id => wiki_content.project, :id => wiki_content.page.title, + # :version => wiki_content.version) + # mail :to => recipients, + # :cc => cc, + # :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}", + # :filter => true end # Builds a Mail::Message object used to email the specified user their account information. diff --git a/app/models/memo.rb b/app/models/memo.rb index 793d534d4..e6701849f 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -79,9 +79,10 @@ class Memo < ActiveRecord::Base "lock", "sticky", "parent_id", - "replies_count" + "replies_count", + "root_id" - after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message,:create_memo_ealasticsearch_index + after_create :add_author_as_watcher, :reset_counters!, :send_message,:create_memo_ealasticsearch_index after_update :update_memo_ealasticsearch_index after_destroy :reset_counters!,:delete_kindeditor_assets,:delete_memo_ealasticsearch_index#,:down_user_score -- 公共区发帖暂不计入得分, # after_create :send_notification @@ -126,6 +127,18 @@ class Memo < ActiveRecord::Base Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added') end + def creator_user + self.author + end + + def created_time + self.created_on + end + + def content_detail + self.content + end + # 公共贴吧消息记录 # 原则:贴吧创始人;发帖人,wanglingchun(特殊用户) def send_message diff --git a/app/models/news.rb b/app/models/news.rb index dc47f66ac..f39352c94 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -65,7 +65,7 @@ class News < ActiveRecord::Base :author_key => :author_id acts_as_watchable - after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message,:delay_news_wechat_send,:delay_news_send + after_create :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send after_update :update_activity after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score diff --git a/app/models/user.rb b/app/models/user.rb index d6e4eb715..66a2cc5aa 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -82,7 +82,7 @@ class User < Principal #每日一报、一事一报、不报 MAIL_NOTIFICATION_OPTIONS = [ #['week', :label_user_mail_option_week], - ['day', :label_user_mail_option_day], + # ['day', :label_user_mail_option_day], ['all', :label_user_mail_option_all], ['none', :label_user_mail_option_none] ] diff --git a/app/views/blog_comments/_blog_comment_show_replies.html.erb b/app/views/blog_comments/_blog_comment_show_replies.html.erb index 3a3e8ef81..23cabb67d 100644 --- a/app/views/blog_comments/_blog_comment_show_replies.html.erb +++ b/app/views/blog_comments/_blog_comment_show_replies.html.erb @@ -19,7 +19,7 @@
- + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> diff --git a/app/views/courses/_course_activity_users.html.erb b/app/views/courses/_course_activity_users.html.erb index 459f60f3d..cffd383e6 100644 --- a/app/views/courses/_course_activity_users.html.erb +++ b/app/views/courses/_course_activity_users.html.erb @@ -1,4 +1,5 @@ -<% unless contributor_course_scor(course.id).count == 0 %> +<% count = contributor_course_scor(course.id).select{|ccs| ccs.con_score != 0 && !ccs.con_score.nil?}.count %> +<% unless count == 0 %>

    diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index eb7ecff7a..a0b526eee 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -25,7 +25,7 @@
    <% ids = 'project_respond_form_'+ journal.id.to_s%> - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%> <% if reply_allow %> diff --git a/app/views/courses/delete_member.js.erb b/app/views/courses/delete_member.js.erb index 89588f4c1..4e31a87c1 100644 --- a/app/views/courses/delete_member.js.erb +++ b/app/views/courses/delete_member.js.erb @@ -1,5 +1,9 @@ hideModal(); -$("#member_li_<%=params[:member_id] %>").html(""); +var all_indexes = $("#member_li_<%=params[:member_id] %>").nextAll().find("td:first-child"); +for(var i = 0; i < all_indexes.length; i++){ + $(all_indexes[i]).html(parseInt($(all_indexes[i]).html()) - 1); +} +$("#member_li_<%=params[:member_id] %>").remove(); $("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>"); $("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>"); $("#student_number").html("<%= studentCount(@course) %>"); diff --git a/app/views/courses/group_member.html.erb b/app/views/courses/group_member.html.erb index 73aed1487..3ad24f5c0 100644 --- a/app/views/courses/group_member.html.erb +++ b/app/views/courses/group_member.html.erb @@ -1,20 +1,8 @@
    -

    学生列表(<%=@group.name %>)

    -
    -
      -
    • -
        -
      • <%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:group_id => @group.id ,:format => 'xls'), :class => 'hw_more_li'%>
      • - <% if @canShowCode %> -
      • - <%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'hw_more_li' %> -
      • - <% end %> -
      -
    • -
    -
    +

    学生列表(<%=@group.name %>)

    + <%= link_to "导出成绩", export_course_member_excel_course_path(@course,:group_id => @group.id ,:format => 'xls'), :class => 'link-blue fr mt5'%> +
    diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index 606c0d67c..302e771ff 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -17,7 +17,7 @@ <% if User.current.allowed_to?(:as_teacher,@course) %> <%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'link-blue ml10 fr mt5' %> <% end %> - <%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'link-blue fr mt5'%> + <%= link_to "导出成绩", export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'link-blue fr mt5'%>
    <%= render :partial => 'course_student', :locals => {:members => @members} %> diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index c3b8b4dbe..80b77a79b 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -18,7 +18,8 @@
    - <%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %> + <% replies_count = Memo.where("root_id = #{topic.id}").count %> + <%= link_to (replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %> <%= get_praise_num(topic)%>
    diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index e67040138..c23cabe1b 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -24,7 +24,7 @@
    - + <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> diff --git a/app/views/layouts/_show_messages_list.html.erb b/app/views/layouts/_show_messages_list.html.erb index 2d6da0770..8e7be1fe1 100644 --- a/app/views/layouts/_show_messages_list.html.erb +++ b/app/views/layouts/_show_messages_list.html.erb @@ -147,7 +147,7 @@ <% end %> <% elsif ma.class == OrgMessage %> <% if ma.message_type == 'ApplySubdomain' && ma.organization %> -
  • 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>"><%=ma.organization.name %> 申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>
  • +
  • <%=ma.organization.name %> 申请子域名:<%= ma.content%>
  • <% elsif ma.message_type == 'AgreeApplySubdomain' %>
  • 系统提示 管理员同意了您的子域名申请:<%= ma.content%>
  • <% end %> diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index b57feb5bd..f5509959b 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -7,13 +7,10 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min') %> - <%= import_ke(enable_at: false, prettify: true, init_activity: false) %> - - <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/memos/_memo_all_replies.html.erb b/app/views/memos/_memo_all_replies.html.erb new file mode 100644 index 000000000..05ec1c1df --- /dev/null +++ b/app/views/memos/_memo_all_replies.html.erb @@ -0,0 +1,77 @@ +<% @replies.each do |reply| %> + + +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <%= render :partial => 'users/message_contents', :locals => {:comment => reply, :type => 'Memo', :user_activity_id => @memo.id}%> +
    +
    +

    <%= reply.content.gsub(/script/, "script ").html_safe %>

    +
    +
    +
    + + + <%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %> + + + <%= link_to( + l(:button_reply), + {:action => 'quote', :id => reply}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + <%= link_to( + l(:button_delete), + forum_memo_path(@memo.forum, reply), + :method => :delete, + :id => "delete_reply_#{reply.id}", + :class => 'fr mr20 undis', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete) + ) if @memo.author.id == User.current.id || User.current.admin? %> + +
    +
    +
    +

    +
    +
    +
    +<% end %> +<% if @limit_count > @page * @limit + 10 %> +
    +
    + + + <%= link_to '点击展开更多回复', forum_memo_path(@memo.forum_id, @memo, :page => @page),:remote=>true %> +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/memos/_reply_message.html.erb b/app/views/memos/_reply_message.html.erb new file mode 100644 index 000000000..ff8436a84 --- /dev/null +++ b/app/views/memos/_reply_message.html.erb @@ -0,0 +1,31 @@ +
    +
    + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %> +
    +
    + <% if User.current.logged? %> +
    + <%= form_for('memo',:url=>forum_memos_path,:method => "post") do |f|%> + <%= f.hidden_field :subject, :required => true, value: reply.subject %> + <%= f.hidden_field :forum_id, :required => true, value: reply.forum_id %> + <%= f.hidden_field :parent_id, :required => true, value: reply.id %> + <%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %> +
    + + +
    +

    + <% end%> +
    + <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
    +
    +
    +
    + \ No newline at end of file diff --git a/app/views/memos/quote.js.erb b/app/views/memos/quote.js.erb index 3dbf9eb95..d757dc7f5 100644 --- a/app/views/memos/quote.js.erb +++ b/app/views/memos/quote.js.erb @@ -1,5 +1,5 @@ -//ckeditor.setData("<%= raw escape_javascript(@content) %>"); -$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>"); -$('#quote').val("<%= raw escape_javascript(@content) %>"); -showAndScrollTo("new_memo", "cke_editor01"); -$("img").removeAttr("align"); \ No newline at end of file +if($("#reply_message_<%= @memo.id%>").length > 0) { + $("#reply_message_<%= @memo.id%>").replaceWith("<%= escape_javascript(render :partial => 'memos/reply_message', :locals => {:reply => @memo}) %>"); +}else if($("#reply_to_message_<%= @memo.id%>").length >0) { + $("#reply_to_message_<%= @memo.id%>").replaceWith("

    "); +} \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 25732c36b..922afe740 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -4,22 +4,6 @@ <% end %> -
    -
    - <% end %> +
    + <%= render :partial => 'memos/memo_all_replies' %>
    diff --git a/app/views/memos/show.js.erb b/app/views/memos/show.js.erb new file mode 100644 index 000000000..8ac3f6194 --- /dev/null +++ b/app/views/memos/show.js.erb @@ -0,0 +1 @@ +$("#more_memo_replies").replaceWith("<%= escape_javascript(render :partial => 'memos/memo_all_replies')%>"); \ No newline at end of file diff --git a/app/views/messages/_course_show_replies.html.erb b/app/views/messages/_course_show_replies.html.erb index e56d19406..3ea86596f 100644 --- a/app/views/messages/_course_show_replies.html.erb +++ b/app/views/messages/_course_show_replies.html.erb @@ -18,7 +18,7 @@
    - + <%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %> diff --git a/app/views/messages/_org_show_replies.html.erb b/app/views/messages/_org_show_replies.html.erb index df1b2c301..9b63c80ed 100644 --- a/app/views/messages/_org_show_replies.html.erb +++ b/app/views/messages/_org_show_replies.html.erb @@ -18,7 +18,7 @@
    - + <%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %> diff --git a/app/views/messages/_project_show_replies.html.erb b/app/views/messages/_project_show_replies.html.erb index b2f22aecb..637fade8a 100644 --- a/app/views/messages/_project_show_replies.html.erb +++ b/app/views/messages/_project_show_replies.html.erb @@ -18,7 +18,7 @@
    - + <%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %> diff --git a/app/views/news/_news_replies_detail.html.erb b/app/views/news/_news_replies_detail.html.erb index 924a6a329..0f4ede154 100644 --- a/app/views/news/_news_replies_detail.html.erb +++ b/app/views/news/_news_replies_detail.html.erb @@ -19,7 +19,7 @@
    - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> diff --git a/app/views/org_document_comments/_document_show_replies.html.erb b/app/views/org_document_comments/_document_show_replies.html.erb index c3faef645..8507a6272 100644 --- a/app/views/org_document_comments/_document_show_replies.html.erb +++ b/app/views/org_document_comments/_document_show_replies.html.erb @@ -20,7 +20,7 @@
    - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index e6d94042d..f78a22e6f 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -356,7 +356,7 @@
    - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index ea074344d..aa3237643 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -112,7 +112,7 @@ <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
    diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index 6b2146cb1..bbb7b84eb 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -81,7 +81,7 @@ <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
    diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 42f725d12..48814eb23 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -92,7 +92,7 @@ <%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
    diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index ae11b0042..fadb29c9e 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -91,7 +91,7 @@ <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(reply.created_on) %> - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
    diff --git a/app/views/praise_tread/praise_minus.js.erb b/app/views/praise_tread/praise_minus.js.erb index b55624930..057ecb8bd 100644 --- a/app/views/praise_tread/praise_minus.js.erb +++ b/app/views/praise_tread/praise_minus.js.erb @@ -2,7 +2,7 @@ <% if @type.to_s == 'activity' %> $('#praise_count_<%=@user_activity_id %>').html('<%= j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"activity"})%>'); <% else @type.to_s == 'reply' %> - $('#reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); + $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% end %> <% else %> $('#praise_tread').html('<%= j( diff --git a/app/views/praise_tread/praise_plus.js.erb b/app/views/praise_tread/praise_plus.js.erb index 29041cd57..5edc8c4cf 100644 --- a/app/views/praise_tread/praise_plus.js.erb +++ b/app/views/praise_tread/praise_plus.js.erb @@ -1,13 +1,13 @@ -<% if @obj_type == 'Memo'%> - $('#praise_tread_<%= @obj.id %>').html('<%= j( - render :partial => "/memos/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} - )%>'); -<% elsif @activity %> +<% if @activity %> <% if @type.to_s == 'activity' %> $('#praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"activity"})%>'); <% else @type.to_s == 'reply' %> - $('#reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); + $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% end %> +<% elsif @obj_type == 'Memo'%> + $('#praise_tread_<%= @obj.id %>').html('<%= j( + render :partial => "/memos/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} + )%>'); <% else %> $('#praise_tread_<%= @obj.id %>').html('<%= j( render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id,:horizontal => @horizontal} diff --git a/app/views/projects/_comment_reply_detail.html.erb b/app/views/projects/_comment_reply_detail.html.erb index f6e2b8fb3..9c29a8ae9 100644 --- a/app/views/projects/_comment_reply_detail.html.erb +++ b/app/views/projects/_comment_reply_detail.html.erb @@ -1,7 +1,7 @@
    <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user.id), :alt => "用户头像" %>
    -
    +
    <%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %> <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
    @@ -16,10 +16,10 @@ <%= comment.content_detail.html_safe %> <% end %>
    -
    +
    - - +
    + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> @@ -31,7 +31,7 @@ :title => l(:button_reply)) %> - +
    diff --git a/app/views/projects/_history.html.erb b/app/views/projects/_history.html.erb index d9abdf47b..4c9e48391 100644 --- a/app/views/projects/_history.html.erb +++ b/app/views/projects/_history.html.erb @@ -16,7 +16,7 @@
    <% ids = 'project_respond_form_'+ journal.id.to_s%> - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%> <% if journal.user == User.current|| User.current.admin? %> diff --git a/app/views/projects/_project_issue_comments_reply_detail.html.erb b/app/views/projects/_project_issue_comments_reply_detail.html.erb index 58b9f941e..e3a675fc5 100644 --- a/app/views/projects/_project_issue_comments_reply_detail.html.erb +++ b/app/views/projects/_project_issue_comments_reply_detail.html.erb @@ -1,7 +1,7 @@
    <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user.id), :alt => "用户头像" %>
    -
    +
    <%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %> <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
    @@ -16,13 +16,13 @@ <%= comment.content_detail.html_safe %> <% end %>
    -
    +
    - - +
    + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - + <%= link_to( l(:button_reply), {:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :parent_id => parent_id, :is_project => true}, @@ -31,7 +31,7 @@ :title => l(:button_reply)) %> - +
    diff --git a/app/views/projects/_project_issue_expand_show.html.erb b/app/views/projects/_project_issue_expand_show.html.erb index 6ea9442dc..2debb7789 100644 --- a/app/views/projects/_project_issue_expand_show.html.erb +++ b/app/views/projects/_project_issue_expand_show.html.erb @@ -29,7 +29,7 @@
    - + <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> diff --git a/app/views/projects/_project_message_replies.html.erb b/app/views/projects/_project_message_replies.html.erb index 91eec6cf5..1fefb172c 100644 --- a/app/views/projects/_project_message_replies.html.erb +++ b/app/views/projects/_project_message_replies.html.erb @@ -20,7 +20,7 @@
    - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> diff --git a/app/views/projects/_project_news_replies.html.erb b/app/views/projects/_project_news_replies.html.erb index 6b6d9e1fc..2ca86b314 100644 --- a/app/views/projects/_project_news_replies.html.erb +++ b/app/views/projects/_project_news_replies.html.erb @@ -29,7 +29,7 @@
    - + <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> diff --git a/app/views/pull_requests/_pull_request_changes.html.erb b/app/views/pull_requests/_pull_request_changes.html.erb index 5b85c72a4..f12783146 100644 --- a/app/views/pull_requests/_pull_request_changes.html.erb +++ b/app/views/pull_requests/_pull_request_changes.html.erb @@ -1,51 +1,31 @@ -<% if !@changes.blank? && @type == "3" %> -
    -
    -

    改动了 <%= @changes_count %> 个文件

    -
    -
      - <% @changes.each do |change| %> -
    • <%= change['new_path'] %>

    • - <% end %> -
    -
    - <% @changes.each do |change| %> - -
    - - - <% line_num = diff_line_num(change['diff']) %> - <% diff_content = diff_content(change['diff']) %> - <% syntax_highlight_lines('new_path', Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %> - - - <% if line[0,1] == "-" %> - - <% elsif line[0,1] == "+" %> - - <% else%> - - <% end %> - - <% line_num += 1 %> - <% end %> - -
    - <%= line_num %> -
    <%= line.html_safe %>
    <%= line.html_safe %>
    <%= line.html_safe %>
    -
    - <% end %> - -
    -
    -
      - <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> -
    -
    -
    -
    -<% end %> +<% if !@changes.blank? && @type == "3" %> +
    +
    +

    改动了 <%= @changes_count %> 个文件

    +
    +
      + <% @changes.each do |change| %> +
    • <%= change['new_path'] %>

    • + <% end %> +
    +
    + <% @changes.each do |change| %> + +
    + <%= render :partial => 'repositories/change_diff', :locals => {:change => change} %> +
    + <% end %> + +
    +
    +
      + <%= pagination_links_full @pages, @count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%> +
    +
    +
    +
    +<% end %> diff --git a/app/views/pull_requests/_pull_requests_list.html.erb b/app/views/pull_requests/_pull_requests_list.html.erb index 2258962a6..c594a2e56 100644 --- a/app/views/pull_requests/_pull_requests_list.html.erb +++ b/app/views/pull_requests/_pull_requests_list.html.erb @@ -14,10 +14,8 @@

    由 <%= link_to get_user_by_login_and(request.author.try(:username)).try(:show_name), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前

    <%= time_tag(request.updated_at) %>前更新 -

    <%= @project.name+"/"+request.source_branch %>合并到<%= request.target_branch %>

    +

    <%= find_gitlab_project(request.source_project_id)+"/"+request.source_branch %>合并到<%= find_gitlab_project(request.target_project_id)+"/"+request.target_branch %>

    <% end %> - - <% end %> \ No newline at end of file diff --git a/app/views/pull_requests/pull_request_changes.js.erb b/app/views/pull_requests/pull_request_changes.js.erb index 461cd3d06..19d03f06d 100644 --- a/app/views/pull_requests/pull_request_changes.js.erb +++ b/app/views/pull_requests/pull_request_changes.js.erb @@ -1 +1,2 @@ + $("#merge_record_3").html('<%= escape_javascript( render :partial => "pull_requests/pull_request_changes") %>'); \ No newline at end of file diff --git a/app/views/repositories/_change_diff.html.erb b/app/views/repositories/_change_diff.html.erb new file mode 100644 index 000000000..95126cd98 --- /dev/null +++ b/app/views/repositories/_change_diff.html.erb @@ -0,0 +1,50 @@ + + + + <% diff = ActiveSupport::JSON.decode(change.to_json) %> + <% diff = OpenStruct.new(diff) %> + <% @diff_file = Trustie::Gitlab::Diff::File.new(diff) %> + <% @diff_file.diff_lines.each_with_index do |line, index| %> + <% type = line.type %> + <% last_line = line.new_pos.to_s %> + <% line_old = line.old_pos.to_s %> + + <% if type.nil? || type == "match" %> + + + + + + <% else %> + <% old_line = type == 'new' ? ' '*4: line_old %> + <% new_line = type == 'old' ? ' '*4: last_line %> + + + + + + <% end %> + <% end %> + + + + + + +
    + <%= type == "match" ? "..." : line_old.center(4) %> + + <%= type == "match" ? "..." : last_line.center(4) %> + " > +
    <%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %>
    +
    + <%= old_line.to_s.center(4) %> + + <%= new_line.to_s.center(4) %> + +
    <%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %>
    +
    + ... + + ... +
    \ No newline at end of file diff --git a/app/views/repositories/commit_diff.html.erb b/app/views/repositories/commit_diff.html.erb index 417158c7e..7693b385c 100644 --- a/app/views/repositories/commit_diff.html.erb +++ b/app/views/repositories/commit_diff.html.erb @@ -9,42 +9,14 @@
    <%= @commit_details.message %>
    - - - - - - - - - <% @commit_diff.each do |cd| %> + <% @commit_diff.each do |commit_diff| %>
    - - - <% line_num = diff_line_num(cd.diff) %> - <% diff_content = diff_content(cd.diff) %> - <% syntax_highlight_lines(cd.new_path, Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %> - - - <% if line[0,1] == "-" %> - - <% elsif line[0,1] == "+" %> - - <% else%> - - <% end %> - - <% line_num += 1 %> - <% end %> - -
    - <%= line_num %> -
    <%= line.html_safe %>
    <%= line.html_safe %>
    <%= line.html_safe %>
    + <%= render :partial => 'repositories/change_diff', :locals => {:change => commit_diff} %>
    <% end %>
    diff --git a/app/views/student_work/_evaluation_un_group_member_work.html.erb b/app/views/student_work/_evaluation_un_group_member_work.html.erb index 347bea20e..23bef1cb0 100644 --- a/app/views/student_work/_evaluation_un_group_member_work.html.erb +++ b/app/views/student_work/_evaluation_un_group_member_work.html.erb @@ -27,7 +27,21 @@
    <% if st.student_score.nil? %> - 未参与 + <% pro = @homework.student_work_projects.where("user_id = #{st.user_id}").first + if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil? + work = st + else + work = StudentWork.find pro.student_work_id + end %> + <% if @homework.homework_detail_manual.comment_status < 2 %> + 未参与 + <% elsif @homework.homework_detail_manual.comment_status == 2 && work.student_works_evaluation_distributions.count != 0 %> + 待匿评 + <% elsif @homework.homework_detail_manual.comment_status == 3 && work.student_works_evaluation_distributions.count != 0 %> + 未评分 + <% else %> + 迟交 + <% end %> <% else %> <%= format("%.1f", st.student_score) %> <% end %> diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 9b247f3d6..42985806c 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -69,7 +69,19 @@ <% if @homework.anonymous_comment == 0%> <% if student_work.student_score.nil? %> - 未参与 + <% if student_work.work_status != 0 %> + <% if @homework.homework_detail_manual.comment_status < 2 %> + 未参与 + <% elsif @homework.homework_detail_manual.comment_status >= 2 && student_work.student_works_evaluation_distributions.count == 0 %> + 迟交 + <% elsif @homework.homework_detail_manual.comment_status == 2 && student_work.student_works_evaluation_distributions.count != 0 %> + 待匿评 + <% elsif @homework.homework_detail_manual.comment_status == 3 && student_work.student_works_evaluation_distributions.count != 0 %> + 未评分 + <% end %> + <% else %> + -- + <% end %> <% else %> <%=format("%.1f",student_work.student_score) %> <% end %> diff --git a/app/views/student_work/_relate_projects.html.erb b/app/views/student_work/_relate_projects.html.erb index b538d2aa6..c6a372a47 100644 --- a/app/views/student_work/_relate_projects.html.erb +++ b/app/views/student_work/_relate_projects.html.erb @@ -23,7 +23,7 @@

    <%= link_to project.members.count, allow_visit ? member_project_path(project) : 'javascript:void(0)', :class => "c_blue" %>成员  | <%= link_to project.project_score.issue_num, allow_visit ? project_issues_path(project) : 'javascript:void(0)', :class => "c_blue" %>问题  | - <%= link_to project.project_score.attach_num, allow_visit ? file_project_path(project) : 'javascript:void(0)', :class => "c_blue" %>资源 + <%= link_to project.project_score.changeset_num, visible_repository?(project) ? ({:controller => 'repositories', :action => 'show', :id => project, :repository_id => gitlab_repository(project).try(:identifier)}) : 'javascript:void(0)', :class => "c_blue" %>提交

    diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 8750a35a7..a88a41d97 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -51,37 +51,37 @@ // }); <%# end%> - function set_score_rule_submit() { - if($("#late_penalty_num").val() == ""){ - $("#late_penalty_num").val("0"); - } - if($("#absence_penalty_num").val() == ""){ - $("#absence_penalty_num").val("0"); - } - $('#muban_popup_box').find('form').submit(); - hideModal(); - } +// function set_score_rule_submit() { +// if($("#late_penalty_num").val() == ""){ +// $("#late_penalty_num").val("0"); +// } +// if($("#absence_penalty_num").val() == ""){ +// $("#absence_penalty_num").val("0"); +// } +// $('#muban_popup_box').find('form').submit(); +// hideModal(); +// } - //设置评分规则 - function set_score_rule(){ - <% if @homework.homework_type == 2 %> - <% if @homework.anonymous_comment == 0 %> - var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; - pop_box_new(htmlvalue, 570, 355); - <% else %> - var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; - pop_box_new(htmlvalue, 500, 285); - <% end %> - <% else %> - <% if @homework.anonymous_comment == 0 %> - var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; - pop_box_new(htmlvalue, 500, 325); - <% else %> - var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; - pop_box_new(htmlvalue, 500, 225); - <% end %> - <% end %> - } +// //设置评分规则 +// function set_score_rule(){ + + +// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; +// pop_box_new(htmlvalue, 570, 355); + +// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; +// pop_box_new(htmlvalue, 500, 285); + + + +// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; +// pop_box_new(htmlvalue, 500, 325); + +// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>"; +// pop_box_new(htmlvalue, 500, 225); + + +// }
    @@ -118,10 +118,10 @@ <% if @is_teacher%>
    -
      -
    • - -
        +
          +
        • + 导出 +
          • <%= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
          • @@ -141,9 +141,6 @@ <%= link_to("导出匿评情况", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'hworkExport resourcesGrey')%> <% end %> -
          • - 评分设置 -
        diff --git a/app/views/users/_comment_reply_detail.html.erb b/app/views/users/_comment_reply_detail.html.erb index 23382d972..12cd6874a 100644 --- a/app/views/users/_comment_reply_detail.html.erb +++ b/app/views/users/_comment_reply_detail.html.erb @@ -1,7 +1,7 @@
        <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user), :alt => "用户头像" %>
        -
        +
        <%= link_to comment.creator_user.show_name, user_path(comment.creator_user), :class => "content-username" %> <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
        @@ -16,16 +16,16 @@ <%= comment.content_detail.html_safe %> <% end %>
        -
        +
        - - +
        + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% if type == 'Message' %> <% topic = comment.root %> <% if !topic.locked? && authorize_for('messages', 'reply') %> - + <%= link_to( l(:button_reply), {:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id}, @@ -36,7 +36,7 @@ <% end %> <% else %> - + <%= link_to( l(:button_reply), {:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id}, @@ -46,7 +46,7 @@ <% end %> - +
        diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb index 7c834f201..86f5f8220 100644 --- a/app/views/users/_message_replies.html.erb +++ b/app/views/users/_message_replies.html.erb @@ -20,7 +20,7 @@
        - + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <% if type == 'Message' %> diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index 8861bd5c5..f14a7557f 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -29,7 +29,7 @@
        - + <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> <% if type == 'HomeworkCommon' %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 49e78521c..87d448944 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -7,7 +7,7 @@
      • - <%=link_to ma.course_message.author.show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to ma.course_message.author.try(:show_name), user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">发布了通知:
      • @@ -275,7 +275,7 @@
      • - <%= link_to ma.course_message.user.show_name, + <%= link_to ma.course_message.user.try(:show_name), user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> <%= ma.apply_result == 1 ? '同意' : '拒绝'%>引用作业:
      • @@ -304,7 +304,7 @@
      • - <%=link_to ma.course_message.user.show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to ma.course_message.user.try(:show_name), user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">发布了问卷:
      • @@ -327,7 +327,7 @@
      • - <%=link_to User.find(ma.course_message.author_id).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to ma.course_message.author.try(:show_name), user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %>
      • <% if ma.course_message.parent_id.nil? %> @@ -423,7 +423,7 @@
      • - <%= link_to ma.course_message.user.show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%= link_to ma.course_message.user.try(:show_name), user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">在班级中留言了:
      • @@ -447,7 +447,7 @@
      • - <%= link_to ma.course_message.user.show_name, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%= link_to ma.course_message.user.try(:show_name), user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <% if ma.course_message.m_parent_id.nil? %> 回复了您的作业: diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index b32e7bcb4..5204a9bff 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -162,7 +162,7 @@ <% if ma.forge_message_type == "Message" %>
        • <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
        • -
        • <%=link_to User.find(ma.forge_message.author_id).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> +
        • <%=link_to ma.forge_message.author.try(:show_name), user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %>
        • <%= link_to ma.forge_message.subject, board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> @@ -181,7 +181,7 @@
        • - <%=link_to User.find(ma.forge_message.author_id).show_name, user_path(ma.forge_message.author), + <%=link_to ma.forge_message.author.try(:show_name), user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">评论了新闻:
        • diff --git a/app/views/users/reply_detail.js.erb b/app/views/users/reply_detail.js.erb index 097d36720..23de03a76 100644 --- a/app/views/users/reply_detail.js.erb +++ b/app/views/users/reply_detail.js.erb @@ -43,6 +43,8 @@ $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(re window.location.href = "<%=org_document_comment_path(:id => @root.id, :organization_id => @root.organization.id) %>"; <% end %> <% elsif @type == 'Syllabus' %> -$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'syllabuses/syllabus_post_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id}) %>"); + $("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'syllabuses/syllabus_post_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id}) %>"); +<% elsif @type == 'Memo' %> + window.location.href = "<%=forum_memo_path(@root.forum_id, @root) %>"; <% end %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/users/show_all_replies.js.erb b/app/views/users/show_all_replies.js.erb index d5d2a6b54..b02cb0add 100644 --- a/app/views/users/show_all_replies.js.erb +++ b/app/views/users/show_all_replies.js.erb @@ -5,7 +5,7 @@ $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'projects/journal_comment_reply', :locals => {:comment => @comment.parent, :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>"); <% elsif params[:type] == 'is_project_issue' %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => @comment.parent, :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>"); - <% elsif (@comment.class.to_s == 'Message' || @comment.class.to_s == 'BlogComment' || @comment.class.to_s == 'OrgDocumentComment') %> + <% elsif (@comment.class.to_s == 'Message' || @comment.class.to_s == 'BlogComment' || @comment.class.to_s == 'OrgDocumentComment' || @comment.class.to_s == 'Memo') %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>"); <% else %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>"); diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 2e06c1fb1..eefe52bd2 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -36,7 +36,7 @@ <%= format_time reply.created_on %>