From f03cc6c74c73e148e2e56f775b0a034b135c2870 Mon Sep 17 00:00:00 2001 From: baiyu Date: Thu, 23 Jan 2014 14:34:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=80=E6=9C=89=E9=A1=B9=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E3=80=81=E5=88=9B=E5=AE=A2=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=88=86=E6=95=B0=E9=83=BD=E8=83=BD=E8=A2=AB=E7=82=B9?= =?UTF-8?q?=E5=87=BB=EF=BC=8C=E7=84=B6=E5=90=8E=E5=BC=B9=E5=87=BA=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=88=96=E4=B8=AA=E4=BA=BA=E7=9A=84=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=EF=BC=9B=E7=82=B9=E5=87=BB=E5=BA=94=E8=AF=A5=E5=9C=A8=E5=88=86?= =?UTF-8?q?=E6=95=B0=E4=B8=8A=E8=80=8C=E4=B8=8D=E6=98=AF=E6=96=87=E5=AD=97?= =?UTF-8?q?=E4=B8=8A=E3=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 完成:1、项目列表分数都能被点击,弹出项目窗口,点击应该在分数上而不是文字上 2、创客列表中的分数都能被点击,弹出个人的窗口,点击应该在分数上而不是文字上 --- app/views/layouts/base_projects.html.erb | 8 +++- app/views/layouts/base_users.html.erb | 10 +++-- .../_code_submit_score_index.html.erb | 2 + app/views/projects/_file_score_index.html.erb | 4 +- app/views/projects/_news_score_index.html.erb | 4 +- app/views/projects/_project.html.erb | 42 +++++++++++++++++-- .../projects/_project_score_index.html.erb | 2 + .../_projects_topic_score_index.html.erb | 2 + .../projects/code_submit_score_index.js.erb | 4 +- app/views/projects/file_score_index.js.erb | 4 +- app/views/projects/issue_score_index.js.erb | 2 + app/views/projects/news_score_index.js.erb | 2 + app/views/projects/project_score_index.js.erb | 2 + .../projects_topic_score_index.js.erb | 4 +- app/views/projects/show_projects_score.js.erb | 4 +- app/views/users/_show_score.html.erb | 2 + app/views/users/_user_show.html.erb | 38 ++++++++++++++++- app/views/users/activity_score_index.js.erb | 4 +- app/views/users/influence_score_index.js.erb | 4 +- app/views/users/project_score_index.js.erb | 4 +- app/views/users/score_index.js.erb | 4 +- app/views/users/show_score.js.erb | 2 + app/views/users/topic_score_index.js.erb | 4 +- 23 files changed, 137 insertions(+), 21 deletions(-) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 0783a01f5..15b52b1e7 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -88,8 +88,12 @@ <% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %> <% if @project.project_type == 0 %> - <%= link_to(l(:label_project_grade), {:controller => 'projects', :action => 'show_projects_score', :remote => true, :id => @project.id})%> : - <%= format("%.2f" , finall_project_score ).to_f %> + <%= l(:label_project_grade)%> : + <%= link_to(format("%.2f" , finall_project_score ).to_f, {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, + :id => @project.id + }, :style => "color: #EC6300;")%> <% end %> diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index a08b48314..b57c6df13 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -93,9 +93,13 @@ <% finall_influence_score = news_score + wiki_contents_score + comments_score %> <% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> - - <%= link_to(l(:label_user_grade), {:controller => 'users', :action => 'show_score', :remote => true, :id => @user.id})%>: - <%= format("%.2f" , finall_user_score).to_f %> + + <%= l(:label_user_grade)%>: + <%= link_to(format("%.2f" , finall_user_score).to_f, {:controller => 'users', + :action => 'show_score', + :remote => true, + :id => @user.id + }, :style => 'color :#E8770D;') %> diff --git a/app/views/projects/_code_submit_score_index.html.erb b/app/views/projects/_code_submit_score_index.html.erb index 0e14f4a85..238993afe 100644 --- a/app/views/projects/_code_submit_score_index.html.erb +++ b/app/views/projects/_code_submit_score_index.html.erb @@ -1,5 +1,7 @@ + <% changeset_count = @project.changesets.count %> <% code_submit_score = changeset_count * 0.3 %> <% finall_code_submit_score = code_submit_score %>
<%= l(:label_code_submit_number) %> * 0.3 = <%= changeset_count %> * 0.3 = <%= format("%.2f" , code_submit_score).to_f %>
<%= l(:label_code_submit_score) %> = <%= format("%.2f" , finall_code_submit_score).to_f %>
+ \ No newline at end of file diff --git a/app/views/projects/_file_score_index.html.erb b/app/views/projects/_file_score_index.html.erb index d6a4e1f73..3b4810f65 100644 --- a/app/views/projects/_file_score_index.html.erb +++ b/app/views/projects/_file_score_index.html.erb @@ -1,5 +1,7 @@ + <% document_count = @project.documents.count %> <% file_score = document_count * 0.1 %> <% finall_file_score = file_score %>
<%= l(:label_file_number) %> * 0.1 = <%= document_count %> * 0.1 = <%= format("%.2f" , file_score).to_f %>
-
<%= l(:label_file_score) %> = <%= format("%.2f" , finall_file_score).to_f %>
\ No newline at end of file +
<%= l(:label_file_score) %> = <%= format("%.2f" , finall_file_score).to_f %>
+ \ No newline at end of file diff --git a/app/views/projects/_news_score_index.html.erb b/app/views/projects/_news_score_index.html.erb index db0b98138..0f374b871 100644 --- a/app/views/projects/_news_score_index.html.erb +++ b/app/views/projects/_news_score_index.html.erb @@ -1,5 +1,7 @@ + <% new_count = @project.news.count %> <% new_score = new_count * 0.1 %> <% finall_new_score = new_score %>
<%= l(:label_new_number) %> * 0.1 = <%= new_count %> * 0.1 = <%= format("%.2f" , new_score).to_f %>
-
<%= l(:label_news_score) %> = <%= format("%.2f" , finall_new_score).to_f %>
\ No newline at end of file +
<%= l(:label_news_score) %> = <%= format("%.2f" , finall_new_score).to_f %>
+ \ No newline at end of file diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index cd7c76030..541a71f51 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -87,14 +87,50 @@
<%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(@project.created_on)) %>
+ +
+ <% issue_count = @project.issues.count %> + <% issue_journal_count = @project.issue_changes.count %> + <% issue_score = issue_count * 0.2 %> + <% issue_journal_score = issue_journal_count * 0.1 %> + <% finall_issue_score = issue_score + issue_journal_score %> + + <% new_count = @project.news.count %> + <% new_score = new_count * 0.1 %> + <% finall_new_score = new_score %> + + <% document_count = @project.documents.count %> + <% file_score = document_count * 0.1 %> + <% finall_file_score = file_score %> + + <% changeset_count = @project.changesets.count %> + <% code_submit_score = changeset_count * 0.3 %> + <% finall_code_submit_score = code_submit_score %> + + <% board_message_count = 0 %> + <% @project.boards.each do |board| %> + <% board_message_count += board.messages_count %> + <% end %> + <% topic_score = board_message_count * 0.1 %> + <% finall_topic_score = topic_score %> + + <% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %> + <% if @project.project_type !=1 %> - <%= content_tag('span', "#{l(:label_project_grade)}: ")%><%=@project.project_status ? @project.project_status.grade : 0.0 %> + <%= l(:label_project_grade)%>: + + <%= link_to(format("%.2f" , finall_project_score ).to_f, + {:controller => 'projects', + :action => 'show_projects_score', + :remote => true, :id => @project.id}, :style=>"color: #EC6300;") %> + <% end %>
- + - + + diff --git a/app/views/projects/_project_score_index.html.erb b/app/views/projects/_project_score_index.html.erb index 6f98d549f..ab0dc18ca 100644 --- a/app/views/projects/_project_score_index.html.erb +++ b/app/views/projects/_project_score_index.html.erb @@ -1,3 +1,4 @@ + <% issue_count = @project.issues.count %> <% issue_journal_count = @project.issue_changes.count %> <% issue_score = issue_count * 0.2 %> @@ -32,3 +33,4 @@ <%= format("%.2f" , finall_file_score).to_f %> + <%= format("%.2f" , finall_code_submit_score).to_f %> + <%= format("%.2f" , topic_score).to_f %>
= <%= format("%.2f" , finall_project_score).to_f %>
+ \ No newline at end of file diff --git a/app/views/projects/_projects_topic_score_index.html.erb b/app/views/projects/_projects_topic_score_index.html.erb index 1c4e7b14d..1e059007a 100644 --- a/app/views/projects/_projects_topic_score_index.html.erb +++ b/app/views/projects/_projects_topic_score_index.html.erb @@ -1,3 +1,4 @@ + <% board_message_count = 0 %> <% @project.boards.each do |board| %> <% board_message_count += board.messages_count %> @@ -6,3 +7,4 @@ <% finall_topic_score = topic_score %>
<%= l(:label_topic_number) %> * 0.1 = <%= board_message_count %> * 0.1 = <%= topic_score %>
<%= l(:label_topic_score) %> = <%= format("%.2f" , finall_topic_score).to_f %>
+ \ No newline at end of file diff --git a/app/views/projects/code_submit_score_index.js.erb b/app/views/projects/code_submit_score_index.js.erb index ce1bc26fe..87393cb37 100644 --- a/app/views/projects/code_submit_score_index.js.erb +++ b/app/views/projects/code_submit_score_index.js.erb @@ -1,3 +1,5 @@ + $('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/code_submit_score_index') %>'); showModal('ajax-modal', '400px'); -$('#ajax-modal').addClass('new-watcher'); \ No newline at end of file +$('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/projects/file_score_index.js.erb b/app/views/projects/file_score_index.js.erb index 67ccf5231..a702b09cb 100644 --- a/app/views/projects/file_score_index.js.erb +++ b/app/views/projects/file_score_index.js.erb @@ -1,3 +1,5 @@ + $('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/file_score_index') %>'); showModal('ajax-modal', '400px'); -$('#ajax-modal').addClass('new-watcher'); \ No newline at end of file +$('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/projects/issue_score_index.js.erb b/app/views/projects/issue_score_index.js.erb index 9d715a72d..a1269fa8c 100644 --- a/app/views/projects/issue_score_index.js.erb +++ b/app/views/projects/issue_score_index.js.erb @@ -1,3 +1,5 @@ + $('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/issue_score_index') %>'); showModal('ajax-modal', '400px'); $('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/projects/news_score_index.js.erb b/app/views/projects/news_score_index.js.erb index 266704b83..0da583ea5 100644 --- a/app/views/projects/news_score_index.js.erb +++ b/app/views/projects/news_score_index.js.erb @@ -1,3 +1,5 @@ + $('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/news_score_index') %>'); showModal('ajax-modal', '400px'); $('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/projects/project_score_index.js.erb b/app/views/projects/project_score_index.js.erb index a99c8ae6c..f8c347c8b 100644 --- a/app/views/projects/project_score_index.js.erb +++ b/app/views/projects/project_score_index.js.erb @@ -1,3 +1,5 @@ + $('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/project_score_index') %>'); showModal('ajax-modal', '400px'); $('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/projects/projects_topic_score_index.js.erb b/app/views/projects/projects_topic_score_index.js.erb index d2e1552b1..ef5b975d5 100644 --- a/app/views/projects/projects_topic_score_index.js.erb +++ b/app/views/projects/projects_topic_score_index.js.erb @@ -1,3 +1,5 @@ + $('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/projects_topic_score_index') %>'); showModal('ajax-modal', '400px'); -$('#ajax-modal').addClass('new-watcher'); \ No newline at end of file +$('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/projects/show_projects_score.js.erb b/app/views/projects/show_projects_score.js.erb index 476cffae1..540db5395 100644 --- a/app/views/projects/show_projects_score.js.erb +++ b/app/views/projects/show_projects_score.js.erb @@ -1,3 +1,5 @@ + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/show_projects_score') %>'); showModal('ajax-modal', '400px'); -$('#ajax-modal').addClass('new-watcher'); \ No newline at end of file +$('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/users/_show_score.html.erb b/app/views/users/_show_score.html.erb index 45a5d8b99..d17b2bfa9 100644 --- a/app/views/users/_show_score.html.erb +++ b/app/views/users/_show_score.html.erb @@ -1,7 +1,9 @@ +<% unless @user.id == 1%> <% messages_count = @user.messages.count %> <% messages_score = messages_count * 0.05%> <% finall_messages_score = messages_score %> +<% end %> <% journals_count = @user.journals.count %> <% journals_score = journals_count * 0.1 %> diff --git a/app/views/users/_user_show.html.erb b/app/views/users/_user_show.html.erb index 6fd22e422..71157d070 100644 --- a/app/views/users/_user_show.html.erb +++ b/app/views/users/_user_show.html.erb @@ -1,6 +1,33 @@ +
<% for user in @users -%> <% unless user.id == 1%> + + <% messages_count = user.messages.count %> + <% messages_score = messages_count * 0.05%> + <% finall_messages_score = messages_score %> + + <% journals_count = user.journals.count %> + <% journals_score = journals_count * 0.1 %> + <% user_changesets_count = user.changesets.count %> + <% user_changesets_score = user_changesets_count * 0.3 %> + <% finall_user_project_score = journals_score + user_changesets_score %> + + <% journals_for_messages_count = user.journals_for_messages.count %> + <% activities_count = user.activities.count %> + <% journals_for_messages_score = journals_for_messages_count * 0.05 %> + <% activities_score = activities_count * 0.2 %> + <% finall_activity_score = journals_for_messages_score + activities_score %> + + <% news_count = user.news.count %> + <% news_score = news_count * 0.1 %> + <% wiki_contents_count = user.wiki_contents.count %> + <% wiki_contents_score = wiki_contents_count * 0.1 %> + <% comments_count = user.comments.count %> + <% comments_score = comments_count * 0.1 %> + <% finall_influence_score = news_score + wiki_contents_score + comments_score %> + <% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> +
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %> @@ -9,10 +36,17 @@
<%= image_tag(url_to_avatar(user), :class => 'avatar') %> <%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %> + +
- <%= l(:label_user_grade) %>: <%= user.user_status.grade %> + <%= l(:label_user_grade) %>: + <%= link_to( format("%.2f" , finall_user_score).to_f, {:controller => 'users', + :action => 'show_score', + :remote => true, + :id => user.id}, + :style=>"color: #EC6300;") %>
- +
diff --git a/app/views/users/activity_score_index.js.erb b/app/views/users/activity_score_index.js.erb index 916627ecb..555486266 100644 --- a/app/views/users/activity_score_index.js.erb +++ b/app/views/users/activity_score_index.js.erb @@ -1 +1,3 @@ -$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/activity_score_index', :locals => {:index =>0 }) %>'); \ No newline at end of file + +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/activity_score_index', :locals => {:index =>0 }) %>'); + \ No newline at end of file diff --git a/app/views/users/influence_score_index.js.erb b/app/views/users/influence_score_index.js.erb index cf0926b46..55d4565d9 100644 --- a/app/views/users/influence_score_index.js.erb +++ b/app/views/users/influence_score_index.js.erb @@ -1 +1,3 @@ -$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/influence_score_index', :locals => {:index =>0 }) %>'); \ No newline at end of file + +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/influence_score_index', :locals => {:index =>0 }) %>'); + \ No newline at end of file diff --git a/app/views/users/project_score_index.js.erb b/app/views/users/project_score_index.js.erb index 19ded64ee..a730441d4 100644 --- a/app/views/users/project_score_index.js.erb +++ b/app/views/users/project_score_index.js.erb @@ -1 +1,3 @@ -$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/project_score_index', :locals => {:index =>1 }) %>'); \ No newline at end of file + +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/project_score_index', :locals => {:index =>1 }) %>'); + \ No newline at end of file diff --git a/app/views/users/score_index.js.erb b/app/views/users/score_index.js.erb index 7911b988a..1123e7d67 100644 --- a/app/views/users/score_index.js.erb +++ b/app/views/users/score_index.js.erb @@ -1 +1,3 @@ -$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/score_index', :locals => {:index =>0 }) %>'); \ No newline at end of file + +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/score_index', :locals => {:index =>0 }) %>'); + \ No newline at end of file diff --git a/app/views/users/show_score.js.erb b/app/views/users/show_score.js.erb index 3cd9a5e47..b3bbf576e 100644 --- a/app/views/users/show_score.js.erb +++ b/app/views/users/show_score.js.erb @@ -1,3 +1,5 @@ + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_score') %>'); showModal('ajax-modal', '400px'); $('#ajax-modal').addClass('new-watcher'); + \ No newline at end of file diff --git a/app/views/users/topic_score_index.js.erb b/app/views/users/topic_score_index.js.erb index 28505b627..b4994eff3 100644 --- a/app/views/users/topic_score_index.js.erb +++ b/app/views/users/topic_score_index.js.erb @@ -1 +1,3 @@ -$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/topic_score_index', :locals => {:index =>0 }) %>'); \ No newline at end of file + +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/topic_score_index', :locals => {:index =>0 }) %>'); + \ No newline at end of file