object_auth change to reload

This commit is contained in:
Matthew K. Fu JuYuan 2012-10-04 18:20:21 +08:00
parent ae48ab5cbd
commit e67ca84282
3 changed files with 7 additions and 9 deletions

View File

@ -6,7 +6,7 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
def setting
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
@ob_auth = ObjectAuth.find params[:object_auth_id]
@options_from_collection_for_select_ob_auth = [@ob_auth].collect{|oa| [oa.auth_obj.pp_object,oa.id] }
@options_from_collection_for_select_ob_auth = @ob_auth.siblings.collect{|oa| [oa.auth_obj.pp_object,oa.id] }
@users_array = @ob_auth.privilege_users rescue []
respond_to do |format|
@ -73,7 +73,6 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
end
def setup_vars
# binding.pry
if request.env['HTTP_REFERER'].split('/')[4] == "object_auths"
@app_key = params[:app_key]
else

View File

@ -5,6 +5,10 @@ class ObjectAuth < PrototypeAuth
after_save :check_user_has_app_auth
# > - Something.find_with_auth(query)
# > - or Something.find(query).auth
def siblings
ObjectAuth.where({obj_authable_type: obj_authable_type,title: title})
end
def auth_obj
class_obj = eval(self.obj_authable_type)
class_obj.find self.obj_authable_id

View File

@ -45,13 +45,8 @@ $(document).ready(function() {
}
});
$('#category_id').change(function() {
$.ajax({
type: 'GET',
dataType: "script",
url:$(this).parents("from").attr("href"),
data:$(this).parents("form").serialize()
});
$('#ob_auth_id').change(function() {
window.location.href = "/admin/object_auths/"+$(this).val()+"/new_interface?app_key="+$("#app_key").val();
});
});
</script>