1、增加“我的账号”里的了工作单位

2、增加了“注册”里的“身份”
This commit is contained in:
baiyu 2013-09-12 08:38:47 +08:00
parent 4dfffabb67
commit a2cc191a4e
11 changed files with 122 additions and 10 deletions

View File

@ -145,6 +145,13 @@ class AccountController < ApplicationController
else
register_manually_by_administrator(@user)
end
#added by bai
unless @user.id.nil?
UserExtensions.create(:identity => params[:identity].to_i, :user_id => @user.id)
end
#end
end
end
end

View File

@ -50,12 +50,46 @@ class MyController < ApplicationController
def account
@user = User.current
@pref = @user.pref
# if @user.user_extensions.nil?
# se = UserExtebsions.new
# se.user_id = @user.id
# se.occupation = params[:occupation]
# se.save
# else
# # = @user.user_extensions
# end
# @occupation = UserExtensions.occupation
# @occupation.save
if request.post?
@user.safe_attributes = params[:user]
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
# # UserExtensions.create(:user_id => @user.id, :occupation => params[:occupation])
# else
# ue = @user.user_extensions
# ue.occupation = params[:occupation]
# ue.save
# end
# added by bai
if @user.UserExtensions.nil?
se = UserExtensions.new
se.user_id = @user.id
se.occupation = params[:occupation]
se.save
else
se = @user.user_extensions
se.occupation = params[:occupation]
se.save
end
# end
if @user.save
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])

View File

@ -1,6 +1,6 @@
class UserExtensions < ActiveRecord::Base
belongs_to :user
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity
#this method was used to update the table user_extensions
def update_user_extensions(birthday=nil,brief_introduction=nil,
gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil)

View File

@ -20,14 +20,21 @@
<em class="info"><%="#{l(:label_mail_attention)} "%></em></p>
<p><%= f.select :language, lang_options_for_select %></p>
<!-- added by bai -->
<p><em class="info"><%= l(:label_identity) %><%= select_tag 'identity', "<option value = '0'>#{l(:label_teacher)}</option><option value = '1'>#{l(:label_student)}</option><option value = '2'>#{l(:label_other)}</option>".html_safe %></em></p>
<!-- end -->
<% if Setting.openid? %>
<p><%= f.text_field :identity_url %></p>
<% end %>
<% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
</div>
<%= submit_tag l(:button_submit) %>
<% end %>

View File

@ -37,6 +37,8 @@
<p style="width:426px;padding-left:26px;>
<%= f.select :language, :Chinese简体中文 => :zh, :English => :en%>
</p>
<p><%= l(:field_occupation)%><%= text_field_tag "occupation"%>
</p>
<% if Setting.openid? %>
<p>
<%= f.text_field :identity_url %>

View File

@ -44,7 +44,12 @@
<% for tracker in @trackers %>
<li><%= link_to h(tracker.name), project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>:
<%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i,
:total => @total_issues_by_tracker[tracker].to_i) %>
:total => @total_issues_by_tracker[tr
<li><%= l(:default_tracker_bug) %></li>
<% end %>
<% if tracker.[4]%>
<li><%= l(:default_tracker_mission) %></li>
<% end %>
</li>
<% end %>
</ul>

View File

@ -32,13 +32,15 @@
<td>
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), respond_path(e.act_id) %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.commit)%></a></div>
<% when 'Journal' %>
<!-- modified by bai -->
<tr>
<% if e.user == User.current%>
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to("项目:"+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<% else %>
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to("项目:"+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to( l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<% end %>
</tr>
<!-- end -->
<tr>
<td colspan="2" width="580" >
<p class="font_description">
@ -117,13 +119,15 @@
<td>
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.comments_count)%></a></div>
<% when 'Issue' %>
<!-- modified by bai -->
<tr>
<% if e.user == User.current%>
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to("项目:"+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
<td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= link_to(l(:label_activity_project)+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
<% else %>
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to("项目:"+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to(l(:label_activity_project)+act.project.name, project_path(act.project.identifier))%> <%= link_to format_activity_title("#{act.tracker.name} ##{act.id} (#{act.status}): #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
<% end %>
</tr>
<!-- end -->
<tr>
<td colspan="2" width="580" >
<p class="font_description">

View File

@ -483,6 +483,7 @@ en:
label_user_new: New user
label_user_anonymous: Anonymous
label_project: Project
label_activity_project: 'Project: ' #added by bai
label_project_new: New project
label_project_plural: Projects
label_x_projects:

View File

@ -222,7 +222,6 @@ zh:
field_firstname: 名字
field_lastname: 姓氏
field_mail: 邮件地址
field_job_category: 职业 # added by bai
field_filename: 文件
field_filesize: 大小
field_downloads: 下载次数
@ -442,6 +441,7 @@ zh:
label_user_new: 新建用户
label_user_anonymous: 匿名用户
label_project: 项目
label_activity_project: '项目: ' #added by bai
label_project_new: 新建项目
label_project_plural: 项目
label_x_projects:
@ -1354,7 +1354,7 @@ zh:
field_birthday: 生日
field_brief_introduction: 个人简介
field_location: 现住址
field_occupation: 学校/公司
field_occupation: 工作单位
field_work_experience: 工作经验(年)
field_zip_code: 邮编
label_reward: 奖励:
@ -1418,5 +1418,18 @@ zh:
button_projects_feedback_respond: 回复
label_projects_feedback_respond_content: 请输入回复内容
label_user_create_project: 创建了
<<<<<<< Updated upstream
#added by bai
=======
>>>>>>> Stashed changes
label_identity: 身份
label_teacher: 教师
label_student: 学生
label_other: 其他
<<<<<<< Updated upstream
#end
=======
>>>>>>> Stashed changes

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130828080407) do
ActiveRecord::Schema.define(:version => 20130911140205) do
create_table "a_user_watchers", :force => true do |t|
t.string "name"
@ -77,6 +77,7 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "reward"
end
create_table "bids", :force => true do |t|
@ -161,6 +162,18 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
create_table "courses", :force => true do |t|
t.integer "tea_id"
t.string "name"
t.integer "state"
t.string "code"
t.integer "time"
t.string "extra"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "location"
end
create_table "custom_fields", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 30, :default => "", :null => false
@ -246,6 +259,11 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
create_table "homework_for_courses", :force => true do |t|
t.integer "project_id"
t.integer "bid_id"
end
create_table "issue_categories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :limit => 30, :default => "", :null => false
@ -476,6 +494,9 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.integer "project_id"
end
add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count"
add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count"
create_table "project_tags", :force => true do |t|
t.integer "project_id"
t.integer "tag_id"
@ -578,6 +599,13 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.datetime "updated_at", :null => false
end
create_table "students_for_courses", :force => true do |t|
t.integer "student_id"
t.integer "course_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"
@ -595,6 +623,16 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.string "name"
end
create_table "teachers", :force => true do |t|
t.string "tea_name"
t.string "location"
t.integer "couurse_time"
t.integer "course_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "extra"
end
create_table "time_entries", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
@ -645,6 +683,7 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "identity"
end
create_table "user_preferences", :force => true do |t|

View File

@ -1742,7 +1742,7 @@ input[type='text'].noline {
font-family:微软雅黑; /*modify by men*/
border: #d5dee9 1px solid;
font-size: 12px;
color: #ACAEB1;
color: #818283; # modified by bai
padding: 9px 5px;
width: 98%;
cursor: text;