diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 9a31927c..171b2f0c 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -123,6 +123,13 @@ class WordsController < ApplicationController # redirect_to signin_path end + def add_brief_introdution + user = User.current + message = params[:new_form][:user_introduction] + UserExtensions.introduction(user, message) + redirect_to user_path(user.id) + end + private def find_user diff --git a/app/models/user_extensions.rb b/app/models/user_extensions.rb index 11df8958..e1b5d049 100644 --- a/app/models/user_extensions.rb +++ b/app/models/user_extensions.rb @@ -17,4 +17,17 @@ class UserExtensions < ActiveRecord::Base def get_brief_introduction return self.brief_introduction end + + def self.introduction(user, message) + unless user.user_extensions.nil? + info = user.user_extensions + info.brief_introduction = message + info.save + else + info = UserExtensions.new + info.user_id = user.id + info.brief_introduction = message + info.save + end + end end diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 7a617936..043baec3 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -39,6 +39,7 @@ <% if @user.user_extensions.gender == 1 %> <%=image_tag("/images/sidebar/female.png", weight:"22px", height:"22px") %> <% else %> <%=image_tag("/images/sidebar/male.png", weight:"25px", height:"25px") %> <% end %> <% else %> <%=image_tag("/images/sidebar/male.png", weight:"25px", height:"25px") %> <% end %> + @@ -56,7 +57,31 @@ <%=link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%> <%=link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users(@user.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist" %> + +
<%= toggle_link l(:label_brief_introduction), 'introduction', {:focus => 'new_form_project_message'} %>
+ + <% unless @user.user_extensions.nil? %> + <%= @user.user_extensions.brief_introduction %> + <% end %> + + + @@ -72,8 +97,8 @@