Merge branch 'develop' into szzh
This commit is contained in:
commit
598429695f
|
@ -1,3 +1,12 @@
|
||||||
|
patch:
|
||||||
|
用户姓名的部分,根据issues#655。
|
||||||
|
为了修改方便
|
||||||
|
alias:
|
||||||
|
方法 之前显示 调整之后
|
||||||
|
name firstname+lastname login
|
||||||
|
nickname xxx login
|
||||||
|
realname xxx firstname+lastname
|
||||||
|
================================================================================
|
||||||
app/models/setting.rb :165
|
app/models/setting.rb :165
|
||||||
# fixed domain url in development. tantantan's bug
|
# fixed domain url in development. tantantan's bug
|
||||||
if Rails.env.development?
|
if Rails.env.development?
|
||||||
|
|
|
@ -50,20 +50,6 @@ class MyController < ApplicationController
|
||||||
def account
|
def account
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@pref = @user.pref
|
@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?
|
if request.post?
|
||||||
@user.safe_attributes = params[:user]
|
@user.safe_attributes = params[:user]
|
||||||
@user.pref.attributes = params[:pref]
|
@user.pref.attributes = params[:pref]
|
||||||
|
@ -74,71 +60,24 @@ class MyController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@se = @user.user_extensions ||= UserExtensions.new
|
||||||
|
@se.school_id = params[:occupation] if params[:occupation]
|
||||||
|
@se.gender = params[:gender]
|
||||||
|
@se.location = params[:province] if params[:province]
|
||||||
|
@se.location_city = params[:city] if params[:city]
|
||||||
|
@se.identity = params[:identity].to_i if params[:identity]
|
||||||
|
@se.technical_title = params[:technical_title] if params[:technical_title]
|
||||||
|
@se.student_id = params[:no] if params[:no]
|
||||||
|
|
||||||
# # UserExtensions.create(:user_id => @user.id, :occupation => params[:occupation])
|
if @user.save && @se.save
|
||||||
# else
|
|
||||||
# ue = @user.user_extensions
|
|
||||||
# ue.occupation = params[:occupation]
|
|
||||||
# ue.save
|
|
||||||
# end
|
|
||||||
|
|
||||||
# added by bai
|
|
||||||
if @user.user_extensions.nil?
|
|
||||||
se = UserExtensions.new
|
|
||||||
se.user_id = @user.id
|
|
||||||
if params[:occupation]
|
|
||||||
se.school_id = params[:occupation]
|
|
||||||
end
|
|
||||||
|
|
||||||
se.gender = params[:gender]
|
|
||||||
|
|
||||||
if params[:province] && params[:city]
|
|
||||||
se.location = params[:province]
|
|
||||||
se.location_city = params[:city]
|
|
||||||
end
|
|
||||||
if params[:identity]
|
|
||||||
se.identity = params[:identity].to_i
|
|
||||||
end
|
|
||||||
if params[:technical_title]
|
|
||||||
se.technical_title = params[:technical_title]
|
|
||||||
end
|
|
||||||
if params[:no]
|
|
||||||
se.student_id = params[:no]
|
|
||||||
end
|
|
||||||
se.save
|
|
||||||
else
|
|
||||||
se = @user.user_extensions
|
|
||||||
if params[:occupation]
|
|
||||||
se.school_id = params[:occupation]
|
|
||||||
end
|
|
||||||
|
|
||||||
se.gender = params[:gender]
|
|
||||||
|
|
||||||
if params[:province] && params[:city]
|
|
||||||
se.location = params[:province]
|
|
||||||
se.location_city = params[:city]
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:identity]
|
|
||||||
se.identity= params[:identity].to_i
|
|
||||||
end
|
|
||||||
if params[:technical_title]
|
|
||||||
se.technical_title = params[:technical_title]
|
|
||||||
end
|
|
||||||
if params[:no]
|
|
||||||
se.student_id = params[:no]
|
|
||||||
end
|
|
||||||
se.save
|
|
||||||
end
|
|
||||||
# end
|
|
||||||
|
|
||||||
if @user.save
|
|
||||||
@user.pref.save
|
@user.pref.save
|
||||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||||
set_language_if_valid @user.language
|
set_language_if_valid @user.language
|
||||||
flash[:notice] = l(:notice_account_updated)
|
flash[:notice] = l(:notice_account_updated)
|
||||||
redirect_to user_path(@user)
|
redirect_to user_path(@user)
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
@user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -126,17 +126,19 @@ module BidsHelper
|
||||||
@users.count
|
@users.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 查看学号
|
||||||
def im_watching_student_id? bid
|
def im_watching_student_id? bid
|
||||||
people = []
|
people = []
|
||||||
people << bid.author
|
people << bid.author
|
||||||
case bid.reward_type # 天煞的bid分了三用途,里面各种hasmany还不定能用!
|
case bid.reward_type # 天煞的bid分了三用途,里面各种hasmany还不定能用!
|
||||||
when 1
|
when Bid::Enterprise
|
||||||
when 2
|
when Bid::Contest
|
||||||
bid.join_in_contests.each do |jic|
|
bid.join_in_contests.each do |jic|
|
||||||
people << jic.user
|
people << jic.user
|
||||||
end
|
end
|
||||||
when 3
|
when Bid::Homework
|
||||||
people += bid.courses.first.users.to_a
|
# people += bid.courses.first.users.to_a
|
||||||
|
people += searchTeacherAndAssistant(bid.courses.first).to_a
|
||||||
else
|
else
|
||||||
raise 'bids_helper: unknow bid type' # 出了错看这里!不知道的抛异常,省的找不到出错的地方!
|
raise 'bids_helper: unknow bid type' # 出了错看这里!不知道的抛异常,省的找不到出错的地方!
|
||||||
end
|
end
|
||||||
|
|
|
@ -359,7 +359,7 @@ class User < Principal
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return user's full name for display
|
# Return user's full name for display
|
||||||
def name(formatter = nil)
|
def realname(formatter = nil)
|
||||||
f = self.class.name_formatter(formatter)
|
f = self.class.name_formatter(formatter)
|
||||||
if formatter
|
if formatter
|
||||||
eval('"' + f[:string] + '"')
|
eval('"' + f[:string] + '"')
|
||||||
|
@ -368,6 +368,10 @@ class User < Principal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def name(formatter = nil)
|
||||||
|
login
|
||||||
|
end
|
||||||
|
|
||||||
def active?
|
def active?
|
||||||
self.status == STATUS_ACTIVE
|
self.status == STATUS_ACTIVE
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
3 开发者
|
3 开发者
|
||||||
=end
|
=end
|
||||||
class UserExtensions < ActiveRecord::Base
|
class UserExtensions < ActiveRecord::Base
|
||||||
|
validate :school, presence: true
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id
|
belongs_to :school, :class_name => 'School', :foreign_key => :school_id
|
||||||
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id
|
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1" valign="top" style="width: 300px">
|
<td colspan="1" valign="top" style="width: 300px">
|
||||||
<strong>发布人: <%= link_to homework.user, user_path(homework.user)%></strong>
|
<strong>发布人: <%= link_to (display_id ? homework.user.realname : homework.user ), user_path(homework.user)%></strong>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<strong>作业评分:</strong>
|
<strong>作业评分:</strong>
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 style="padding-left: 10px;"><%= l(:label_my_account) %></h3>
|
<h3 style="padding-left: 10px;"><%= l(:label_my_account) %></h3>
|
||||||
|
<%= error_messages_for 'user' %>
|
||||||
|
<%= error_messages_for 'se' %>
|
||||||
|
|
||||||
<fieldset class="box" style="margin:10px;">
|
<fieldset class="box" style="margin:10px;">
|
||||||
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
|
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<% @course = Course.find_by_extra(membership.project.identifier) %>
|
<% @course = Course.find_by_extra(membership.project.identifier) %>
|
||||||
<% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %>
|
<% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %>
|
||||||
<span class="font-lighter" style="float: left"><%= l(:label_main_teacher) %>
|
<span class="font-lighter" style="float: left"><%= l(:label_main_teacher) %>
|
||||||
: <%= link_to(@course.teacher.name, user_path(@course.teacher)) %></span>
|
: <%= link_to(@course.teacher.realname, user_path(@course.teacher)) %></span>
|
||||||
<span style="float: right; padding-left: 8px"><%= l(:label_course_term) %>
|
<span style="float: right; padding-left: 8px"><%= l(:label_course_term) %>
|
||||||
: <%= @course.time %><%= @course.term %></span>
|
: <%= @course.time %><%= @course.term %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue