Skip to content

Commit 9dce26f

Browse files
committed
fix crud button
1 parent fc6317e commit 9dce26f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<span class="input-group-btn">
2-
<button
2+
<a
33
href="#"
44
type="button"
55
class="btn btn-warning {{ isset($field['value']) ?: 'disabled'}}"
66
style="border-radius: 0px"
77
data-id="{{ $field['value'] ?? '' }}"
88
data-url="{{ $field['on_the_fly']['crud_url'] ?? backpack_url($field['on_the_fly']['entity']) }}"
99
data-target="#{{ $field['on_the_fly']['entity'] ?? 'ajax_entity' }}_edit_crud"
10-
onclick="location.href=($(this).data('url') + '/' + $(this).data('id') + '/edit')"
1110
>
1211
<i class="fa fa-pencil"></i>
13-
</button>
12+
</a>
1413
</span>
1514

resources/views/fields/select2_from_ajax.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ class="form-control"
135135
var editButton = $("[data-target='#{{ $field['on_the_fly']['entity'] ?? 'ajax_entity' }}_edit_modal']");
136136
var deleteButton = $("[data-target='#{{ $field['on_the_fly']['entity'] ?? 'ajax_entity' }}_delete_modal']");
137137
138-
if (entry.id) {
139-
editCrud.data("id", entry.id).removeClass('disabled');
138+
if (entry) {
139+
editCrud.data("id", entry.id).prop('href', editCrud.data('url') + '/' + entry.id + '/edit').removeClass('disabled');
140140
editButton.data("id", entry.id).removeClass('disabled');
141141
deleteButton.data("id", entry.id).removeClass('disabled');
142142
} else {
143-
editCrud.data("id", "").addClass('disabled');
143+
editCrud.data("id", "").prop('href', '#').addClass('disabled');
144144
editButton.data("id", "").addClass('disabled');
145145
deleteButton.data("id", "").addClass('disabled');
146146
}

0 commit comments

Comments
 (0)