mirror of
https://github.com/openSUSE/osem.git
synced 2026-05-19 14:11:52 -04:00
Update datatables for ajax-datatables-rails 1
Resolves: - inability to filter, order, or paginate datatables - exception AjaxDatatablesRails::Error::InvalidSearchColumn Continues: -81853d1ef9-83636afee0
This commit is contained in:
@@ -20,7 +20,7 @@ module Admin
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json do
|
||||
render json: RegistrationDatatable.new({}, conference: @conference, view_context: view_context)
|
||||
render json: RegistrationDatatable.new(params, conference: @conference, view_context: view_context)
|
||||
end
|
||||
format.pdf { render 'index', layout: false }
|
||||
format.xlsx do
|
||||
|
||||
@@ -23,7 +23,7 @@ module Admin
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json do
|
||||
render json: UserDatatable.new({}, view_context: view_context)
|
||||
render json: UserDatatable.new(params, view_context: view_context)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,7 +51,7 @@ class RegistrationDatatable < AjaxDatatablesRails::ActiveRecord
|
||||
end
|
||||
|
||||
# override upstream santitation, which converts everything to strings
|
||||
def sanitize(records)
|
||||
def sanitize_data(records)
|
||||
records
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,8 @@ class UserDatatable < AjaxDatatablesRails::ActiveRecord
|
||||
email: { source: 'User.email' },
|
||||
name: { source: 'User.name' },
|
||||
attended: { source: 'attended_count', searchable: false },
|
||||
roles: { source: 'Role.name' }
|
||||
roles: { source: 'Role.name' },
|
||||
actions: { source: 'User.id', searchable: false, orderable: false }
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -71,13 +71,13 @@
|
||||
"searchable": false
|
||||
},
|
||||
{
|
||||
"data": null,
|
||||
"data": "actions",
|
||||
"className": "actions",
|
||||
"searchable": false,
|
||||
"sortable": false,
|
||||
"render": function (data, type, row, meta) {
|
||||
return '<div class="btn-group">'+
|
||||
'<a class="btn-primary" href="'+data.edit_url+'">Edit</a>'+
|
||||
'<a class="btn-primary" href="'+row.edit_url+'">Edit</a>'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": null,
|
||||
"data": "actions",
|
||||
"className": "actions",
|
||||
"sortable": false,
|
||||
"render": function (data, type, row, meta) {
|
||||
return '<div class="btn-group">'+
|
||||
'<a class="btn-info" href="'+data.view_url+'">View</a>'+
|
||||
'<a class="btn-primary" href="'+data.edit_url+'">Edit</a>'+
|
||||
'<a class="btn-info" href="'+row.view_url+'">View</a>'+
|
||||
'<a class="btn-primary" href="'+row.edit_url+'">Edit</a>'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user