Merge branch 'dev_hjq' into szzh

This commit is contained in:
huang 2015-07-03 16:05:44 +08:00
commit a2da6fb55b
14 changed files with 45 additions and 28 deletions

View File

@ -74,7 +74,7 @@ class JournalsController < ApplicationController
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
# @content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
@id = user.id
rescue ActiveRecord::RecordNotFound
render_404

View File

@ -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")

View File

@ -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"

View File

@ -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 = $('<div id="addBox" class="flash notice">文件上传成功!</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 = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %>
<% end %>
$(document).ready(img_thumbnails);

View File

@ -23,7 +23,7 @@
<div id="journal_issue_note" class="wiki"></div>
<input name="issue_quote_new" type="hidden" value="<%= %>" />
<fieldset><legend>回复</legend>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
</fieldset>
<!--<%# if @issue.safe_attribute? 'private_notes' %>-->
<!--<label for="issue_private_notes"><%#= f.check_box :private_notes, :no_label => true %> <%#= l(:field_private_notes) %></label>-->

View File

@ -11,7 +11,7 @@
<div class="problem_txt fl">
<%= link_to issue.author.name, user_path(issue.author), :class => "problem_name c_orange fl" %>
<span class="fl"><%= l(:label_post_on_issue) %>(<%= "#{raw column_content[2]}" %>)</span>
<div class="problem_tit_div fl">
<div class="problem_tit_div fl break_word">
<%=link_to "#{column_content[4]}<span class = '#{get_issue_type(column_content[1])[0]}'>#{get_issue_type(column_content[1])[1]}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %>
</div>
<div class="cl"></div>

View File

@ -1,5 +1,5 @@
<h3><%=h @issue.tracker %> #<%= @issue.id %></h3>
<p><%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %></p>
<p>由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %></p>
<div class="text-diff">
<%= simple_format_without_paragraph @diff.to_html %>

View File

@ -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;

View File

@ -34,6 +34,7 @@
<%= l(:label_release_news) %>
</span>
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<%=link_to "<span class = 'pic_mes'>#{news.comments.all.count}</span>".html_safe, news_path(news.id), :class => "pro_mes_w" %>
<br />
<div class="cl mb5"></div>
<script>

View File

@ -27,7 +27,8 @@
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
<span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<%=link_to "<span class = 'pic_mes'>#{news.comments.all.count}</span>".html_safe, news_path(news.id), :class => "pro_mes_w_news" %><br />
<div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%=textAreailizable news.description %><br /> </p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>

View File

@ -116,9 +116,9 @@
</p>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %>
<%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %>
<% content_for :sidebar do %>
<%= form_tag({}, :method => :get) do %>

View File

@ -399,6 +399,7 @@ zh:
label_issue_number: issue的数量
label_issue_journal_number: issue的留言数量
label_project_mail_feedback: 项目留言
label_project_issue_feedback: 留言
label_news_score: 新闻得分
label_new_number: 新闻的数量

View File

@ -52,6 +52,7 @@ a:hover.problem_pic{border:1px solid #64bdd9;}
a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
a:hover.problem_name{ color:#d33503;}
a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a.pro_mes_w{ height:20px; float:right;display:block; color:#999999;}
a:hover.problem_tit{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
/****翻页***/

View File

@ -84,6 +84,7 @@ a:hover.problem_tit,a:hover.problem_tit02{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
a.pro_mes{ float:left; color:#a0a0a0; display:block; width:100px; height:20px; }
a.pro_mes_w{ height:20px; float:left;display:block; color:#999999;}
a.pro_mes_w_news{ height:20px; float:right;display:block; color:#999999;}
.pro_page_top{ font-size:14px; border-bottom:2px solid #64bdd9; margin-bottom:10px; padding-bottom:5px;}
.pro_page_tit{color:#3e4040; font-weight:bold;width:480px; float:left; font-size:14px; margin-bottom:5px;}