From 0c1d7d420eeadad69fb1952699acc96802f14f55 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 15 Oct 2015 13:54:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E7=9A=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=B8=8E=E7=8E=B0=E5=AE=9E=E9=97=AE=E9=A2=98=E9=87=8D?= =?UTF-8?q?=E5=81=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 356e46d86..987bb6fbd 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -563,14 +563,14 @@ $("#hint").hide(); } }else{ - $("#hint").html('平台没有找到包含"'+e.target.value+'"的高校,创建该高校。'); + $("#hint").html('平台没有找到包含"'+e.target.value+'"的高校,创建该高校'); $("#hint").show(); } } }); }); $(document.body).click(function(e){ - if($(e.target).attr("id") != 'search_school_result_list') + if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province') { $("#search_school_result_list").hide(); $("#hint").hide(); From 94d60e4150558eef4360fc4bd24d172aac18069a Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 15 Oct 2015 17:02:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=20=E6=9B=B4=E6=96=B0gem?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- config/configuration.yml | 12 ++++++------ lib/grack/Gemfile | 2 +- lib/grack/Gemfile.lock | 2 +- plugins/redmine_ckeditor/Gemfile | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index d1993359e..cf6e9f773 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'http://ruby.taobao.org' +source 'https://ruby.taobao.org' #source 'http://ruby.sdutlinux.org/' unless RUBY_PLATFORM =~ /w32/ diff --git a/config/configuration.yml b/config/configuration.yml index ef39f6493..2ac986927 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -83,12 +83,12 @@ default: email_delivery: delivery_method: :smtp smtp_settings: - address: smtp.163.com - port: 25 - domain: smtp.163.com - authentication: :plain - user_name: "huang.jingquan@163.com" - password: 'xinhu1ji2qu366' + address: mail.trustie.net + port: 25 + domain: mail.trustie.net + authentication: :login + user_name: "mail@trustie.net" + password: "loong2010" # Absolute path to the directory where attachments are stored. # The default is the 'files' directory in your Redmine instance. diff --git a/lib/grack/Gemfile b/lib/grack/Gemfile index b7113caa8..80932e7e4 100644 --- a/lib/grack/Gemfile +++ b/lib/grack/Gemfile @@ -1,4 +1,4 @@ -source "http://ruby.taobao.org" +source "https://ruby.taobao.org" gemspec diff --git a/lib/grack/Gemfile.lock b/lib/grack/Gemfile.lock index 52d60f85d..68fa71a2b 100644 --- a/lib/grack/Gemfile.lock +++ b/lib/grack/Gemfile.lock @@ -5,7 +5,7 @@ PATH rack (~> 1.5.1) GEM - remote: http://ruby.taobao.org/ + remote: https://ruby.taobao.org/ specs: byebug (4.0.5) columnize (= 0.9.0) diff --git a/plugins/redmine_ckeditor/Gemfile b/plugins/redmine_ckeditor/Gemfile index ce2f3c583..07a2bac50 100644 --- a/plugins/redmine_ckeditor/Gemfile +++ b/plugins/redmine_ckeditor/Gemfile @@ -1,4 +1,4 @@ -source 'http://ruby.taobao.org' +source 'https://ruby.taobao.org' gem 'rich', '1.4.6' gem 'kaminari' From e3a660cf18f3667d975db8d46213abaa5291f714 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 15 Oct 2015 17:06:42 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=A6=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/school_controller.rb | 11 ++++ app/views/my/account.html.erb | 81 +++++++++++++++++++++------- app/views/school/add_school.js.erb | 1 + config/routes.rb | 1 + 4 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 app/views/school/add_school.js.erb diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 5e68dc2bd..062b0fa34 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -132,4 +132,15 @@ class SchoolController < ApplicationController # end render :json => @school.to_json end + + #添加学校 + def add_school + @school = School.new + @school.name = params[:name].strip + @school.pinyin = Pinyin.t(params[:name].strip, splitter: '') + @school.save + respond_to do |format| + format.js + end + end end diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 987bb6fbd..d0125cd3b 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -72,22 +72,22 @@
  • <% if User.current.user_extensions.nil? %> - + <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> - + <% elsif User.current.user_extensions.school.nil? %> - + <% else %> - + @@ -144,7 +144,7 @@
  • <%= f.select :language, :Chinese => :zh, :English => :en %>
  • - 确认 + 确认
  • @@ -170,7 +170,7 @@
  • 确认 - +
  • @@ -185,7 +185,7 @@
    @@ -532,12 +532,33 @@ $("#search_school_result_list").hide(); $("#hint").hide(); } + function add_school(name){ + $.ajax({ + url: '<%= url_for(:controller => 'school',:action => 'add_school') %>' + '?name=' + name, + type: 'post', + success: function (data) { + + } + }); + } var lastSearchCondition = ''; $(function() { +// $("input[name='province']").keydown(function(e){ +// if(e.keyCode == 13 && $("#search_school_result_list").css('display') == 'block'){ +// str = $("#search_school_result_list").children().eq(0).attr('onclick').match(/\(.*\)/)[0] +// +// str = str.replace(/\(/,'').replace(/\)/,''); +// arr = str.split(','); +// id = arr[1].replace(/\'/,'') +// name = arr.replace(/\'/,'') +// changeValue(name,id); +// return false; +// } +// }); //查询学校 $("input[name='province']").on('input', function (e) { $("input[name='occupation']").val(''); //一旦有输入就清空id。 - if($(e.target).val().trim() == lastSearchCondition){ + if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){ return; } lastSearchCondition = $(e.target).val().trim(); @@ -545,7 +566,7 @@ url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value, type: 'post', success: function (data) { - if(data.lengh != 0) { + if(data.length != undefined && data.length != 0) { var i = 0; $("#search_school_result_list").html(''); for (; i < data.length; i++) { @@ -557,13 +578,16 @@ $("#search_school_result_list").css("position", "absolute"); $("#search_school_result_list").show(); if($(e.target).val().trim() != '') { - $("#hint").html('平台找到了' + data.length + '个包含"' + e.target.value + '"的高校'); + str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value; + $("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校'); $("#hint").show(); }else{ $("#hint").hide(); } }else{ - $("#hint").html('平台没有找到包含"'+e.target.value+'"的高校,创建该高校'); + $("#search_school_result_list").html(''); + str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; + $("#hint").html('没有找到包含"'+str+'"的高校,创建高校'); $("#hint").show(); } } @@ -577,20 +601,37 @@ } }) $("input[name='province']").on('focus', function (e) { + if($(e.target).val() == ''){ + return; + } $.ajax({ url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value, type: 'post', success: function (data) { - var i = 0; - $("#search_school_result_list").html(''); - for ( ;i' +data[i].school.name+'
    '; - $("#search_school_result_list").append(link); + if(data.length != undefined && data.length != 0) { + var i = 0; + $("#search_school_result_list").html(''); + for (; i < data.length; i++) { + link = '' + data[i].school.name + '
    '; + $("#search_school_result_list").append(link); + } + $("#search_school_result_list").css('left', $(e.target).offset().left); + $("#search_school_result_list").css('top', $(e.target).offset().top + 28); + $("#search_school_result_list").css("position", "absolute"); + $("#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('找到了' + data.length + '个包含"' + str + '"的高校'); + $("#hint").show(); + } else { + $("#hint").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").show(); } - $("#search_school_result_list").css('left',$(e.target).offset().left); - $("#search_school_result_list").css('top',$(e.target).offset().top + 28); - $("#search_school_result_list").css("position", "absolute"); - $("#search_school_result_list").show(); } }); }); diff --git a/app/views/school/add_school.js.erb b/app/views/school/add_school.js.erb new file mode 100644 index 000000000..181c4e03b --- /dev/null +++ b/app/views/school/add_school.js.erb @@ -0,0 +1 @@ +$("input[name='occupation']").val('<%= @school.id%>'); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 01e9500d8..6839b0433 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -880,6 +880,7 @@ RedmineApp::Application.routes.draw do get 'school/search_school/', :to => 'school#search_school' post 'school/on_search' + post 'school/add_school' ######added by nie match 'tags/show_projects_tags' ########### added by liuping