File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
resources/views/components/attribute/widget Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ function process_oc() {
86
86
success : function (data ) {
87
87
// Render any must attributes
88
88
if (data .must .length ) {
89
+ var newattr = $ (' select#rdn' );
90
+ var oldoptions = $ (' select#rdn option' ).map ((i ,o )=> o .value ).get ();
91
+
89
92
data .must .forEach (function (item ) {
90
93
if ($ (' attribute#' + item .toLowerCase ()).length )
91
94
return ;
@@ -107,6 +110,21 @@ function process_oc() {
107
110
alert (' That didnt work? Please try again....' );
108
111
},
109
112
});
113
+
114
+ // If this is a new entry, add the required attributes to the RDN
115
+ if (! oldoptions .includes (item))
116
+ newattr .append (new Option (item,item,false ,false ));
117
+
118
+ // Sort the attributes
119
+ newattr
120
+ .append ($ (' select#rdn option' )
121
+ .remove ()
122
+ .sort (function (a ,b ) {
123
+ let at = $ (a).text (),
124
+ bt = $ (b).text ();
125
+ return (at > bt) ? 1 : ((at < bt) ? - 1 : 0 );
126
+ }))
127
+ .val (' ' );
110
128
})
111
129
}
112
130
You can’t perform that action at this time.
0 commit comments