Merge branch 'dev_shcool' into develop

This commit is contained in:
daiao 2016-07-29 22:07:02 +08:00
commit 8513ae133e
13 changed files with 339 additions and 462 deletions

View File

@ -160,7 +160,7 @@ class AdminController < ApplicationController
@sort = ""
if params[:sort] && (params[:order] == 'name')
# courses = School.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc")
school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' GROUP BY CONVERT(name USING gbk) #{params[:sort]}, aas.id desc ")
school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' ORDER BY CONVERT(aas.name USING gbk) #{params[:sort]}, aas.id asc ")
@order = params[:order]
@sort = params[:sort]
end

View File

@ -187,6 +187,12 @@ class SchoolController < ApplicationController
user_extention= User.current.extensions
user_extention.school_id = school.id
user_extention.save!
# status=4 向管理员发送信息
users = User.where(:admin => 1)
users.each do |user|
AppliedMessage.create(:user_id => user.id, :status => 4, :applied_user_id => User.current.id, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name )
end
else
data[:result] = 3
end
@ -210,4 +216,61 @@ class SchoolController < ApplicationController
render :json =>status
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

View File

@ -1,6 +1,7 @@
class AppliedMessage < ActiveRecord::Base
# status: 0表示未批准 status1表示已批准 status 2表示已拒绝
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name
belongs_to :applied ,:polymorphic => true
belongs_to :apply_add_schools
belongs_to :user

View File

@ -1,5 +1,4 @@
<%= stylesheet_link_tag 'css/common','css/popup' %>
<div class="boxContainer" style="height: auto;">
<div class="sendText fl mr10" style="width: auto">更改为</div>
<div class="cl"></div>

View File

@ -53,20 +53,62 @@
<td style="text-align: center;">
<%= apply.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
<%= apply.name %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=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 class="center">
<% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %>
<%= user.login %>
<%=link_to user.show_name, user_path(user) %>
<% end %>
</td>
<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) %>
</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 align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= apply.address %>
<td class="center">
<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 class="center">
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
@ -76,12 +118,15 @@
<%= format_date(apply.created_at) %>
</td>
<td class="center">
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }) %>
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure)) %>
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true %>
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => "application-default-link" ) %>
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
</td>
</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? %>
<tr class="odd">
<td>

View File

@ -29,7 +29,7 @@
<th style="width: 30px;">
申请者
</th>
<th style="width: 75px;">
<th style="width: 95px;">
地区
</th>
<th style="width: 75px;">
@ -38,6 +38,9 @@
<th style="width: 85px;">
原名
</th>
<th style="width: 30px;">
用户
</th>
<th style="width: 60px;">
创建时间
</th>
@ -53,30 +56,73 @@
<td style="text-align: center;">
<%= apply.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
<td class="name center" title='<%=apply.name%>' >
<% unless apply.school_id.nil? %>
<% 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 %>
</td>
<td class="center">
<% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %>
<%= user.login %>
<%=link_to user.show_name, user_path(user) %>
<% end %>
</td>
<td class="center">
<% unless apply.school_id.nil? %>
<% school_province = School.where("id=?", apply.school_id).first %>
<%= school_province.province %>
<% end %>
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
<%= (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 align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= apply.address %>
<td class="center">
<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 class="center">
<%= apply.name %>
</td>
<td class="center">
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
<%= count %>
</td>
<td class="center">
<%= format_date(apply.created_at) %>
</td>
@ -84,18 +130,11 @@
<%= 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>
</tr>
<% unless apply.remarks.blank? %>
<tr class="odd">
<td>
</td>
<td style="text-align: left;" colspan="6">
<%= apply.remarks %>
</td>
</tr>
<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>
</table>
</div>

View File

@ -62,3 +62,10 @@
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>
<script>
$("#sidebar ul").css({"marginLeft":"40px","marginTop":"1em","padding":"0"});
$("#sidebar a").css({"color":"#169","fontSize":"12px","lineHeight":"1.5"});
$("#sidebar a").mouseover(function(){$(this).css({"color":"#fff","backgroundColor":"#169"});});
$("#sidebar a").mouseout(function(){$(this).css({"color":"#169","backgroundColor":"#fff"});});
</script>

View File

@ -1,6 +1,7 @@
<% if ma.class == AppliedMessage %>
<!--申请加入项目-->
<% if ma.applied_type == "ApplyAddSchools" %>
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 4 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %></a>
@ -10,26 +11,35 @@
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'><%= ma.name %>的申请,已通过</a>
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.name %>的申请,已通过"><%= ma.name %>的申请,已通过</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% elsif ma.status == 2 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'><%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”</a>
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”"><%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% elsif ma.status == 3 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
<li class="homepageNewsContent fl">
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %>
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" }, :title => "#{ma.name}的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料" %>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% end %>
<% elsif ma.status == 4 %>
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"> </span>
<li class="homepageNewsContent fl">
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'>
<%= link_to User.where("id=?", ma.applied_user_id).first.show_name + "提交了申请:添加新的单位“#{ma.name}”", unapplied_schools_path(), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
<% end %>
</li>
</ul>
<% end %>
<% elsif ma && ma.applied_type == "AppliedProject" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">

View File

@ -388,7 +388,7 @@ zh:
label_organization_name: 组织名称
label_organization_list: 组织列表
label_school_plural: 学校列表
label_applied_shcools: 单位名称列表
label_applied_shcools: 单位审核
label_organization_new: 新建组织
label_edit_organization: 编辑组织
label_organization_edit: 修改组织

View File

@ -226,6 +226,9 @@ RedmineApp::Application.routes.draw do
member do
get 'upload_logo'
post 'upload'
get 'edit_apply_name'
get 'edit_apply_address'
get 'edit_apply_province'
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160729124833) do
ActiveRecord::Schema.define(:version => 20160725091759) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,46 +52,9 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
create_table "application_settings", :force => true do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "signin_enabled"
t.boolean "gravatar_enabled"
t.text "sign_in_text"
t.datetime "created_at"
t.datetime "updated_at"
t.string "home_page_url"
t.integer "default_branch_protection", :default => 2
t.boolean "twitter_sharing_enabled", :default => true
t.text "restricted_visibility_levels"
t.boolean "version_check_enabled", :default => true
t.integer "max_attachment_size", :default => 10, :null => false
t.integer "default_project_visibility"
t.integer "default_snippet_visibility"
t.text "restricted_signup_domains"
t.boolean "user_oauth_applications", :default => true
t.string "after_sign_out_path"
t.integer "session_expire_delay", :default => 10080, :null => false
end
create_table "applied_messages", :force => true do |t|
t.integer "user_id"
t.integer "applied_id"
t.string "applied_type"
t.integer "viewed", :default => 0
t.integer "status", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "applied_user_id"
t.integer "role"
t.integer "project_id"
end
create_table "applied_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.integer "role", :default => 0
t.integer "applied_user_id"
t.integer "project_id", :null => false
t.integer "user_id", :null => false
end
create_table "apply_add_schools", :force => true do |t|
@ -206,20 +169,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.string "typeName", :limit => 50
end
create_table "audit_events", :force => true do |t|
t.integer "author_id", :null => false
t.string "type", :null => false
t.integer "entity_id", :null => false
t.string "entity_type", :null => false
t.text "details"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id"
add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type"
add_index "audit_events", ["type"], :name => "index_audit_events_on_type"
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -317,17 +266,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
add_index "boards", ["project_id"], :name => "boards_project_id"
create_table "broadcast_messages", :force => true do |t|
t.text "message", :null => false
t.datetime "starts_at"
t.datetime "ends_at"
t.integer "alert_type"
t.datetime "created_at"
t.datetime "updated_at"
t.string "color"
t.string "font"
end
create_table "bug_to_osps", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
@ -357,16 +295,14 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
create_table "changesets", :force => true do |t|
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.string "committer"
t.datetime "committed_on", :null => false
t.datetime "committed_on", :null => false
t.text "comments"
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -646,11 +582,8 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.string "qrcode"
end
add_index "courses", ["id"], :name => "id", :unique => true
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id"
add_index "courses", ["tea_id"], :name => "tea_id"
add_index "courses", ["visits"], :name => "visits"
create_table "custom_fields", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
@ -713,15 +646,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
@ -771,16 +695,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "created_at"
end
create_table "emails", :force => true do |t|
t.integer "user_id", :null => false
t.string "email", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true
add_index "emails", ["user_id"], :name => "index_emails_on_user_id"
create_table "enabled_modules", :force => true do |t|
t.integer "project_id"
t.string "name", :null => false
@ -803,25 +717,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
create_table "events", :force => true do |t|
t.string "target_type"
t.integer "target_id"
t.string "title"
t.text "data"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "action"
t.integer "author_id"
end
add_index "events", ["action"], :name => "index_events_on_action"
add_index "events", ["author_id"], :name => "index_events_on_author_id"
add_index "events", ["created_at"], :name => "index_events_on_created_at"
add_index "events", ["project_id"], :name => "index_events_on_project_id"
add_index "events", ["target_id"], :name => "index_events_on_target_id"
add_index "events", ["target_type"], :name => "index_events_on_target_type"
create_table "exercise_answers", :force => true do |t|
t.integer "user_id"
t.integer "exercise_question_id"
@ -924,15 +819,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
create_table "forked_project_links", :force => true do |t|
t.integer "forked_to_project_id", :null => false
t.integer "forked_from_project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
@ -1062,17 +948,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "updated_at", :null => false
end
create_table "identities", :force => true do |t|
t.string "extern_uid"
t.string "provider"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id"
add_index "identities", ["user_id"], :name => "index_identities_on_user_id"
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1219,20 +1094,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.integer "private", :default => 0
end
create_table "keys", :force => true do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.text "key"
t.string "title"
t.string "type"
t.string "fingerprint"
t.boolean "public", :default => false, :null => false
end
add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id"
add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
create_table "kindeditor_assets", :force => true do |t|
t.string "asset"
t.integer "file_size"
@ -1244,27 +1105,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.integer "owner_type", :default => 0
end
create_table "label_links", :force => true do |t|
t.integer "label_id"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id"
add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type"
create_table "labels", :force => true do |t|
t.string "title"
t.string "color"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "labels", ["project_id"], :name => "index_labels_on_project_id"
create_table "member_roles", :force => true do |t|
t.integer "member_id", :null => false
t.integer "role_id", :null => false
@ -1315,47 +1155,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.integer "viewed_count", :default => 0
end
create_table "merge_request_diffs", :force => true do |t|
t.string "state"
t.text "st_commits", :limit => 2147483647
t.text "st_diffs", :limit => 2147483647
t.integer "merge_request_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true
create_table "merge_requests", :force => true do |t|
t.string "target_branch", :null => false
t.string "source_branch", :null => false
t.integer "source_project_id", :null => false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "milestone_id"
t.string "state"
t.string "merge_status"
t.integer "target_project_id", :null => false
t.integer "iid"
t.text "description"
t.integer "position", :default => 0
t.datetime "locked_at"
end
add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id"
add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id"
add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at"
add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id"
add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch"
add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id"
add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch"
add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true
add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title"
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"
@ -1390,39 +1189,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
add_index "messages", ["parent_id"], :name => "messages_parent_id"
create_table "milestones", :force => true do |t|
t.string "title", :null => false
t.integer "project_id", :null => false
t.text "description"
t.date "due_date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "state"
t.integer "iid"
end
add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id"
add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date"
add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true
add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
create_table "namespaces", :force => true do |t|
t.string "name", :null => false
t.string "path", :null => false
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type"
t.string "description", :default => "", :null => false
t.string "avatar"
end
add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id"
add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true
add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id"
add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true
add_index "namespaces", ["type"], :name => "index_namespaces_on_type"
create_table "news", :force => true do |t|
t.integer "project_id"
t.string "title", :limit => 60, :default => "", :null => false
@ -1448,31 +1214,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "updated_at", :null => false
end
create_table "notes", :force => true do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
t.string "attachment"
t.string "line_code"
t.string "commit_id"
t.integer "noteable_id"
t.boolean "system", :default => false, :null => false
t.text "st_diff", :limit => 2147483647
end
add_index "notes", ["author_id"], :name => "index_notes_on_author_id"
add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id"
add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type"
add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at"
create_table "notificationcomments", :force => true do |t|
t.string "notificationcommented_type"
t.integer "notificationcommented_id"
@ -1482,49 +1223,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "updated_at", :null => false
end
create_table "oauth_access_grants", :force => true do |t|
t.integer "resource_owner_id", :null => false
t.integer "application_id", :null => false
t.string "token", :null => false
t.integer "expires_in", :null => false
t.text "redirect_uri", :null => false
t.datetime "created_at", :null => false
t.datetime "revoked_at"
t.string "scopes"
end
add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
create_table "oauth_access_tokens", :force => true do |t|
t.integer "resource_owner_id"
t.integer "application_id"
t.string "token", :null => false
t.string "refresh_token"
t.integer "expires_in"
t.datetime "revoked_at"
t.datetime "created_at", :null => false
t.string "scopes"
end
add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
create_table "oauth_applications", :force => true do |t|
t.string "name", :null => false
t.string "uid", :null => false
t.string "secret", :null => false
t.text "redirect_uri", :null => false
t.string "scopes", :default => "", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "owner_id"
t.string "owner_type"
end
add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
create_table "onclick_times", :force => true do |t|
t.integer "user_id"
t.datetime "onclick_time"
@ -1682,23 +1380,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.integer "allow_teacher", :default => 0
end
create_table "permissions", :force => true do |t|
t.string "controller", :limit => 30, :default => "", :null => false
t.string "action", :limit => 30, :default => "", :null => false
t.string "description", :limit => 60, :default => "", :null => false
t.boolean "is_public", :default => false, :null => false
t.integer "sort", :default => 0, :null => false
t.boolean "mail_option", :default => false, :null => false
t.boolean "mail_enabled", :default => false, :null => false
end
create_table "permissions_roles", :id => false, :force => true do |t|
t.integer "permission_id", :default => 0, :null => false
t.integer "role_id", :default => 0, :null => false
end
add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
create_table "phone_app_versions", :force => true do |t|
t.string "version"
t.text "description"
@ -1781,11 +1462,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "updated_at", :null => false
end
create_table "project_import_data", :force => true do |t|
t.integer "project_id"
t.text "data"
end
create_table "project_infos", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1863,8 +1539,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.integer "boards_reply_count", :default => 0
t.integer "visits", :default => 0
t.integer "hot", :default => 0
t.string "invite_code"
t.string "qrcode"
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1878,16 +1552,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
create_table "protected_branches", :force => true do |t|
t.integer "project_id", :null => false
t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "developers_can_push", :default => false, :null => false
end
add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id"
create_table "quality_analyses", :force => true do |t|
t.integer "project_id"
t.string "author_login"
@ -2036,25 +1700,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.integer "is_teacher_score", :default => 0
end
create_table "services", :force => true do |t|
t.string "type"
t.string "title"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "active", :default => false, :null => false
t.text "properties"
t.boolean "template", :default => false
t.boolean "push_events", :default => true
t.boolean "issues_events", :default => true
t.boolean "merge_requests_events", :default => true
t.boolean "tag_push_events", :default => true
t.boolean "note_events", :default => true, :null => false
end
add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id"
add_index "services", ["project_id"], :name => "index_services_on_project_id"
create_table "settings", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "value"
@ -2093,26 +1738,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "updated_at", :null => false
end
create_table "snippets", :force => true do |t|
t.string "title"
t.text "content", :limit => 2147483647
t.integer "author_id", :null => false
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "file_name"
t.datetime "expires_at"
t.string "type"
t.integer "visibility_level", :default => 0, :null => false
end
add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id"
add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id"
add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level"
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -2193,9 +1818,9 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.integer "absence_penalty", :default => 0
t.float "system_score", :default => 0.0
t.boolean "is_test", :default => false
t.float "work_score"
t.integer "simi_id"
t.integer "simi_value"
t.float "work_score"
t.integer "work_status", :default => 0
end
@ -2244,13 +1869,13 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
create_table "sub_domains", :force => true do |t|
t.integer "org_subfield_id"
t.integer "priority"
t.integer "priority", :default => 0
t.string "name"
t.string "field_type"
t.integer "hide"
t.integer "status"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "hide", :default => 0
t.integer "status", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "subfield_subdomain_dirs", :force => true do |t|
@ -2260,17 +1885,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "updated_at", :null => false
end
create_table "subscriptions", :force => true do |t|
t.integer "user_id"
t.integer "subscribable_id"
t.string "subscribable_type"
t.boolean "subscribed"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true
create_table "syllabuses", :force => true do |t|
t.string "title"
t.text "description"
@ -2531,17 +2145,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
add_index "users", ["type"], :name => "index_users_on_type"
create_table "users_star_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id"
add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true
add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id"
create_table "versions", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :default => "", :null => false
@ -2593,23 +2196,6 @@ ActiveRecord::Schema.define(:version => 20160729124833) do
t.datetime "updated_at", :null => false
end
create_table "web_hooks", :force => true do |t|
t.string "url"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type", :default => "ProjectHook"
t.integer "service_id"
t.boolean "push_events", :default => true, :null => false
t.boolean "issues_events", :default => false, :null => false
t.boolean "merge_requests_events", :default => false, :null => false
t.boolean "tag_push_events", :default => false
t.boolean "note_events", :default => false, :null => false
end
add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id"
add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id"
create_table "wechat_logs", :force => true do |t|
t.string "openid", :null => false
t.text "request_raw"

View File

@ -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();
}

View File

@ -1281,6 +1281,9 @@ a, a:link, a:visited{ color: #169; text-decoration: none; }
a:hover, a:active{ color: #c61a1a; text-decoration: underline;}
a img{ border: 0; }
a.application-default-link {color: #169 !important; text-decoration: none;}
a.application-default-link:hover {color: #c61a1a !important; text-decoration: underline;}
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; }
a.project.closed, a.project.closed:link, a.project.closed:visited { color: #999; }
a.user.locked, a.user.locked:link, a.user.locked:visited {color: #999;}