diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 87c028354..2cf404ffb 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -125,7 +125,7 @@ class AccountController < ApplicationController #register_by_email_activation(@user) unless @user.new_record? flash[:notice] = l(:notice_account_register_done) - render action: 'email_valid', locals: {:mail => user.mail} + render action: 'email_valid', locals: {:mail => @user.mail} end when '3' #register_automatically(@user) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 69aae8008..c77ebe704 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -336,4 +336,8 @@ class AdminController < ApplicationController end + def create_version + + end + end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6ab757336..052df384e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -333,13 +333,21 @@ class ProjectsController < ApplicationController end def send_mail_to_member - unless params[:mail].nil? + + if !params[:mail].nil? && User.find_by_mail(params[:mail].to_s).nil? email = params[:mail] Mailer.send_invite_in_project(email, @project, User.current).deliver + @is_zhuce =false + else + @is_zhuce = true + end + respond_to do |format| + format.js end end #发送邮件邀请新用户 def invite_members_by_mail + @is_zhuce =false respond_to do |format| format.html format.js diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 22b7f8cd3..46b59ef08 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -158,9 +158,9 @@ class CoursesService #显示课程 - def show_course(params,currnet_user) + def show_course(params,current_user) course = Course.find(params[:id]) - unless (course.is_public == 1 || currnet_user.member_of_course?(@course)|| currnet_user.admin?) + unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) raise '403' end {:course => course,:img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course)} diff --git a/app/views/admin/mobile_version.html.erb b/app/views/admin/mobile_version.html.erb index f8fd4ad6c..293b0ec46 100644 --- a/app/views/admin/mobile_version.html.erb +++ b/app/views/admin/mobile_version.html.erb @@ -2,9 +2,8 @@ 发布新版本
输入好友邮箱地址,Trustie帮您免费发送!
-<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get',:remote=>true) do %>
+<%= l(:notice_registed_success) %>
+<% end %> \ No newline at end of file diff --git a/app/views/projects/send_mail_to_member.js.erb b/app/views/projects/send_mail_to_member.js.erb new file mode 100644 index 000000000..21b097c65 --- /dev/null +++ b/app/views/projects/send_mail_to_member.js.erb @@ -0,0 +1 @@ +$("#is_registed").html("<%= escape_javascript( render :partial => 'regested', locals: {:isregisted => @is_zhuce})%>") \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 4abc2eee5..1faa9227d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -181,6 +181,7 @@ zh: notice_successful_create: 创建成功 notice_successful_update: 更新成功 notice_successful_delete: 删除成功 + notice_registed_success: 该邮箱已被注册,请直接邀请注册用户 notice_failed_delete: 删除失败 notice_successful_connection: 连接成功 notice_successful_join: 加入成功 diff --git a/config/routes.rb b/config/routes.rb index cc64781f9..365c5a78e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -645,6 +645,7 @@ RedmineApp::Application.routes.draw do match 'admin/web_footer_made', as: :web_footer_made match 'admin/enterprise_page_made', as: :enterprise_page_made match 'admin/mobile_version', as: :mobile_version + match 'admin/create_version', as: :create_version match 'admin/search', :via => [:get, :post] match 'admin/plugins', :via => :get match 'admin/info', :via => :get