diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 494b8333f..e0845ae27 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -33,7 +33,7 @@ class UsersController < ApplicationController before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, @@ -792,6 +792,11 @@ class UsersController < ApplicationController def score_new_index end + + def update_score + @user = User.find(params[:id]) + end + private def find_user diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 895f83bba..f07169d57 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -16,7 +16,25 @@ <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> + + +
@@ -97,12 +115,9 @@ - <%= l(:label_user_grade)%>: - <%= link_to(format("%.2f" , @user.user_score_attr.total_score).to_f, {:controller => 'users', - :action => 'show_new_score', - :remote => true, - :id => @user.id - }, :style => 'color :#E8770D;') %> +
+ <%= render :partial => 'users/user_score', :locals => {:user => @user}%> +
diff --git a/app/views/users/_user_score.html.erb b/app/views/users/_user_score.html.erb new file mode 100644 index 000000000..836daa175 --- /dev/null +++ b/app/views/users/_user_score.html.erb @@ -0,0 +1,6 @@ +<%= l(:label_user_grade)%>: +<%= link_to(format("%.2f" , @user.user_score_attr.total_score).to_f, {:controller => 'users', + :action => 'show_new_score', + :remote => true, + :id => user.id +}, :style => 'color :#E8770D;',:id => 'user_score') %> \ No newline at end of file diff --git a/app/views/users/update_score.js.erb b/app/views/users/update_score.js.erb new file mode 100644 index 000000000..f3d3f4922 --- /dev/null +++ b/app/views/users/update_score.js.erb @@ -0,0 +1,2 @@ +$('#score_div').html('<%= escape_javascript(render(:partial => 'users/user_score', + :locals => {:user => @user} )) %>'); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index fb0bd55a0..9d577559a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -238,6 +238,7 @@ RedmineApp::Application.routes.draw do match 'activity_new_score_index', :to => 'users#activity_new_score_index', :via => :get match 'influence_new_score_index', :to => 'users#influence_new_score_index', :via => :get match 'score_new_index', :to => 'users#score_new_index', :via => :get + match 'update_score', :to => 'users#update_score', :via => [:get,:post] match 'show_projects_score', :to => 'projects#show_projects_score', :via => [:get, :post] match 'issue_score_index', :to => 'projects#issue_score_index', :via => [:get, :post]