diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index ae5b18291..494b8333f 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/helpers/journals_helper.rb b/app/helpers/journals_helper.rb
index 26b4c13b9..cfebb4d30 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={})
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index e954f03c8..81ef95c85 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
diff --git a/app/models/user_score.rb b/app/models/user_score.rb
index 0e355b797..07c669856 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/attachments/_links.html.erb b/app/views/attachments/_links.html.erb
index c135ee214..52b090bd8 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 %>
diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb
index 193171e69..895f83bba 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 10fa1e849..43687aa78 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 d22150a8d..3fd5f1050 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 %>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 0730e9125..ce53924ed 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 %>