diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 9a31927ce..171b2f0c0 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 11df8958d..e1b5d049c 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 7a6179361..043baec3e 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 @@ <%= l(:label_user_mail) %><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %> - + diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 6ce21cbd5..e856264b6 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1430,6 +1430,8 @@ zh: label_gender_male: 男 label_gender_female: 女 label_location: 地区 -#end + label_brief_introduction: 修改我的状态 + label_my_brief_introduction: 今天的心情如何?留下你的脚印吧~ + #end diff --git a/config/routes.rb b/config/routes.rb index 240c1daca..5cbd1d051 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -464,5 +464,5 @@ RedmineApp::Application.routes.draw do match 'parise_tread/tread_plus',:to => 'parise_tread#tread_plus',:as=>"tread" match 'tags/delete',:to=>'tags#delete' - + match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution' end diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 91cf2ca39..9543c4cb0 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1173,7 +1173,7 @@ ul.properties li span {font-style:italic;} .total-hours { font-size: 110%; font-weight: bold; } .total-hours span.hours-int { font-size: 120%; } -select.gender { width: 20%; } +.gender { width: 20%; } .autoscroll {overflow-x: auto; padding:1px; margin-bottom: 1.2em;} #user_login, #user_firstname, #user_lastname, #user_mail, #my_account_form select, #user_form select, #user_identity_url { width: 60%; }