修改《修改资料》页面

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-11-10 08:58:38 +08:00
parent fd8a8d1fe2
commit 1468f4a8df
5 changed files with 115 additions and 44 deletions

View File

@ -91,7 +91,11 @@ class MyController < ApplicationController
end
@se = @user.extensions
@se.school_id = params[:occupation] if params[:occupation]
if params[:occupation].to_i.to_s == params[:occupation]
@se.school_id = params[:occupation]
else
@se.occupation = params[:occupation]
end
@se.gender = params[:gender]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]

View File

@ -227,6 +227,7 @@ module IssuesHelper
strings = []
values_by_field = {}
details.each do |detail|
unless detail.property == 'attachment'
if detail.property == 'cf'
field_id = detail.prop_key
field = CustomField.find_by_id(field_id)
@ -242,6 +243,7 @@ module IssuesHelper
end
end
strings << show_detail(detail, no_html, options)
end
end
values_by_field.each do |field_id, changes|
detail = JournalDetail.new(:property => 'cf', :prop_key => field_id)

View File

@ -223,7 +223,7 @@
</td>
</tr>
<% unless @user.user_extensions.nil? %>
<% unless @user.user_extensions.identity == 2 %>
<% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %>
<tr>
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<% unless @user.user_extensions.school.nil? %>
@ -231,38 +231,59 @@
<% end %>
</td>
</tr>
<% end %>
<% elsif @user.user_extensions.identity == 3 %>
<tr>
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %></td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.occupation %>
</td>
</tr>
<% end %>
<tr>
<td style="padding-left: 5px" width="76px"><%= l(:label_location) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %><%= @user.user_extensions.location_city %></td>
<td style="padding-left: 31px" width="76px"><%= l(:label_location) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %><%= @user.user_extensions.location_city %></td>
</tr>
<tr>
<% if @user.user_extensions.identity == 0 %>
<td style="padding-left: 5px" width="76px">
<%= l(:label_technical_title) %>:
<td style="padding-left: 31px" width="76px" >
<%= l(:label_technical_title) %>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<span id = "td_tech_title"></span>
</td>
<% end %>
</tr>
<% if( (@user.user_extensions.identity == 1) && (is_watching?(@user) ) )%>
<% if @user.user_extensions.identity == 1 %>
<% if(is_watching?(@user) ) %>
<tr>
<td style="padding-left: 8px" width="70px">
<%= l(:label_bidding_user_studentcode)%>:
<td style="padding-left: 31px" width="70px" >
<%= l(:label_bidding_user_studentcode)%>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.student_id %>
</td>
</tr>
<% end %>
<% else%>
<% else %>
<tr>
<td style="padding-left: 31px" width="70px" >
<%= l(:label_identity)%>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= l(:label_account_student) %>
</td>
</tr>
<% end %>
<% elsif @user.user_extensions.identity == 3 %>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td>
<td style="padding-left: 31px" width="70px" >
<%= l(:label_identity)%>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= l(:label_account_developer) %>
</td>
</tr>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td>
</tr>
<% end %>
<% end %>
<% end %>
<!-- end -->
</table>
</div>

View File

@ -3,6 +3,7 @@
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<script type="text/javascript">
$(document).ready(
function () {
@ -43,6 +44,7 @@
<%= labelled_form_for :user, @user,
:url => {:action => "account"},
:html => {:id => 'my_account_form',
:method => :post} do |f| %>
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);">
@ -60,7 +62,7 @@
</legend>
<!-- 昵称 -->
<p style="width:630px;padding-left: 26px;">
<p style="width:630px;padding-left: 54px;">
<%= f.text_field :login, :required => true, :size => 25, :name => "login"%>
<span class='font_lighter'><%= l(:label_max_number) %></span>
<br/>
@ -68,13 +70,13 @@
<div>
<span id='name' style='display:none'>
<p style="width:530px;padding-left: 26px;">
<p style="width:530px;padding-left: 54px;">
<%= f.text_field :lastname, :size => 25, :required => true %>
<span class='font_lighter'>
<%= l(:field_lastname_eg) %>
</span>
</p>
<p style="width:530px;padding-left: 26px;">
<p style="width:530px;padding-left: 54px;">
<%= f.text_field :firstname, :size => 25, :required => true %>
<span class='font_lighter'>
<%= l(:field_firstname_eg) %>
@ -83,7 +85,7 @@
</span>
<span id='enterprise' style='display:none'>
<p style="width:400px;padding-left: 26px;">
<p style="width:400px;padding-left: 54px;">
<%= l(:label_company_name)%>
<%= text_field_tag :enterprise_name, @user.firstname %>
</p>
@ -92,18 +94,18 @@
<!-- added by bai 增加账户里的性别-->
<span id='gender' style='display:none'>
<% if @user.user_extensions.nil? %>
<p style="width:400px;padding-left: 26px;">
<p style="width:400px;padding-left: 54px;">
<%= l(:label_gender) %>&nbsp;&nbsp;
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
</p>
<% else %>
<% if @user.user_extensions.gender == 0 %><!-- label_gender_male -->
<p style="width:400px;padding-left: 26px;">
<p style="width:400px;padding-left: 54px;">
<%= l(:label_gender) %>&nbsp;&nbsp;
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
</p>
<% else %>
<p style="width:400px;padding-left: 26px;">
<p style="width:400px;padding-left: 54px;">
<%= l(:label_gender) %>&nbsp;&nbsp;
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1' selected='selected'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
</p>
@ -112,17 +114,24 @@
</span>
<!-- added by Wen -->
<p style="padding-left: 26px;">
<% if User.current.user_extensions.school.nil? %>
<%= l(:field_occupation) %>&nbsp;
<span class="required">*</span>
<input id="province" name="province" type="text" value="请单击选择省份及学校" readonly>
<input id="occupation" name="occupation" type="hidden"/>
<input id="occupation_name" type="text" readonly/>
<% unless @user.user_extensions.identity == 2 %>
<%= l(:field_occupation) %>
<span class="required">*</span>
<% if User.current.user_extensions.identity == 3 %>
<input id="province" name="province" style="display: none" type="text" value="请单击选择省份及学校" readonly>
<input id="occupation" name="occupation" style="display: none" type="text" value="<%= @user.user_extensions.occupation %>" />
<input id="occupation_name" type="text" style="display: none" readonly/>
<% elsif User.current.user_extensions.school.nil? %>
<input id="province" name="province" style="display: none" type="text" value="请单击选择省份及学校" readonly>
<input id="occupation" name="occupation" style="display: none" type="text" />
<input id="occupation_name" type="text" style="display: none" readonly/>
<% else %>
<%= l(:field_occupation) %>&nbsp;<span class="required">*</span>
<input id="province" name="province" type="text" value="<%= User.current.user_extensions.school.province %>" readonly/>
<input id="occupation" name="occupation" type="hidden" value="<%= User.current.user_extensions.school.id %>"/>
<input id="occupation_name" type="text" value="<%= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>
<input id="province" name="province" style="display: none" type="text" value="<%= User.current.user_extensions.school.province %>" readonly/>
<input id="occupation" name="occupation" type="text" style="display: none" value="<%= User.current.user_extensions.school.id %>"/>
<input id="occupation_name" type="text" style="display: none" value="<%= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>
<% end %>
<% end %>
</p>
@ -168,17 +177,19 @@
<%= f.text_field :mail, :required => true %>
</p>
<p style="width:426px;padding-left:26px;">
<p style="width:426px;padding-left:54px;">
<%= f.select :language, :Chinese => :zh, :English => :en %>
</p>
<% province = User.current.user_extensions.location %>
<% city = User.current.user_extensions.location_city %>
<% identity = User.current.user_extensions.identity %>
<% title = User.current.user_extensions.technical_title %>
<% language = User.current.language %>
<% province = User.current.user_extensions.location %>
<% city = User.current.user_extensions.location_city %>
<% identity = User.current.user_extensions.identity %>
<% occupation1 = User.current.user_extensions.occupation %>
<% occupation = User.current.user_extensions.occupation %>
<% title = User.current.user_extensions.technical_title %>
<% language = User.current.language %>
<script type="text/javascript" language="javascript">
$().ready(function () {
var province = "<%= "#{province}" %>"
@ -187,12 +198,14 @@
var identity = "<%= "#{identity}" %>"
var title = "<%= "#{title}" %>"
var language = "<%= "#{language}" %>"
var occupation1 = "<%= "#{occupation}" %>"
init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language);
});
</script>
<p style="width:400px;padding-left: 26px;"><%= l(:label_location) %>
<p style="width:400px;padding-left: 58px;"><%= l(:label_location) %>
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="location">
<option value="">--请选择省份--</option>
<option value="北京">北京</option>
@ -237,7 +250,7 @@
<% unless @user.user_extensions.identity == 2 %>
<p style="width:400px;padding-left: 26px;">
<p style="width:400px;padding-left: 54px;">
<%= l(:label_identity) %>
<select onchange="showtechnical_title(this.value, $('#userTechnical_title'));" name="identity" id="userIdentity" class="location">
<option value="">
@ -528,6 +541,7 @@
}
}
}
function init_identity_and_title(pField, identity, cField, title, language) {
for (var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value == identity) {
@ -590,6 +604,9 @@
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
$('input#province').show()
$('input#occupation_name').show()
$('input#occupation').hide()
var technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break;
@ -600,7 +617,12 @@
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var titleOptions = new Array("");
$('input#province').show()
$('input#occupation_name').show()
$('input#occupation').hide()
var technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break;
case '2' :
@ -609,7 +631,26 @@
$('#name').hide()
$('#enterprise').show()
$('#gender').hide()
var titleOptions = new Array("");
$('input#province').show()
$('input#occupation_name').show()
$('input#occupation').hide()
var technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break;
case '3':
$('#technical_title').hide()
$('#no').hide()
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
$('input#province').hide()
$('input#occupation_name').hide()
$('input#occupation').show()
// document.getElementById("occupation").value = "";
var technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break;
default:
$('#technical_title').hide()
@ -617,7 +658,9 @@
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var titleOptions = new Array("");
var technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break;

View File

@ -617,6 +617,7 @@ zh:
label_requirement_focus: 关注需求
label_developer: 用户
label_account_developer: 开发者
label_account_student: 学生
label_enterprise_into: 进入企业
label_college_into: 进入高校
label_investor: 投资人: