From c0d97870d58d0f35b0c4e76489297255dc8a8d37 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 18 Jun 2014 17:35:05 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=3D=E3=80=8B=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20=E6=96=87=E6=A1=A3=E6=8F=90=E4=BA=A4=E8=80=85?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_links.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index c135ee21..52b090bd 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -24,7 +24,8 @@ <% end %> <% end %> <% if options[:author] %> - <%= h(attachment.author) %>, <%= format_time(attachment.created_on) %> + + <%= link_to h(attachment.author),user_path(attachment.author) %>, <%= format_time(attachment.created_on) %> <% end %>

<% end %> From 9061a7722121eb5764ae5847e102f74fda7f32b8 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 19 Jun 2014 10:45:30 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9user.user=5Fscore?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E9=97=AE=E9=A2=98=E7=9A=84=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 5 ----- app/models/user_score.rb | 12 ++++++++++++ app/views/layouts/base_users.html.erb | 2 +- app/views/users/_score_new_index.html.erb | 6 +++--- app/views/users/_show_new_score.html.erb | 12 ++++++------ 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ae5b1829..494b8333 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -801,11 +801,6 @@ class UsersController < ApplicationController else @user = User.find(params[:id]) end - if @user.user_score.nil? - us = UserScore.new - us.user_id = @user.id - us.save - end rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/models/user_score.rb b/app/models/user_score.rb index 0e355b79..07c66985 100644 --- a/app/models/user_score.rb +++ b/app/models/user_score.rb @@ -246,6 +246,18 @@ class UserScore < ActiveRecord::Base Rails.logger.error "[UserScore#project] ===> Exception: #{e}." end + #获取用户的user_score + def self.score(user) + if user.user_score.nil? + us = UserScore.new + us.user_id = user.id + us.save + us + else + user.user_score + end + end + #计算总得分 def total_score score = self.influence.to_i + self.skill.to_i + self.collaboration.to_i + self.active.to_i diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 193171e6..895f83bb 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -98,7 +98,7 @@ <%= l(:label_user_grade)%>: - <%= link_to(format("%.2f" , @user.user_score.total_score).to_f, {:controller => 'users', + <%= link_to(format("%.2f" , @user.user_score_attr.total_score).to_f, {:controller => 'users', :action => 'show_new_score', :remote => true, :id => @user.id diff --git a/app/views/users/_score_new_index.html.erb b/app/views/users/_score_new_index.html.erb index 10fa1e84..43687aa7 100644 --- a/app/views/users/_score_new_index.html.erb +++ b/app/views/users/_score_new_index.html.erb @@ -28,7 +28,7 @@
= <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> + <%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %>
-
= <%= format("%.2f" ,@user.user_score.collaboration.nil? ? 0:@user.user_score.collaboration).to_f %> + <%= format("%.2f" , @user.user_score.influence.nil? ? 0:@user.user_score.influence ).to_f %> - + <%= format("%.2f" , @user.user_score.skill.nil? ? 0:@user.user_score.skill).to_f %> + <%= format("%.2f" , @user.user_score.active.nil? ? 0:@user.user_score.active).to_f %>
-
= <%= format("%.2f" ,@user.user_score.total_score.nil? ? 0:@user.user_score.total_score).to_f %>
+
= <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_f %> + + <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
+
= <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_f %>
diff --git a/app/views/users/_show_new_score.html.erb b/app/views/users/_show_new_score.html.erb index d22150a8..3fd5f105 100644 --- a/app/views/users/_show_new_score.html.erb +++ b/app/views/users/_show_new_score.html.erb @@ -38,7 +38,7 @@ - +
<%= l(:label_user_score) %>
<%= format("%.2f" , @user.user_score.total_score).to_f %>
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
@@ -49,23 +49,23 @@ <%= l(:label_user_score) %> : - <%= format("%.2f" , @user.user_score.total_score).to_f %> + <%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
<%= l(:label_user_score_of_collaboration) %> : - <%= format("%.2f" , @user.user_score.collaboration.nil? ? 0:@user.user_score.collaboration).to_f %> + <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
<%= l(:label_user_score_of_influence) %> : - <%= format("%.2f" , @user.user_score.influence.nil? ? 0:@user.user_score.influence).to_f %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
<%= l(:label_user_score_of_skill) %> : - <%= format("%.2f" , @user.user_score.skill.nil? ? 0:@user.user_score.skill).to_f %> + <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
<%= l(:label_user_score_of_active) %> : - <%= format("%.2f" , @user.user_score.active.nil? ? 0:@user.user_score.active).to_f %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
From f2cb1390da32e5981f4926ed4657c4b0ada75855 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 19 Jun 2014 14:33:57 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B8=A6pre=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E7=BC=BA=E9=99=B7=E7=95=99=E8=A8=80=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/journals_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 26b4c13b..cfebb4d3 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -70,7 +70,7 @@ module JournalsHelper content << textilizable(journal, :notes) css_classes = "wiki" css_classes << " editable" if editable - content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes) + content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes ,:style => "width:580px") end def link_to_in_place_notes_editor(text, field_id, url, options={}) From 3e37a54a0f5bcb4806d2fe74fe1a26fa92a7de54 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 19 Jun 2014 14:44:58 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E5=A4=84=E4=B8=8D=E8=83=BD=E7=95=99=E8=A8=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index e954f03c..81ef95c8 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -75,7 +75,12 @@ class Mailer < ActionMailer::Base return -1 end mail :to => journals_for_message.jour.author.mail, :subject => @title - else + elsif journals_for_message.jour.class.to_s.to_sym == :Contest + if !journals_for_message.jour.author.notify_about? journals_for_message + return -1 + end + mail :to => journals_for_message.jour.author.mail, :subject => @title + else mail :to => @mail.mail, :subject => @title end From 9e4dbcc08e8ffcd9b94df03014436ff5c8d0ad79 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 19 Jun 2014 15:31:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=8A=A0=E5=9B=9E=E5=AD=A6=E6=A0=A1?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=AD=A6=E6=A0=A1=E7=9A=84=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/course.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 0730e912..ce53924e 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -193,7 +193,8 @@ <% if(course.school == nil) %>               <% else %> - <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %> + + <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'}%> <% end %>