diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 8bf40d472..62b076754 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -243,7 +243,8 @@ class AccountController < ApplicationController
user = User.find(params[:user]) if params[:user]
token = Token.new(:user => user, :action => "register")
if token.save
- Mailer.run.register(token)
+ # Mailer.run.register(token)
+ Mailer.register(token).deliver
else
yield if block_given?
status = 0
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index 0883b3799..32c605516 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -127,12 +127,14 @@ class MyController < ApplicationController
end
@user.safe_attributes = params[:user]
+ @user.lastname = params[:lastname]
+ @user.firstname = ""
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
#@user.login = params[:login]
unless @user.user_extensions.nil?
if @user.user_extensions.identity == 2
- @user.firstname = params[:enterprise_name]
+ # @user.firstname = params[:enterprise_name]
end
end
@@ -144,7 +146,7 @@ class MyController < ApplicationController
# end
@se.school_id = params[:occupation]
- @se.gender = params[:gender]
+ @se.gender = params[:sex]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@se.identity = params[:identity].to_i if params[:identity]
diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb
index e0aff6254..44f4378fe 100644
--- a/app/controllers/school_controller.rb
+++ b/app/controllers/school_controller.rb
@@ -150,4 +150,55 @@ class SchoolController < ApplicationController
format.js
end
end
+
+ #申请高校(单位) name:名称 province:省 city:市 address:地址 remarks:备注
+ def apply_add_school
+
+ data = {result:0,name:params[:name],school_id:0}
+ #0 成功 1参数错误 2名称已存在
+ data[:result] = 0
+
+ #检验参数
+ if params[:name] == "" || params[:province] == "" || params[:city] == "" || params[:address] == ""
+ data[:result] = 1
+ else
+ school_id = School.find_by_sql("select id from schools where name='#{params[:name]}'").first
+ if school_id
+ data[:result] = 2
+ else
+ school = School.new
+ school.name = params[:name].strip
+ school.pinyin = Pinyin.t(params[:name].strip, splitter: '')
+ school.save
+
+ #status 0未处理 1通过 2拒绝
+ applyschool = ApplyAddSchools.new
+ applyschool.school_id = school.id
+ applyschool.name = school.name
+ applyschool.province = params[:province]
+ applyschool.city = params[:city]
+ applyschool.address = params[:address]
+ applyschool.remarks = params[:remarks]
+ applyschool.save
+
+ data[:school_id] = school.id
+ end
+ end
+ render :json =>data
+ end
+
+ def search_repeat_schoolname
+ status = 0
+ name = params[:name]
+
+ if name
+ school_id = School.find_by_sql("select id from schools where name='#{name}'").first
+
+ if school_id
+ status = 1
+ end
+ end
+
+ render :json =>status
+ end
end
diff --git a/app/models/apply_add_schools.rb b/app/models/apply_add_schools.rb
new file mode 100644
index 000000000..2082c0012
--- /dev/null
+++ b/app/models/apply_add_schools.rb
@@ -0,0 +1,3 @@
+class ApplyAddSchools < ActiveRecord::Base
+ attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
+end
diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb
index ffec82bce..e2e935f57 100644
--- a/app/views/layouts/_new_feedback.html.erb
+++ b/app/views/layouts/_new_feedback.html.erb
@@ -16,7 +16,7 @@
<%= f.text_area :subject, :id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
-
+
<%= l(:label_submit)%>
<% end %>
@@ -25,7 +25,9 @@
<%#= l(:label_technical_support) %>
-
请加入师姐师兄答疑群
QQ群号:173184401
+
+
+
diff --git a/app/views/mailer/register.html.erb b/app/views/mailer/register.html.erb
index 282deca90..5b4e8262b 100644
--- a/app/views/mailer/register.html.erb
+++ b/app/views/mailer/register.html.erb
@@ -1,2 +1,6 @@
<%= l(:mail_body_register) %>
<%= link_to h(@url), @url %>
+如果点击链接无效请复制该链接到浏览器中打开
+
+感谢您的使用!
+Trustie团队
diff --git a/app/views/my/_apply_add_school.html.erb b/app/views/my/_apply_add_school.html.erb
new file mode 100644
index 000000000..1449fa1f1
--- /dev/null
+++ b/app/views/my/_apply_add_school.html.erb
@@ -0,0 +1,337 @@
+添加新的高校(单位)
+
+
+
+
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index f28ad1ca2..589541c39 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -20,8 +20,8 @@
* 职业 :
* 姓名 :
组织名 : *
- 性别 :
- 单位名称 :
+ * 性别 :
+ * 单位名称 :
地区 :
邮件通知 :
@@ -64,19 +64,51 @@
- <%= f.text_field :lastname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
+ <%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
- <%= text_field_tag :enterprise_name,@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
-
-
+ <% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
+
+ <% else %>
+
+ <% end %>
+
-
-
- 您输入的名称尚不存在,申请添加
+
+ <% if User.current.user_extensions.nil? %>
+
+
+
+
+ 平台找到了0个包含"国防"的高校
+
+
+ <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
+
+
+
+
+ 平台找到了0个包含"国防"的高校
+
+
+ <% elsif User.current.user_extensions.school.nil? %>
+
+
+
+
+ 平台找到了0个包含"国防"的高校
+
+
+ <% else %>
+
+
+
+
+ 平台找到了0个包含"国防"的高校
+
+
+ <% end %>
@@ -412,6 +444,7 @@
$("*[nh_required='1']",$(this)).attr("required",true);
$(this).show()
});
+ $("#identity_hint").hide();
}
function init_identity_and_title(pField, identity, cField, title, language) {
for (var i = 0; i < pField.options.length; i++) {
@@ -516,6 +549,14 @@
$("input[name='occupation']").val(data);
$("#search_school_result_list").hide();
$("#hint").hide();
+ $("#errortip").hide();
+
+ }
+
+ function apply_add_school(){
+ var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>";
+ pop_up_box(htmlvalue,580,20,48);
+
}
function add_school(name){
$.ajax({
@@ -602,16 +643,19 @@
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
- $("#hint").html('找到了' + count + '个包含"' + str + '"的高校');
+ $("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
+ $("#errortip").hide();
}else{
$("#hint").hide();
+ $("#errortip").hide();
}
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
- $("#hint").html('没有找到包含"'+str+'"的高校,创建高校');
+ $("#hint").html('您输入的名称尚不存在,申请添加');
$("#hint").show();
+ $("#errortip").show();
}
}
});
@@ -621,6 +665,7 @@
{
$("#search_school_result_list").hide();
$("#hint").hide();
+ $("#errortip").hide();
}
});
$("input[name='province']").on('focus', function (e) {
@@ -648,16 +693,19 @@
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
- $("#hint").html('找到了' + count + '个包含"' + str + '"的高校');
+ $("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
$("#hint").show();
+ $("#errortip").hide();
}else{
$("#hint").hide();
+ $("#errortip").hide();
}
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
- $("#hint").html('没有找到包含"'+str+'"的高校,创建高校');
+ $("#hint").html('您输入的名称尚不存在,申请添加');
$("#hint").show();
+ $("#errortip").show();
}
}
});
@@ -685,19 +733,41 @@
<% if( !@act.nil? && @act == 'password') %>
$("#users_tb_2").click();
<% end %>
- $('#my_account_form_link').click(function(e){
+
+ $('#my_account_form_link').on("click",(function(e){
+ //$('#my_account_form_link').click(function(e){
if($("#userIdentity").val() == -1 ) {
$("#identity_hint").html('请选择身份').show();
e.stopImmediatePropagation();
return;
}
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
- $("#hint").html('学校必须是从下拉列表中选择的,不能手动修改').show();
+ $("#hint").html('单位名称必须是从下拉列表中选择的,不能手动修改').show();
+ e.stopImmediatePropagation();
+ return;
+ }
+
+ //姓名不能为空
+ if( $("#lastname").val() == '' ){
+ $("#lastname").focus();
+ e.stopImmediatePropagation();
+ return;
+ }
+
+ if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写
+ $("#hint").html('高校(单位)名称不能为空').show();
e.stopImmediatePropagation();
return;
}
+
+ if($("#no").is(":visible") == true && $("#no").val() == ""){
+ $("#no").focus();
+ e.stopImmediatePropagation();
+ return;
+ }
+
$('#my_account_form_btn').click();
- });
+ }));
$('#my_password_form_link').click(function(){
$('#my_password_form_btn').click();
});
diff --git a/config/routes.rb b/config/routes.rb
index 14ee3f0b8..d56f75ced 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -213,7 +213,8 @@ RedmineApp::Application.routes.draw do
resources :school, :except => [:show] do
collection do
-
+ get 'apply_add_school'
+ get 'search_repeat_schoolname'
end
member do
diff --git a/db/migrate/20160629030320_add_school_type_to_schools.rb b/db/migrate/20160629030320_add_school_type_to_schools.rb
new file mode 100644
index 000000000..ad23ae555
--- /dev/null
+++ b/db/migrate/20160629030320_add_school_type_to_schools.rb
@@ -0,0 +1,5 @@
+class AddSchoolTypeToSchools < ActiveRecord::Migration
+ def change
+ add_column :schools, :school_type, :integer, :default => false
+ end
+end
diff --git a/db/migrate/20160629081520_create_apply_add_schools.rb b/db/migrate/20160629081520_create_apply_add_schools.rb
new file mode 100644
index 000000000..3d47f55a1
--- /dev/null
+++ b/db/migrate/20160629081520_create_apply_add_schools.rb
@@ -0,0 +1,15 @@
+class CreateApplyAddSchools < ActiveRecord::Migration
+ def change
+ create_table :apply_add_schools do |t|
+ t.string :name
+ t.string :province
+ t.string :city
+ t.string :address
+ t.string :remarks
+ t.integer :school_id
+ t.integer :status, :default => false
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 148a6e21b..615a9001e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20160624032138) do
+ActiveRecord::Schema.define(:version => 20160629081520) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -57,6 +57,18 @@ ActiveRecord::Schema.define(:version => 20160624032138) do
t.integer "user_id", :null => false
end
+ create_table "apply_add_schools", :force => true do |t|
+ t.string "name"
+ t.string "province"
+ t.string "city"
+ t.string "address"
+ t.string "remarks"
+ t.integer "school_id"
+ t.integer "status", :default => 0
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "apply_homeworks", :force => true do |t|
t.integer "status"
t.integer "user_id"
@@ -1125,23 +1137,6 @@ ActiveRecord::Schema.define(:version => 20160624032138) do
t.integer "viewed_count", :default => 0
end
- create_table "mess", :id => false, :force => true do |t|
- t.string "课程名"
- t.integer "课程ID", :default => 0, :null => false
- t.string "教师姓", :default => "", :null => false
- t.string "教师名", :limit => 30, :default => "", :null => false
- t.string "主贴名", :default => "", :null => false
- t.integer "主贴或回帖ID", :default => 0, :null => false
- t.integer "回帖对应主贴ID"
- t.integer "帖子点赞数"
- t.integer "主贴回复数", :default => 0, :null => false
- t.text "主贴或回帖内容"
- t.datetime "发帖时间", :null => false
- t.integer "发帖或回帖用户ID", :default => 0, :null => false
- t.string "发帖或回帖用户姓", :default => "", :null => false
- t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false
- end
-
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"
@@ -1539,6 +1534,18 @@ ActiveRecord::Schema.define(:version => 20160624032138) 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 "quality_analyses", :force => true do |t|
+ t.integer "project_id"
+ t.string "author_login"
+ t.string "rep_identifier"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "sonar_version", :default => 0
+ t.string "path"
+ t.string "branch"
+ t.string "language"
+ end
+
create_table "queries", :force => true do |t|
t.integer "project_id"
t.string "name", :default => "", :null => false
@@ -1637,10 +1644,11 @@ ActiveRecord::Schema.define(:version => 20160624032138) do
create_table "schools", :force => true do |t|
t.string "name"
t.string "province"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "logo_link"
t.string "pinyin"
+ t.integer "school_type", :default => 0
end
create_table "secdomains", :force => true do |t|
@@ -1765,6 +1773,7 @@ ActiveRecord::Schema.define(:version => 20160624032138) do
t.integer "status", :default => 9
t.text "results"
t.text "src"
+ t.integer "uwait_time", :default => 0
end
create_table "student_works", :force => true do |t|
@@ -1783,8 +1792,8 @@ ActiveRecord::Schema.define(:version => 20160624032138) do
t.integer "absence_penalty", :default => 0
t.float "system_score", :default => 0.0
t.boolean "is_test", :default => false
- t.integer "simi_id"
- t.integer "simi_value"
+ t.integer "simi_id", :default => 0
+ t.integer "simi_value", :default => 0
t.float "work_score"
end
diff --git a/public/images/icons_ziliao.png b/public/images/icons_ziliao.png
new file mode 100644
index 000000000..dc72e7361
Binary files /dev/null and b/public/images/icons_ziliao.png differ
diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css
index 7fad9854f..b931dff6b 100644
--- a/public/stylesheets/new_user.css
+++ b/public/stylesheets/new_user.css
@@ -1802,4 +1802,99 @@ input.new_loggin_input{
.H60 {height:60px !important;}
.W420 {width:420px;}
.W300 {width:300px !important;}
-.W600{ width:600px;}
+.W600{ width:600px;}
+
+/* 个人资料修改弹框 */
+.winbox{
+ background-color: #fff;
+ padding: 20px;
+ width:480px;
+ -webkit-border-radius:5px;
+ -moz-border-radius:5px;
+ -o-border-radius:5px;
+ border-radius:5px;
+ border:none;
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%,-50%);
+}
+.winbox_h2{
+ font-size: 14px;
+ font-weight: normal;
+ color: #333;
+ border-bottom: 1px solid #ccc;
+ height: 28px;
+}
+.winbox_edit_new{
+ /*width: 425px;*/
+ margin: 28px 0;
+}
+.winbox_edit_new li{
+ height: 45px;
+ line-height: 30px;
+ font-size: 14px;
+}
+.winbox_edit_new label{
+ width: 80px;
+ text-align: right;
+ display: block;
+}
+.winbox_input{
+ width: 330px;
+ height: 28px;
+ border: 1px solid #ccc;
+ padding: 0 5px;
+ color: #888;
+}
+.winbox_select{
+ height: 28px;
+ border: 1px solid #ccc;
+ color: #888;
+}
+.winbox_textarea{
+ width: 330px;
+ height: 50px;
+ border: 1px solid #ccc;
+ padding: 5px;
+ color: #888;
+}
+.winbox_btn_blue{
+ padding: 5px 25px;
+ color: #fff;
+ text-align: center;
+ background-color: #3b94d6;
+ border: none;
+}
+.winbox_btn_blue:hover{
+ background-color: #2e83c2;
+}
+.icons_warning{
+ display: block;
+ width:20px;
+ height:20px;
+ background:url(../images/icons_ziliao.png) 0 2px no-repeat;
+}
+.icons_right{
+ display: block;
+ width:20px;
+ height:20px;
+ background:url(../images/icons_ziliao.png) 0 -25px no-repeat;
+}
+.icons_error{
+ display: block;
+ width:20px;
+ height:20px;
+ background:url(../images/icons_ziliao.png) 0 -52px no-repeat;
+}
+a.winbox_btn_close{
+ color: #3b94d6;
+ font-size: 18px;
+ font-weight: bold;
+}
+.winbox_p{
+ font-size: 14px;
+ text-align: center;
+
+
+}
\ No newline at end of file
diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css
index eaefb8d1b..ad6fefad9 100644
--- a/public/stylesheets/users.css
+++ b/public/stylesheets/users.css
@@ -86,7 +86,7 @@ a.select_btn_select{ background:#64bddb; color:#fff;}
.users_ctt{ font-size:14px; color:#666; margin-top:10px;}
.setting_left{ width:115px; text-align:right; float:left;}
.setting_left li{ height:28px;line-height:28px;}
-.setting_right{width:500px; text-align:left; float:left; margin-left:8px;}
+.setting_right{width:600px; text-align:left; float:left; margin-left:8px;}
.setting_right li{ height:28px;line-height:28px;}
.users_ctt ul li{ margin-bottom:10px;}
.users_ctt input,.users_ctt select,.users_ctt textarea{ border:1px solid #CCC;}
diff --git a/spec/factories/apply_add_schools.rb b/spec/factories/apply_add_schools.rb
new file mode 100644
index 000000000..a2994d28b
--- /dev/null
+++ b/spec/factories/apply_add_schools.rb
@@ -0,0 +1,12 @@
+FactoryGirl.define do
+ factory :apply_add_school, :class => 'ApplyAddSchools' do
+ name "MyString"
+province "MyString"
+city "MyString"
+address "MyString"
+remarks "MyString"
+school_id 1
+status 1
+ end
+
+end
diff --git a/spec/models/apply_add_schools_spec.rb b/spec/models/apply_add_schools_spec.rb
new file mode 100644
index 000000000..de1b7c05a
--- /dev/null
+++ b/spec/models/apply_add_schools_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe ApplyAddSchools, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end