Skip to content

Commit b501dfe

Browse files
committed
During create we were passing the wrong objectlcasses to the ajax call when adding a new attribute.
1 parent 3fad977 commit b501dfe

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

resources/views/frames/create.blade.php

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
@endsection
7171

7272
@section('page-scripts')
73+
7374
<script type="text/javascript">
74-
var oc = {!! $oo->getObject('objectclass')->values !!};
7575
var rdn_attr;
7676
7777
function editmode() {
@@ -100,31 +100,35 @@ function editmode() {
100100
}
101101
102102
$(document).ready(function() {
103-
$('#newattr').on('change',function(item) {
104-
$.ajax({
105-
type: 'POST',
106-
beforeSend: function() {},
107-
success: function(data) {
108-
$('#newattrs').append(data);
109-
},
110-
error: function(e) {
111-
if (e.status != 412)
112-
alert('That didnt work? Please try again....');
113-
},
114-
url: '{{ url('entry/attr/add') }}/'+item.target.value,
115-
data: {
116-
objectclasses: oc,
117-
},
118-
cache: false
103+
@if($step === 2)
104+
var oc = {!! $o->getObject('objectclass')->values !!};
105+
106+
$('#newattr').on('change',function(item) {
107+
$.ajax({
108+
type: 'POST',
109+
url: '{{ url('entry/attr/add') }}/'+item.target.value,
110+
data: {
111+
objectclasses: oc,
112+
},
113+
cache: false,
114+
beforeSend: function() {},
115+
success: function(data) {
116+
$('#newattrs').append(data);
117+
},
118+
error: function(e) {
119+
if (e.status != 412)
120+
alert('That didnt work? Please try again....');
121+
},
122+
});
123+
124+
// Remove the option from the list
125+
$(this).find('[value="'+item.target.value+'"]').remove()
126+
127+
// If there are no more options
128+
if ($(this).find("option").length === 1)
129+
$('#newattr-select').remove();
119130
});
120-
121-
// Remove the option from the list
122-
$(this).find('[value="'+item.target.value+'"]').remove()
123-
124-
// If there are no more options
125-
if ($(this).find("option").length === 1)
126-
$('#newattr-select').remove();
127-
});
131+
@endif
128132
129133
editmode();
130134
});

0 commit comments

Comments
 (0)