|
70 | 70 | @endsection |
71 | 71 |
|
72 | 72 | @section('page-scripts') |
| 73 | + |
73 | 74 | <script type="text/javascript"> |
74 | | - var oc = {!! $oo->getObject('objectclass')->values !!}; |
75 | 75 | var rdn_attr; |
76 | 76 |
|
77 | 77 | function editmode() { |
@@ -100,31 +100,35 @@ function editmode() { |
100 | 100 | } |
101 | 101 |
|
102 | 102 | $(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(); |
119 | 130 | }); |
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 |
128 | 132 |
|
129 | 133 | editmode(); |
130 | 134 | }); |
|
0 commit comments