Merge branch 'dev_shcool' of https://git.trustie.net/jacknudt/trustieforge into dev_shcool
Conflicts: app/views/admin/applied_schools.html.erb app/views/admin/has_applied_schools.html.erb
This commit is contained in:
commit
39478eb4e4
|
@ -216,4 +216,61 @@ class SchoolController < ApplicationController
|
||||||
|
|
||||||
render :json =>status
|
render :json =>status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def edit_apply_name
|
||||||
|
name = params[:name] || ""
|
||||||
|
status = -1
|
||||||
|
|
||||||
|
if name != ""
|
||||||
|
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||||
|
|
||||||
|
applyschool.name = name.strip
|
||||||
|
|
||||||
|
if applyschool.school
|
||||||
|
applyschool.school.name = name
|
||||||
|
applyschool.school.pinyin = Pinyin.t(name.strip, splitter: '')
|
||||||
|
applyschool.school.save!
|
||||||
|
end
|
||||||
|
applyschool.save!
|
||||||
|
status = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
render :json=>{:status=>status,:id=>params[:id],:name=>name}
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_apply_address
|
||||||
|
address = params[:address] || ""
|
||||||
|
|
||||||
|
status = -1
|
||||||
|
|
||||||
|
if address != ""
|
||||||
|
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||||
|
applyschool.address = address
|
||||||
|
applyschool.save!
|
||||||
|
status = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
render :json=>{:status=>status,:id=>params[:id],:address=>address}
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_apply_province
|
||||||
|
province = params[:province] || ""
|
||||||
|
city = params[:city] || ""
|
||||||
|
status = -1
|
||||||
|
|
||||||
|
if(province != "") &&(city != "")
|
||||||
|
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||||
|
applyschool.province = province
|
||||||
|
applyschool.city = city
|
||||||
|
|
||||||
|
if applyschool.school
|
||||||
|
applyschool.school.province = province
|
||||||
|
applyschool.school.save!
|
||||||
|
end
|
||||||
|
applyschool.save!
|
||||||
|
status = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
render :json=>{:status=>status,:id=>params[:id],:province=>province,:city=>city}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,8 +53,9 @@
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
<%= apply.id %>
|
<%= apply.id %>
|
||||||
</td>
|
</td>
|
||||||
<td class="name center" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' >
|
||||||
<%= apply.name %>
|
<span title="双击可编辑" id="apply_title_<%= apply.id %>"><%= apply.name %></span>
|
||||||
|
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.name %></textarea>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<% user = User.where("id=?", apply.user_id).first %>
|
<% user = User.where("id=?", apply.user_id).first %>
|
||||||
|
@ -63,10 +64,51 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
|
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||||
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||||
|
</span>
|
||||||
|
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||||
|
<option value="北京">北京</option>
|
||||||
|
<option value="上海">上海</option>
|
||||||
|
<option value="广东">广东</option>
|
||||||
|
<option value="江苏">江苏</option>
|
||||||
|
<option value="浙江">浙江</option>
|
||||||
|
<option value="重庆">重庆</option>
|
||||||
|
<option value="安徽">安徽</option>
|
||||||
|
<option value="福建">福建</option>
|
||||||
|
<option value="甘肃">甘肃</option>
|
||||||
|
<option value="广西">广西</option>
|
||||||
|
<option value="贵州">贵州</option>
|
||||||
|
<option value="海南">海南</option>
|
||||||
|
<option value="河北">河北</option>
|
||||||
|
<option value="黑龙江">黑龙江</option>
|
||||||
|
<option value="河南">河南</option>
|
||||||
|
<option value="湖北">湖北</option>
|
||||||
|
<option value="湖南">湖南</option>
|
||||||
|
<option value="江西">江西</option>
|
||||||
|
<option value="吉林">吉林</option>
|
||||||
|
<option value="辽宁">辽宁</option>
|
||||||
|
<option value="内蒙古">内蒙古</option>
|
||||||
|
<option value="宁夏">宁夏</option>
|
||||||
|
<option value="青海">青海</option>
|
||||||
|
<option value="山东">山东</option>
|
||||||
|
<option value="山西">山西</option>
|
||||||
|
<option value="陕西">陕西</option>
|
||||||
|
<option value="四川">四川</option>
|
||||||
|
<option value="天津">天津</option>
|
||||||
|
<option value="新疆">新疆</option>
|
||||||
|
<option value="西藏">西藏</option>
|
||||||
|
<option value="云南">云南</option>
|
||||||
|
<option value="香港">香港特别行政区</option>
|
||||||
|
<option value="澳门">澳门特别行政区</option>
|
||||||
|
<option value="台湾">台湾</option>
|
||||||
|
<option value="海外">海外</option>
|
||||||
|
</select>
|
||||||
|
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<%= apply.address %>
|
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></span>
|
||||||
|
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位地址" id="school_address_edit_<%=apply.id%>" onblur="edit_school_address('<%= edit_apply_address_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.address %></textarea>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
|
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
|
||||||
|
@ -82,6 +124,9 @@
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<script>
|
||||||
|
init_province_and_city(document.getElementById('school_province_edit_<%=apply.id%>'), '<%=apply.province%>', document.getElementById('schoolCity_<%=apply.id%>'), '<%=apply.city%>');
|
||||||
|
</script>
|
||||||
<% unless apply.remarks.blank? %>
|
<% unless apply.remarks.blank? %>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -59,7 +59,8 @@
|
||||||
<td class="name center" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
<td class="name center" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||||
<% unless apply.school_id.nil? %>
|
<% unless apply.school_id.nil? %>
|
||||||
<% school_name = School.where("id=?", apply.school_id).first %>
|
<% school_name = School.where("id=?", apply.school_id).first %>
|
||||||
<%= school_name.name %>
|
<span title="双击可编辑" ondblclick = "show_edit_school_name('<%= apply.id %>');" id="apply_title_<%= apply.id %>"><%= school_name %></span>
|
||||||
|
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= school_name %></textarea>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
|
@ -69,13 +70,51 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<% unless apply.school_id.nil? %>
|
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||||
<% school_province = School.where("id=?", apply.school_id).first %>
|
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||||
<%= school_province.province %>
|
</span>
|
||||||
<% end %>
|
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||||
|
<option value="北京">北京</option>
|
||||||
|
<option value="上海">上海</option>
|
||||||
|
<option value="广东">广东</option>
|
||||||
|
<option value="江苏">江苏</option>
|
||||||
|
<option value="浙江">浙江</option>
|
||||||
|
<option value="重庆">重庆</option>
|
||||||
|
<option value="安徽">安徽</option>
|
||||||
|
<option value="福建">福建</option>
|
||||||
|
<option value="甘肃">甘肃</option>
|
||||||
|
<option value="广西">广西</option>
|
||||||
|
<option value="贵州">贵州</option>
|
||||||
|
<option value="海南">海南</option>
|
||||||
|
<option value="河北">河北</option>
|
||||||
|
<option value="黑龙江">黑龙江</option>
|
||||||
|
<option value="河南">河南</option>
|
||||||
|
<option value="湖北">湖北</option>
|
||||||
|
<option value="湖南">湖南</option>
|
||||||
|
<option value="江西">江西</option>
|
||||||
|
<option value="吉林">吉林</option>
|
||||||
|
<option value="辽宁">辽宁</option>
|
||||||
|
<option value="内蒙古">内蒙古</option>
|
||||||
|
<option value="宁夏">宁夏</option>
|
||||||
|
<option value="青海">青海</option>
|
||||||
|
<option value="山东">山东</option>
|
||||||
|
<option value="山西">山西</option>
|
||||||
|
<option value="陕西">陕西</option>
|
||||||
|
<option value="四川">四川</option>
|
||||||
|
<option value="天津">天津</option>
|
||||||
|
<option value="新疆">新疆</option>
|
||||||
|
<option value="西藏">西藏</option>
|
||||||
|
<option value="云南">云南</option>
|
||||||
|
<option value="香港">香港特别行政区</option>
|
||||||
|
<option value="澳门">澳门特别行政区</option>
|
||||||
|
<option value="台湾">台湾</option>
|
||||||
|
<option value="海外">海外</option>
|
||||||
|
</select>
|
||||||
|
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<%= apply.address %>
|
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></span>
|
||||||
|
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位地址" id="school_address_edit_<%=apply.id%>" onblur="edit_school_address('<%= edit_apply_address_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.address %></textarea>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<%= apply.name %>
|
<%= apply.name %>
|
||||||
|
@ -91,7 +130,9 @@
|
||||||
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %>
|
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<script>
|
||||||
|
init_province_and_city(document.getElementById('school_province_edit_<%=apply.id%>'), '<%=apply.province%>', document.getElementById('schoolCity_<%=apply.id%>'), '<%=apply.city%>');
|
||||||
|
</script> <% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -226,6 +226,9 @@ RedmineApp::Application.routes.draw do
|
||||||
member do
|
member do
|
||||||
get 'upload_logo'
|
get 'upload_logo'
|
||||||
post 'upload'
|
post 'upload'
|
||||||
|
get 'edit_apply_name'
|
||||||
|
get 'edit_apply_address'
|
||||||
|
get 'edit_apply_province'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1899,3 +1899,124 @@ function updateCourseName(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function edit_school_name(url,id){
|
||||||
|
if($("#school_name_edit_"+id).val() == ""){
|
||||||
|
$("#apply_title_"+id).show();
|
||||||
|
$("#school_name_edit_"+id).hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.get(
|
||||||
|
url,
|
||||||
|
{id: id ,name: $("#school_name_edit_"+id).val() },
|
||||||
|
function (data) {
|
||||||
|
if(data.status == 0){
|
||||||
|
$("#apply_title_"+data.id).show();
|
||||||
|
$("#school_name_edit_"+data.id).hide();
|
||||||
|
$("#apply_title_"+data.id).text(data.name);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#apply_title_"+data.id).show();
|
||||||
|
$("#school_name_edit_"+data.id).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_edit_school_name(id){
|
||||||
|
$("#apply_title_"+id).hide();
|
||||||
|
$("#school_name_edit_"+id).val($("#apply_title_"+id).text());
|
||||||
|
$("#school_name_edit_"+id).show();
|
||||||
|
$("#school_name_edit_"+id).focus();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function edit_school_address(url,id){
|
||||||
|
if($("#school_address_edit_"+id).val() == ""){
|
||||||
|
$("#apply_address_"+id).show();
|
||||||
|
$("#school_address_edit_"+id).hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.get(
|
||||||
|
url,
|
||||||
|
{id: id ,address: $("#school_address_edit_"+id).val() },
|
||||||
|
function (data) {
|
||||||
|
if(data.status == 0){
|
||||||
|
$("#apply_address_"+data.id).show();
|
||||||
|
$("#school_address_edit_"+data.id).hide();
|
||||||
|
$("#apply_address_"+data.id).text(data.address);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#apply_address_"+data.id).show();
|
||||||
|
$("#school_address_edit_"+data.id).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_edit_school_address(id){
|
||||||
|
$("#apply_address_"+id).hide();
|
||||||
|
$("#school_address_edit_"+id).val($("#apply_address_"+id).text());
|
||||||
|
$("#school_address_edit_"+id).show();
|
||||||
|
$("#school_address_edit_"+id).focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function edit_school_province(url,id){
|
||||||
|
|
||||||
|
var province = $("#school_province_edit_"+id).val();
|
||||||
|
var city = $("#schoolCity_"+id).val();
|
||||||
|
|
||||||
|
if((province == "")||(city == "")){
|
||||||
|
$("#apply_province_"+id).show();
|
||||||
|
$("#school_province_edit_"+id).hide();
|
||||||
|
$("#schoolCity_"+id).hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get(
|
||||||
|
url,
|
||||||
|
{id: id ,province: province,city:city },
|
||||||
|
function (data) {
|
||||||
|
if(data.status == 0){
|
||||||
|
$("#apply_province_"+data.id).show();
|
||||||
|
$("#school_province_edit_"+data.id).hide();
|
||||||
|
$("#schoolCity_"+data.id).hide();
|
||||||
|
init_province_and_city(document.getElementById('school_province_edit_'+data.id), data.province, document.getElementById('schoolCity_'+data.id), data.city);
|
||||||
|
$("#apply_province_"+data.id).text(data.province+data.city);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#apply_province_"+data.id).show();
|
||||||
|
$("#school_province_edit_"+data.id).hide();
|
||||||
|
$("#schoolCity_"+data.id).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function init_province_and_city(pField, province, cField, city) {
|
||||||
|
for (var i = 0; i < pField.options.length; i++) {
|
||||||
|
if (pField.options[i].value == province) {
|
||||||
|
pField.selectedIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showcity(province, cField);
|
||||||
|
for (var i = 0; i < cField.options.length; i++) {
|
||||||
|
if (cField.options[i].value == city) {
|
||||||
|
cField.selectedIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_edit_school_province(id){
|
||||||
|
$("#apply_province_"+id).hide();
|
||||||
|
$("#school_province_edit_"+id).show();
|
||||||
|
$("#schoolCity_"+id).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue