1、增加了“我的状态”

This commit is contained in:
baiyu 2013-09-14 17:22:44 +08:00
parent 313e66537e
commit 2768c935be
6 changed files with 51 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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 %>
<!-- end -->
</td>
</tr>
@ -56,6 +57,30 @@
<strong class="font_small_watch"><%=link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%></strong> &nbsp;
<strong class="font_small_watch"><%=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" %></strong>
<p><%= toggle_link l(:label_brief_introduction), 'introduction', {:focus => 'new_form_project_message'} %></p>
<% unless @user.user_extensions.nil? %>
<%= @user.user_extensions.brief_introduction %>
<% end %>
<div id="introduction" style="display: none">
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'add_brief_introdution'}) do |f|%>
<table border="0" width="100%" align="center" >
<tr>
<td><%= f.text_area 'user_introduction', :rows => 3, :cols => 65, :placeholder => "#{l(:label_my_brief_introduction)}", :style => "resize: none;", :class => 'noline'%></td>
</tr>
</table>
<table border="0" width="200px" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_submit), :name => nil , :class => "bid_btn" %></td>
</tr>
</table>
<% end %>
</div>
</div>
</div>
@ -72,8 +97,8 @@
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_user_mail) %></td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
</tr>
<!-- added by bai 在个人主页里显示“工作单位”“地区”-->
<!-- added by bai 在个人主页里显示“工作单位”“地区”-->

View File

@ -1430,6 +1430,8 @@ zh:
label_gender_male:
label_gender_female:
label_location: 地区
#end
label_brief_introduction: 修改我的状态
label_my_brief_introduction: 今天的心情如何?留下你的脚印吧~
#end

View File

@ -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

View File

@ -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%; }