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
|
class RegistrationDatatable < AjaxDatatablesRails::ActiveRecord
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
|
def_delegator :@view, :dom_id
|
||||||
def_delegator :@view, :edit_admin_conference_registration_path
|
def_delegator :@view, :edit_admin_conference_registration_path
|
||||||
|
|
||||||
def initialize(params, opts = {})
|
def initialize(params, opts = {})
|
||||||
|
|
@ -41,7 +42,7 @@ class RegistrationDatatable < AjaxDatatablesRails::ActiveRecord
|
||||||
email: record.email,
|
email: record.email,
|
||||||
accepted_code_of_conduct: !!record.accepted_code_of_conduct, # rubocop:disable Style/DoubleNegation
|
accepted_code_of_conduct: !!record.accepted_code_of_conduct, # rubocop:disable Style/DoubleNegation
|
||||||
edit_url: edit_admin_conference_registration_path(conference, record),
|
edit_url: edit_admin_conference_registration_path(conference, record),
|
||||||
DT_RowId: record.id
|
DT_RowId: dom_id(record)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
class UserDatatable < AjaxDatatablesRails::ActiveRecord
|
class UserDatatable < AjaxDatatablesRails::ActiveRecord
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
|
def_delegator :@view, :dom_id
|
||||||
def_delegator :@view, :show_roles
|
def_delegator :@view, :show_roles
|
||||||
def_delegator :@view, :admin_user_path
|
def_delegator :@view, :admin_user_path
|
||||||
def_delegator :@view, :edit_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',
|
roles: record.roles.any? ? show_roles(record.get_roles) : 'None',
|
||||||
view_url: admin_user_path(record),
|
view_url: admin_user_path(record),
|
||||||
edit_url: edit_admin_user_path(record),
|
edit_url: edit_admin_user_path(record),
|
||||||
DT_RowId: record.id
|
DT_RowId: dom_id(record)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,9 @@ describe UserDatatable do
|
||||||
allow(view).to receive(:admin_user_path) do |arg|
|
allow(view).to receive(:admin_user_path) do |arg|
|
||||||
"/admin/users/#{arg.to_param}"
|
"/admin/users/#{arg.to_param}"
|
||||||
end
|
end
|
||||||
|
allow(view).to receive(:dom_id) do |user|
|
||||||
|
"user_#{user.id}"
|
||||||
|
end
|
||||||
allow(view).to receive(:edit_admin_user_path) do |arg|
|
allow(view).to receive(:edit_admin_user_path) do |arg|
|
||||||
"/admin/users/#{arg.to_param}/edit"
|
"/admin/users/#{arg.to_param}/edit"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue