From 2a522f144ef0febc153800982b887d5f24f41738 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 21 Aug 2015 16:29:25 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=B8=AA=E4=BA=BA=E7=AE=80?=
=?UTF-8?q?=E4=BB=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 12 ++++++++++-
.../layouts/_user_brief_introduction.html.erb | 10 +++++++++
app/views/layouts/new_base_user.html.erb | 21 ++++---------------
.../users/edit_brief_introduction.js.erb | 3 +++
config/routes.rb | 1 +
public/javascripts/user.js | 18 ++++++++++++++++
public/stylesheets/new_public.css | 1 +
7 files changed, 48 insertions(+), 18 deletions(-)
create mode 100644 app/views/layouts/_user_brief_introduction.html.erb
create mode 100644 app/views/users/edit_brief_introduction.js.erb
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 058cf971f..7d03c2ffa 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -48,7 +48,7 @@ class UsersController < ApplicationController
:watch_contests, :info, :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,:user_projects_index,
- :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages]
+ :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
@@ -1044,6 +1044,16 @@ class UsersController < ApplicationController
@user = User.find(params[:id])
end
+ #修改个人简介
+ def edit_brief_introduction
+ if @user && @user.extensions
+ @user.extensions.update_column("brief_introduction",params[:brief_introduction])
+ end
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
def find_user
diff --git a/app/views/layouts/_user_brief_introduction.html.erb b/app/views/layouts/_user_brief_introduction.html.erb
new file mode 100644
index 000000000..58a7bad83
--- /dev/null
+++ b/app/views/layouts/_user_brief_introduction.html.erb
@@ -0,0 +1,10 @@
+<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
+ <%= user.user_extensions.brief_introduction %>
+<% else%>
+ 这位童鞋很懒,什么也没有留下~
+<% end %>
+<% if User.current == user%>
+
+
+
+<% end%>
\ No newline at end of file
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index 5a2a7ac6b..293a6057b 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -58,24 +58,11 @@
- <%= @user.user_extensions.brief_introduction %>
-
-
-
-
- 这位童鞋很懒,什么也没有留下~
-
-
-
-
+ <%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %> +