mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
Use CSS-compatible row IDs in datatables
In CSS IDs may not begin with a number: - https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
This commit is contained in:
parent
38f266f716
commit
57e9135287
3 changed files with 7 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
class RegistrationDatatable < AjaxDatatablesRails::ActiveRecord
|
||||
extend Forwardable
|
||||
|
||||
def_delegator :@view, :dom_id
|
||||
def_delegator :@view, :edit_admin_conference_registration_path
|
||||
|
||||
def initialize(params, opts = {})
|
||||
|
|
@ -41,7 +42,7 @@ class RegistrationDatatable < AjaxDatatablesRails::ActiveRecord
|
|||
email: record.email,
|
||||
accepted_code_of_conduct: !!record.accepted_code_of_conduct, # rubocop:disable Style/DoubleNegation
|
||||
edit_url: edit_admin_conference_registration_path(conference, record),
|
||||
DT_RowId: record.id
|
||||
DT_RowId: dom_id(record)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
class UserDatatable < AjaxDatatablesRails::ActiveRecord
|
||||
extend Forwardable
|
||||
|
||||
def_delegator :@view, :dom_id
|
||||
def_delegator :@view, :show_roles
|
||||
def_delegator :@view, :admin_user_path
|
||||
def_delegator :@view, :edit_admin_user_path
|
||||
|
|
@ -39,7 +40,7 @@ class UserDatatable < AjaxDatatablesRails::ActiveRecord
|
|||
roles: record.roles.any? ? show_roles(record.get_roles) : 'None',
|
||||
view_url: admin_user_path(record),
|
||||
edit_url: edit_admin_user_path(record),
|
||||
DT_RowId: record.id
|
||||
DT_RowId: dom_id(record)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ describe UserDatatable do
|
|||
allow(view).to receive(:admin_user_path) do |arg|
|
||||
"/admin/users/#{arg.to_param}"
|
||||
end
|
||||
allow(view).to receive(:dom_id) do |user|
|
||||
"user_#{user.id}"
|
||||
end
|
||||
allow(view).to receive(:edit_admin_user_path) do |arg|
|
||||
"/admin/users/#{arg.to_param}/edit"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue