From 782071ab64a23fa2df1acfbe3d05f50ec5681391 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 7 Mar 2015 15:36:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=94=A8=E9=97=AE=E9=A2=98=EF=BC=8Capp?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 4 ++++ app/services/courses_service.rb | 4 ++-- app/views/admin/mobile_version.html.erb | 3 +-- config/routes.rb | 1 + db/schema.rb | 19 +++++++------------ 5 files changed, 15 insertions(+), 16 deletions(-) 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/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 @@ 发布新版本
-

当前版本:
diff --git a/config/routes.rb b/config/routes.rb index b105dabc3..f867d1351 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -642,6 +642,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 diff --git a/db/schema.rb b/db/schema.rb index f4e6b09c7..bad1cf2ae 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,11 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -<<<<<<< HEAD ActiveRecord::Schema.define(:version => 20150305081132) do -======= -ActiveRecord::Schema.define(:version => 20150305011359) do ->>>>>>> 001b8bb1120fadea713d280e7d5bbabf7f5e57b8 create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -819,19 +815,18 @@ ActiveRecord::Schema.define(:version => 20150305011359) do t.integer "project_id" end -<<<<<<< HEAD - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false -======= create_table "organizations", :force => true do |t| t.string "name" t.string "logo_link" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false ->>>>>>> 001b8bb1120fadea713d280e7d5bbabf7f5e57b8 + end + + create_table "phone_app_versions", :force => true do |t| + t.string "version" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "poll_answers", :force => true do |t| From 48ac3dbea8eb14c6dec361e541a35339b6414b80 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 7 Mar 2015 16:07:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=89=88--=E6=B3=A8=E5=86=8C=E6=97=B6=E8=BF=94?= =?UTF-8?q?=E5=9B=9E500=E9=94=99=E8=AF=AF=E3=80=8B=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=82=80=E8=AF=B7=E6=97=B6=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=8A=9F=E8=83=BD=20Signed-off-by:=20alan=20?= =?UTF-8?q?<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 2 +- app/controllers/projects_controller.rb | 10 +++++++++- app/views/projects/_invite_members_by_mail.html.erb | 3 +++ app/views/projects/_regested.html.erb | 3 +++ app/views/projects/send_mail_to_member.js.erb | 1 + config/locales/zh.yml | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/views/projects/_regested.html.erb create mode 100644 app/views/projects/send_mail_to_member.js.erb 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/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/views/projects/_invite_members_by_mail.html.erb b/app/views/projects/_invite_members_by_mail.html.erb index 68ab6fae4..42a36bce0 100644 --- a/app/views/projects/_invite_members_by_mail.html.erb +++ b/app/views/projects/_invite_members_by_mail.html.erb @@ -4,6 +4,9 @@

发送邮件邀请新用户

输入好友邮箱地址,Trustie帮您免费发送!

+
+ <%= render :partial => 'regested', locals: { :isregisted => false} %> +
<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get',:remote=>true) do %>