Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
sw 2014-08-18 10:14:29 +08:00
commit 1cd00f55fb
7 changed files with 23 additions and 10 deletions

View File

@ -279,7 +279,7 @@ class ApplicationController < ActionController::Base
# Find project of id params[:id] # Find project of id params[:id]
def find_project def find_project
@project = Project.find(params[:id]) @project = Project.find_by_id(params[:id])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end

View File

@ -1442,6 +1442,8 @@ module ApplicationHelper
email = $1 email = $1
end end
return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil
#options ={"class" => ["avatar2"],"width" =>["80px"],"height" =>["80px"]}
#return image_tag url_to_avatar(user), options
else else
'' ''
end end

View File

@ -16,7 +16,7 @@ module ProjectScoreHelper
end end
#文档数量 #文档数量
def document_num project def documents_num project
project.documents.count project.documents.count
end end
@ -48,8 +48,8 @@ module ProjectScoreHelper
end end
#文档得分 #文档得分
def document_score project def documents_score project
d_num = document_num project d_num = documents_num(project)
d_num * 4 d_num * 4
end end
@ -67,7 +67,7 @@ module ProjectScoreHelper
#计算项目得分 #计算项目得分
def project_scores project def project_scores project
result = (issue_score project) + (news_score project) + (document_score project) + (changesets_score project) + (board_message_score project) result = (issue_score project) + (news_score project) + (documents_score project) + (changesets_score project) + (board_message_score project)
pss = ProjectScore.where("project_id = '#{project.id}'") pss = ProjectScore.where("project_id = '#{project.id}'")
if pss.nil? || pss.count == 0 if pss.nil? || pss.count == 0
ps = ProjectScore.new ps = ProjectScore.new

View File

@ -20,7 +20,8 @@
<%= authoring reply.created_on, reply.user %>. <%= authoring reply.created_on, reply.user %>.
</p> </p>
<%= avatar(reply.user, :size => "32") %> <%= image_tag(url_to_avatar(reply.user), :class => 'avatar2', :width=>32, :height=>32) %>
<%#= avatar(reply.user, :size => "32") %>
<ul> <ul>
<% for detail in reply.details %> <% for detail in reply.details %>
<li><%= show_detail(detail) %></li> <li><%= show_detail(detail) %></li>

View File

@ -62,7 +62,8 @@
<!-- author and creation time --> <!-- author and creation time -->
<p class="author"> <p class="author">
<%= avatar(@review.user, :size => "64") %> <%= image_tag(url_to_avatar(@review.user), :class => 'avatar2', :width=>64, :height=>64) %>
<%#= avatar(@review.user, :size => "64") %>
<br /> <br />
<%= authoring @review.created_at, @review.user %>. <%= authoring @review.created_at, @review.user %>.
<%= l(:label_updated_time, distance_of_time_in_words(Time.now, @review.updated_at)) + '.' if @review.created_at != @review.updated_at %> <%= l(:label_updated_time, distance_of_time_in_words(Time.now, @review.updated_at)) + '.' if @review.created_at != @review.updated_at %>

View File

@ -19,8 +19,8 @@
<script> <script>
function change_option(flag) { function change_option(flag) {
var url = "<%= raw url_for(:controller => 'code_review', :action=>'index', :id => @project) %>"; // var url = "<%= raw url_for(:controller => 'code_review', :action=>'index', :id => @project) %>";
$('#content').load(url, {'show_closed': flag}); // $('#content').load(url, {'show_closed': flag});
} }
</script> </script>
<div id="code_review_list"> <div id="code_review_list">
@ -32,6 +32,15 @@ function change_option(flag) {
<p> <p>
<%= form_tag({:controller => 'code_review', :action=>'index', :id => @project}, :id => 'optionform') do %> <%= form_tag({:controller => 'code_review', :action=>'index', :id => @project}, :id => 'optionform') do %>
<%= check_box_tag 'show_closed', 'true', @show_closed, :onchange => "change_option($('#show_closed').is(':checked'));"%> <%=h l(:label_show_closed_reviews) %> <%= check_box_tag 'show_closed', 'true', @show_closed, :onchange => "change_option($('#show_closed').is(':checked'));"%> <%=h l(:label_show_closed_reviews) %>
<script type="text/javascript">
$(document).ready(function (){
$("#optionform").change(function(){
$("#optionform").submit();
});
});
</script>
<% end %> <% end %>
<%# observe_field 'show_closed', :with => 'show_closed', :update => 'content' %> <%# observe_field 'show_closed', :with => 'show_closed', :update => 'content' %>
</p> </p>