This commit is contained in:
ouyangxuhua 2016-01-14 17:53:22 +08:00
commit 276b07df8a
15 changed files with 3493 additions and 3464 deletions

View File

@ -90,7 +90,7 @@ class Attachment < ActiveRecord::Base
before_save :files_to_final_location,:act_as_course_activity
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index#, :decrease_attchments_count
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count
# add by nwb
# 获取所有可公开的资源文件列表
@ -641,12 +641,12 @@ class Attachment < ActiveRecord::Base
end
end
# def decrease_attchments_count
# if self.container_type == "Project"
# count = self.container.attachments_count
# #self.container.update_attribute(:attachments_count, self.container.attachments_count - 1)
# end
# end
def decrease_attchments_count
if self.container_type == "Project" && !self.project.project_score.nil?
aatach_count = self.container.project_score.attach_num - 1+
self.container.project_score.update_attribute(:attach_num, aatach_count)
end
end
end
# Delete the previous articles index in Elasticsearch

View File

@ -219,15 +219,15 @@ class Journal < ActiveRecord::Base
def decrease_issues_journal_count
unless self.issue.project.nil?
project = self.issue.project
project.update_attribute(:journals_count, project.journals_count - 1)
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num - 1)
end
end
# issue留言总数更新
def add_journals_count
if !self.issue.project.nil? && self.journalized_type == "Issue" && self.issue.project.project_score.nil?
if !self.issue.project.nil? && self.journalized_type == "Issue" && !self.issue.project.project_score.nil?
project = self.issue.project
project.project_score.update_attribute(:issue_journal_num, project.project_score.journals_count + 1)
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
end
end
end

View File

@ -128,32 +128,28 @@ class Message < ActiveRecord::Base
# 发帖精辟更新发帖总数
def add_boards_count
unless self.project.project_score.nil?
if self.project
# 讨论区
if self.parent_id.nil?
count = self.project.project_score.board_num + 1
self.project.project_score.update_attribute(:board_num, count)
else # 回复
count = self.project.project_score.board_message_num + 1
self.project.project_score.update_attribute(:board_message_num, count)
end
if self.project && !project.project_score.nil?
# 讨论区
if self.parent_id.nil?
count = self.project.project_score.board_num + 1
self.project.project_score.update_attribute(:board_num, count)
else # 回复
count = self.project.project_score.board_message_num + 1
self.project.project_score.update_attribute(:board_message_num, count)
end
end
end
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
def decrease_boards_count
unless self.project.project_score.nil?
if self.project && self.parent_id.nil?
# 讨论区
if self.parent_id.nil?
count = self.project.project_score.board_num - 1
self.project.project_score.update_attribute(:board_num, count)
else # 回复
count = self.project.project_score.board_message_num - 1
self.project.project_score.update_attribute(:board_message_num, count)
end
if self.project && !project.project_score.nil?
# 讨论区
if self.parent_id.nil?
count = self.project.project_score.board_num - 1
self.project.project_score.update_attribute(:board_num, count)
else # 回复
count = self.project.project_score.board_message_num - 1
self.project.project_score.update_attribute(:board_message_num, count)
end
end
end

View File

@ -205,7 +205,7 @@
<div class="loginContent">
<div class="loginLeft">
<div class="loginLogo"><img src="images/trustie_big_log.png" width="100" height="88" alt="Trustie Logo" /></div>
<div class="loginInro">&nbsp;&nbsp;欢迎加入Trustie高校创新实践社区!老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。<br/><br/>&nbsp;&nbsp;Trustie是在中国推行大规模开放在线研究模式MOORE的支撑平台。</div>
<div class="loginInro">&nbsp;&nbsp;欢迎加入Trustie创新实践社区在这里您的创新意识和创新潜力将得到充分发挥目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。<br/><br/>&nbsp;&nbsp;Trustie社区的理想是让创新过程变的更美好</div>
</div>
<div class="loginRight">
<div id="loginInBox">

View File

@ -1,4 +1,4 @@
<!-- added by bai -->
<div><%= l(:label_code_submit_number) %> * 4 = <%= changesets_num(@project) %> * 4 = <%= format("%.2f" , changesets_score(@project)).to_i %></div>
<div><%= l(:label_code_submit_score) %> = <%= format("%.2f" , changesets_score(@project)).to_i %></div>
<div><%= l(:label_code_submit_number) %> * 4 = <%= project.project_score.changeset_num %> * 4 = <%= project.project_score.changeset_num * 4 %></div>
<div><%= l(:label_code_submit_score) %> = <%= project.project_score.changeset_num * 4 %></div>
<!-- end -->

View File

@ -1,4 +1,2 @@
<!-- added by bai -->
<div><%= l(:label_file_number) %> * 4 = <%= documents_num(@project) %> * 4 = <%= format("%.2f" , documents_score(@project)).to_i %></div>
<div><%= l(:label_file_score) %> = <%= format("%.2f" , documents_score(@project)).to_i %></div>
<!-- end -->
<div><%= l(:lable_file_attachment_number) %> * 5 = <%= project.project_score.attach_num %> * 5 = <%= project.project_score.attach_num * 5 %></div>
<div><%= l(:label_file_attachment_score) %> = <%= project.project_score.attach_num * 5 %></div>

View File

@ -1,4 +1,4 @@
<div><%= l(:label_issue_number) %> * 4 = <%= issue_num(project) %> * 4 = <%= format("%.2f" , issue_num(project) * 4).to_i %></div>
<div><%= l(:label_issue_journal_number) %> * 1 = <%= issue_journal_num(project) %> * 1 = <%= format("%.2f" , issue_journal_num(project)).to_i %></div>
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_num(project) * 4).to_i %> + <%= format("%.2f" , issue_journal_num(project)).to_i %>
= <%= format("%.2f" , issue_score(project)).to_i %></div>
<div><%= l(:label_issue_number) %> * 4 = <%= issue_num(project) %> * 4 = <%= project.project_score.issue_num * 4 %></div>
<div><%= l(:label_issue_journal_number) %> * 1 = <%= project.project_score.issue_journal_num %> * 1 = <%= project.project_score.issue_journal_num * 1 %></div>
<div><%= l(:label_issue_score) %> = <%= project.project_score.issue_num * 4 %> + <%= project.project_score.issue_journal_num * 1 %>
= <%= @project.project_score.issue_num * 4 + @project.project_score.issue_journal_num %></div>

View File

@ -1,2 +1,2 @@
<div><%= l(:label_new_number) %> * 1 = <%= news_num(@project) %> * 1 = <%= format("%.2f" , news_score(@project)).to_i %></div>
<div><%= l(:label_news_score) %> = <%= format("%.2f" , news_score(@project)).to_i %></div>
<div><%= l(:label_new_number) %> * 1 = <%= project.project_score.news_num %> * 1 = <%= project.project_score.news_num * 1 %></div>
<div><%= l(:label_news_score) %> = <%= project.project_score.news_num * 1 %></div>

View File

@ -1,4 +1,4 @@
<!-- added by bai -->
<div><%= l(:label_topic_number) %> * 2 = <%= board_message_num(@project) %> * 2 = <%= board_message_score(@project) %></div>
<div><%= l(:label_topic_score) %> = <%= format("%.2f" , board_message_score(@project)).to_i %></div>
<div><%= l(:label_topic_number) %> * 2 = <%= project.project_score.board_num %> * 2 = <%= project.project_score.board_num * 2 %></div>
<div><%= l(:label_topic_score) %> = <%= project.project_score.board_num * 2 %></div>
<!-- end -->

View File

@ -19,6 +19,36 @@
</table>
</div>
<script type="text/javascript">
function show_div(url)
{
if(url == 'project_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/project_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'issue_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/issue_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'news_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/news_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'file_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/file_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'code_submit_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/code_submit_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'projects_topic_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/projects_topic_score_index', :locals => {:project => @project}) %>');
}
}
</script>
<div class="tabs_new">
<ul>
<li>
@ -31,7 +61,7 @@
<%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.issue_num * 4 + @project.project_score.issue_journal_num %>
</li>
<li>
<%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.project_score.attach_num * 5 %>
<%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('file_score_index')"%> : <%= @project.project_score.attach_num * 5 %>
</li>
<li>
<%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> : <%= @project.project_score.board_num * 2 + @project.project_score.board_message_num %>

View File

@ -433,6 +433,7 @@ zh:
label_file_score: 文档得分
label_file_number: 文档的数量
lable_file_attachment_number: 资源数
label_file_attachment_score: 资源得分
label_code_submit_score: 代码提交得分

File diff suppressed because it is too large Load Diff

View File

@ -1099,6 +1099,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c
.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;}
.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;}
.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;}
.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{overflow: hidden; text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: normal !important;}
.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;}
.postDetailDate {color:#888888; font-size:12px; float:left;}
.postDetailReply { margin-top:28px; color:#888888; float:right;}

File diff suppressed because it is too large Load Diff

View File

@ -1109,6 +1109,7 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;}
.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;}
.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;}
.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;}
.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{overflow: hidden; text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: normal !important;}
.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;}
.postDetailDate {color:#888888; font-size:12px; float:left;}
.postDetailReply { margin-top:28px; color:#888888; float:right;}