From 3ec3479d66865d8e17c88c918ab78b25b647c747 Mon Sep 17 00:00:00 2001 From: Spen Date: Thu, 7 Nov 2013 12:13:16 +0800 Subject: [PATCH] fix app sub manager and ask verification code --- app/models/object_auth.rb | 9 +++++++-- app/models/prototype_auth.rb | 10 ++++++++++ .../panel/ask/front_end/ask_questions/index.html.erb | 2 ++ vendor/built_in_modules/ask_new/config/locales/en.yml | 2 ++ .../built_in_modules/ask_new/config/locales/zh_tw.yml | 2 ++ .../page_content/back_end/page_contexts_controller.rb | 2 +- .../back_end/page_contexts/_page_context.html.erb | 2 +- 7 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb index f2ef5c044..8734c4166 100644 --- a/app/models/object_auth.rb +++ b/app/models/object_auth.rb @@ -15,8 +15,13 @@ class ObjectAuth < PrototypeAuth end def check_user_has_can_access_app - sub_managing_users = auth_obj.module_app.sub_managing_users rescue [] - module_app = auth_obj.module_app + if auth_obj["_type"] == "PageContext" + module_app = ModuleApp.where(:key=>'page_content').first + sub_managing_users = module_app.sub_managing_users rescue [] + else + sub_managing_users = auth_obj.module_app.sub_managing_users rescue [] + module_app = auth_obj.module_app + end self.auth_users.each do |auth_user| if !sub_managing_users.include? auth_user && !auth_user.admin? module_app.assign_sub_manager(auth_user,User.current) diff --git a/app/models/prototype_auth.rb b/app/models/prototype_auth.rb index 79cce96d0..02a2d4fe4 100644 --- a/app/models/prototype_auth.rb +++ b/app/models/prototype_auth.rb @@ -55,6 +55,16 @@ class PrototypeAuth if (self.send item).include? obj.id (self.send item).delete obj.id self.save! + + if auth_obj["_type"] == "PageContext" + module_app = ModuleApp.where(:key=>'page_content').first + else + module_app = auth_obj.module_app + end + + module_app.remove_sub_manager(obj) + module_app.save + else false #should put error message for user not existed in list end diff --git a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb index 9a6721a2a..87ec8adfe 100644 --- a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb +++ b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb @@ -85,7 +85,9 @@ $(document).ready(function(){
+ <%= f.label t('ask.validate_code'), class: 'control-label required' %>
+ <%= gotcha_error %> <%= gotcha%>
diff --git a/vendor/built_in_modules/ask_new/config/locales/en.yml b/vendor/built_in_modules/ask_new/config/locales/en.yml index dcde262a0..ba2613ff4 100644 --- a/vendor/built_in_modules/ask_new/config/locales/en.yml +++ b/vendor/built_in_modules/ask_new/config/locales/en.yml @@ -18,6 +18,8 @@ en: admin: Administrator new_question: New question pending: Pending + validate_code: Verification code + validate_code_note: Please answer the following verification questions. mongoid: attributes: ask_question: diff --git a/vendor/built_in_modules/ask_new/config/locales/zh_tw.yml b/vendor/built_in_modules/ask_new/config/locales/zh_tw.yml index 452dbc407..26514c25f 100644 --- a/vendor/built_in_modules/ask_new/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/ask_new/config/locales/zh_tw.yml @@ -23,6 +23,8 @@ zh_tw: admin: 管理者 new_question: 新的發問 pending: 待處理 + validate_code: 驗證碼 + validate_code_note: 請回答下列驗證問句。 mongoid: attributes: ask_question: diff --git a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb index 6f5b2b062..b56499e8b 100644 --- a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb +++ b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb @@ -2,7 +2,7 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll before_filter :force_order_for_visitor,:only=>[:index] before_filter :force_order_for_user,:except => [:index] - before_filter :for_app_manager,:except => [:index] + # before_filter :for_app_manager,:except => [:index] before_filter :for_app_sub_manager,:except => [:index] #before_filter :is_admin? diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb index 21c740340..b687d17fa 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_page_context.html.erb @@ -4,7 +4,7 @@ <%= page_context.page.title %>