diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index d8cd8eeec..6cebfef7a 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -74,7 +74,7 @@ class JournalsController < ApplicationController text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" - @content = "
" << @content + # @content = "
" << @content @id = user.id rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 0d0b82752..7aa793d82 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -104,13 +104,13 @@ class Mailer < ActionMailer::Base # 查询user的缺陷,项目中成员都能收到 sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' - and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.updated_on desc" + and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.project_id, i.updated_on desc" @issues = Issue.find_by_sql(sql) # issue回复 @issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id - and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by i.project_id, created_on desc") # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 # @attachments查询课程课件更新 @@ -120,17 +120,17 @@ class Mailer < ActionMailer::Base count = courses.count count = count - 1 for i in 0..count do - bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc") - attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC') + bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order(" '#{courses[i].id}', homework_commons.created_at desc") + attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order(" '#{courses[i].id}',attachments.created_on DESC' ") @bids += bids if bids.count > 0 @attachments += attachments if attachments.count > 0 end - @bids.sort {|a, b| a.created_at <=> b.created_at} + # @bids = @bids.sort_by { |obj| obj.created_at } end # 项目附件 @project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a - where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by a.created_on desc") + where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, a.created_on desc") # user 提交的作业 # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") @@ -138,18 +138,18 @@ class Mailer < ActionMailer::Base # 查询user所在项目添加wiki @wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0 - and (wc.updated_on between '#{date_from}' and '#{date_to}') order by updated_on desc") + and (wc.updated_on between '#{date_from}' and '#{date_to}') order by m.project_id, updated_on desc") # 查询user在课程中发布的讨论帖子 course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where b.id = me.board_id and b.course_id = m.course_id and b.course_id is not Null and m.user_id = '#{user.id}' - and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and (me.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc") # 查询user在项目中发布的讨论帖子 project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where b.id = me.board_id and b.project_id = m.project_id - and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc") # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") @course_messages ||= [] @project_messages ||= [] @@ -168,31 +168,31 @@ class Mailer < ActionMailer::Base # 查询user在课程中发布的通知和回复通知 @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.course_id in (#{course_ids}) - and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] + and (created_on between '#{date_from}' and '#{date_to}') order by n.course_id, created_on desc") : [] @course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id - and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc") # 查询user在项目中添加新闻和回复新闻 @project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids}) - and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] + and (created_on between '#{date_from}' and '#{date_to}') order by n.project_id, created_on desc") : [] @project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id - and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc") # 查询user在课程及个人中留言 @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id - and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc") @user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') # 查询user在项目中留言(用户反馈) @project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id - and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc") # 查询user新建贴吧或发布帖子 @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") diff --git a/app/models/memo.rb b/app/models/memo.rb index 2831effe3..e0abaa19f 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -9,7 +9,7 @@ class Memo < ActiveRecord::Base # 若是主题帖,则内容可以是空 #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } validates_length_of :subject, maximum: 50 - #validates_length_of :content, maximum: 3072 + validates_length_of :content, maximum: 5000 validate :cannot_reply_to_locked_topic, :on => :create acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC" diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb index 87bf5b864..a1c278a7a 100644 --- a/app/views/files/create.js.erb +++ b/app/views/files/create.js.erb @@ -21,14 +21,26 @@ $("#attachments_fields").children().remove(); $("#upload_file_count").text("未上传文件"); $('#upload_file_div').slideToggle('slow'); - <% if @project%> + <% if @project %> closeModal(); $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>'); +// 添加文件上传成功提示 + <% unless params[:attachments].nil? %> + var div = $('
文件上传成功!
'); + $("#course_list").prepend(div); + setTimeout( function(){div.remove();},3000) + <% end %> <%elsif @course%> closeModal(); $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); $("#courses_files_count_info").html("<%= @all_attachments.count%>"); $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") + // 添加文件上传成功提示, + <% unless params[:attachments].nil? %> + var div = $('
文件上传成功!
'); + $("#course_list").prepend(div); + setTimeout( function(){div.remove();},3000) + <% end %> <% end %> <% end %> $(document).ready(img_thumbnails); diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 444016db8..1f3f984b4 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -23,7 +23,7 @@
回复 - <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %> + <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 616e205c4..0fcb37021 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -11,7 +11,7 @@
<%= link_to issue.author.name, user_path(issue.author), :class => "problem_name c_orange fl" %> <%= l(:label_post_on_issue) %>(<%= "#{raw column_content[2]}" %>): -
+
<%=link_to "#{column_content[4]}#{get_issue_type(column_content[1])[1]}".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %>
diff --git a/app/views/journals/diff.html.erb b/app/views/journals/diff.html.erb index 5bc823c76..190459b71 100644 --- a/app/views/journals/diff.html.erb +++ b/app/views/journals/diff.html.erb @@ -1,5 +1,5 @@

<%=h @issue.tracker %> #<%= @issue.id %>

-

<%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %>

+

由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %>

<%= simple_format_without_paragraph @diff.to_html %> diff --git a/app/views/journals/new.js.erb b/app/views/journals/new.js.erb index d02568426..ae2574595 100644 --- a/app/views/journals/new.js.erb +++ b/app/views/journals/new.js.erb @@ -1,11 +1,11 @@ -$('#journal_issue_note').html("<%= raw escape_javascript(@content.html_safe) %>"); -$("input[name='issue_quote_new']").val("<%= raw escape_javascript(@content.html_safe) %>"); +$('#issue_notes').val("<%= raw escape_javascript(@content) %>"); <% # when quoting a private journal, check the private checkbox - if @journal && @journal.private_notes? + if @journal && @journal.private_notes? %> $('#issue_private_notes').attr('checked', true); <% end %> + showAndScrollTo("update", "notes"); $('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight; diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index 6d4369c7b..c89f0af26 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -34,6 +34,7 @@ <%= l(:label_release_news) %>: <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> + <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %>