Repository: ranger
Updated Branches:
  refs/heads/master 513477d06 -> c24c9bdfd


RANGER-1763 On the Edit Policy page, Conditions is expanded by default, so the 
expansion button shuold be hide instead of show.

Signed-off-by: zhangqiang2 <zhangqia...@zte.com.cn>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/c24c9bdf
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/c24c9bdf
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/c24c9bdf

Branch: refs/heads/master
Commit: c24c9bdfd2bc813febf16736877b7f43cd8bfeb5
Parents: 513477d
Author: peng.jianhua <peng.jian...@zte.com.cn>
Authored: Mon Sep 4 20:17:41 2017 +0800
Committer: zhangqiang2 <zhangqia...@zte.com.cn>
Committed: Thu Sep 7 14:23:18 2017 +0800

----------------------------------------------------------------------
 .../scripts/views/policies/RangerPolicyForm.js  | 25 +++++++++++---------
 1 file changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/c24c9bdf/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js 
b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
index 6f27d5d..9a8d82d 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js
@@ -147,12 +147,8 @@ define(function(require){
                                var wrap = $(this).next();
                                // If next element is a wrap and hasn't 
.non-collapsible class
                                if (wrap.hasClass('wrap') && ! 
wrap.hasClass('non-collapsible')){
-                                       $(this).append('<a href="#" 
class="wrap-expand pull-right" >show&nbsp;&nbsp;<i 
class="icon-caret-down"></i></a>')
-                                                  .append('<a href="#" 
class="wrap-collapse pull-right" style="display: none">hide&nbsp;&nbsp;<i 
class="icon-caret-up"></i></a>');
-                                       if( i === 0 ) {
-                                               
$(this).find('.wrap-expand').hide();
-                                               
$(this).find('.wrap-collapse').show();
-                                       }
+                                       $(this).append('<a href="#" 
class="wrap-expand pull-right" style="display: none">show&nbsp;&nbsp;<i 
class="icon-caret-down"></i></a>')
+                                                  .append('<a href="#" 
class="wrap-collapse pull-right" >hide&nbsp;&nbsp;<i 
class="icon-caret-up"></i></a>');
                                }
                        });
                        // Collapse wrap
@@ -175,16 +171,23 @@ define(function(require){
                        var parentPermsObj = { groupPermsDeny : 
this.formInputDenyList,  };
                        var childPermsObj = { groupPermsAllowExclude : 
this.formInputAllowExceptionList, groupPermsDenyExclude : 
this.formInputDenyExceptionList}
                        _.each(childPermsObj, function(val, name){
-                               if(val.length <= 0)
-                                       
this.$el.find('[data-customfields="'+name+'"]').parent().hide();
+                               if(val.length <= 0) {
+                                       var wrap = 
this.$el.find('[data-customfields="'+name+'"]').parent();
+                                       wrap.hide();
+                                       $('.wrap-collapse', 
wrap.prev('.wrap-header')).hide();
+                                       $('.wrap-expand', 
wrap.prev('.wrap-header')).show();
+                               }
                        },this)
                        
-                       _.each(parentPermsObj, function(val, name, i){
+                       _.each(parentPermsObj, function(val, name){
                                if(val.length <= 0){
-                                       var tmp = 
this.$el.find('[data-customfields="'+name+'"]').next()
+                                       var tmp = 
this.$el.find('[data-customfields="'+name+'"]').next();
                                        var childPerm = 
tmp.find('[data-customfields^="groupPerms"]');
                                        if(childPerm.parent().css('display') == 
'none'){
-                                               
this.$el.find('[data-customfields="'+name+'"]').parent().hide();
+                                               var wrap = 
this.$el.find('[data-customfields="'+name+'"]').parent();
+                                               wrap.hide();
+                                               $('.wrap-collapse', 
wrap.prev('.wrap-header')).hide();
+                                               $('.wrap-expand', 
wrap.prev('.wrap-header')).show();
                                        }
                                }
                        },this)

Reply via email to