Skip to content

Commit dc156e4

Browse files
committed
Lint: Use hash for data attributes in views
1 parent 2aff835 commit dc156e4

File tree

13 files changed

+27
-27
lines changed

13 files changed

+27
-27
lines changed

app/views/application/_navigation.html.slim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
span.caret
77
ul.dropdown-menu.p-0.mt-1 role='menu'
88
- if current_user.admin?
9-
li = link_to(t('breadcrumbs.dashboard.show'), admin_dashboard_path, class: 'dropdown-item', 'data-turbo': 'false') if policy(%i[admin dashboard]).show?
10-
li = link_to(t('breadcrumbs.rails_admin.show'), rails_admin.dashboard_path, class: 'dropdown-item', 'data-turbo': 'false') if policy(%i[admin dashboard]).show?
9+
li = link_to(t('breadcrumbs.dashboard.show'), admin_dashboard_path, class: 'dropdown-item', data: {turbo: false}) if policy(%i[admin dashboard]).show?
10+
li = link_to(t('breadcrumbs.rails_admin.show'), rails_admin.dashboard_path, class: 'dropdown-item', data: {turbo: false}) if policy(%i[admin dashboard]).show?
1111
li = link_to(t('breadcrumbs.statistics.show'), statistics_path, class: 'dropdown-item') if policy(:statistics).show?
1212
li.dropdown-divider role='separator'
1313
= render('navigation_submenu', title: Exercise.model_name.human(count: :other),

app/views/codeharbor_links/_form.html.slim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
= render('shared/form_errors', object: @codeharbor_link)
33
.mb-3
44
= f.label(:push_url, class: 'form-label')
5-
= f.text_field :push_url, data: {'bs-toggle': 'tooltip', 'bs-placement': 'bottom'}, title: t('codeharbor_link.info.push_url'), class: 'form-control'
5+
= f.text_field :push_url, data: {bs_toggle: 'tooltip', bs_placement: 'bottom'}, title: t('codeharbor_link.info.push_url'), class: 'form-control'
66
.mb-3
77
= f.label(:check_uuid_url, class: 'form-label')
8-
= f.text_field :check_uuid_url, data: {'bs-toggle': 'tooltip', 'bs-placement': 'bottom'}, title: t('codeharbor_link.info.check_uuid_url'), class: 'form-control'
8+
= f.text_field :check_uuid_url, data: {bs_toggle: 'tooltip', bs_placement: 'bottom'}, title: t('codeharbor_link.info.check_uuid_url'), class: 'form-control'
99
.mb-3
1010
= f.label(:api_key, class: 'form-label')
1111
.input-group
12-
= f.text_field(:api_key, data: {'bs-toggle': 'tooltip', 'bs-placement': 'bottom'}, title: t('codeharbor_link.info.api_key'), class: 'form-control api_key')
12+
= f.text_field(:api_key, data: {bs_toggle: 'tooltip', bs_placement: 'bottom'}, title: t('codeharbor_link.info.api_key'), class: 'form-control api_key')
1313
.input-group-btn
1414
= button_tag(t('codeharbor_link.generate'), type: 'button', class: 'generate-api_key btn btn-default')
1515
.actions

app/views/execution_environments/show.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ h1.d-inline-block = @execution_environment
55
ul.dropdown-menu.dropdown-menu-end role='menu'
66
li = button_to(t('execution_environments.index.synchronize.button'), sync_to_runner_management_execution_environment_path(@execution_environment), method: :post, class: 'dropdown-item') if policy(@execution_environment).sync_to_runner_management?
77
li = link_to(t('execution_environments.index.shell'), shell_execution_environment_path(@execution_environment), class: 'dropdown-item') if policy(@execution_environment).shell?
8-
li = link_to(t('shared.statistics'), statistics_execution_environment_path(@execution_environment), 'data-turbo': 'false', class: 'dropdown-item') if policy(@execution_environment).statistics?
8+
li = link_to(t('shared.statistics'), statistics_execution_environment_path(@execution_environment), data: {turbo: false}, class: 'dropdown-item') if policy(@execution_environment).statistics?
99
li = button_to(t('shared.destroy'), @execution_environment, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(@execution_environment).destroy?
1010

1111
= row(label: 'execution_environment.name', value: @execution_environment.name)

app/views/execution_environments/statistics.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ h1 = @execution_environment
2121
- if wts then average_time = wts['average_time'] else 0 # rubocop:disable Lint/ElseLayout
2222
- if wts then stddev_time = wts['stddev_time'] else 0 # rubocop:disable Lint/ElseLayout
2323
tr
24-
td = link_to_if(policy(exercise).statistics?, exercise.title, controller: 'exercises', action: 'statistics', id: exercise.id, 'data-turbo': 'false')
24+
td = link_to_if(policy(exercise).statistics?, exercise.title, controller: 'exercises', action: 'statistics', id: exercise.id, data: {turbo: false})
2525
td = us['contributors']
2626
td = us['average_score'].to_f.round(4)
2727
td = us['maximum_score'].to_f.round(2)

app/views/exercise_collections/_form.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
td
2525
span.fa-solid.fa-bars
2626
td = item.exercise.title
27-
td = link_to(t('shared.show'), item.exercise, 'data-turbo': 'false')
27+
td = link_to(t('shared.show'), item.exercise, data: {turbo: false})
2828
td
2929
a.remove-exercise href='#' = t('shared.destroy')
3030
.d-none

app/views/exercise_collections/show.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ h4.mt-4 = ExerciseCollection.human_attribute_name('exercises')
2525
td = link_to_if(policy(exercise).show?, exercise.title, exercise)
2626
td = link_to_if(exercise.execution_environment && policy(exercise.execution_environment).show?, exercise.execution_environment, exercise.execution_environment)
2727
td = link_to_if(exercise.user && policy(exercise.user).show?, exercise.user.displayname, exercise.user)
28-
td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbo': 'false') if policy(exercise).statistics?
28+
td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), data: {turbo: false}) if policy(exercise).statistics?

app/views/exercise_collections/statistics.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ h4.mt-4 = ExerciseCollection.human_attribute_name('exercises')
4848
td = exercise.submissions.send(:final).distinct.count(:contributor_id)
4949
td = exercise.finishers_percentage
5050
td = exercise.average_percentage
51-
td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbo': 'false') if policy(exercise).statistics?
51+
td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), data: {turbo: false}) if policy(exercise).statistics?
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
- if imported
22
= link_to(t('exercises.import_proforma.button.show_exercise'), exercise, class: 'btn btn-light btn-sm float-end show-action import-export-button', target: '_blank', rel: 'noopener noreferrer')
33
- elsif exists && updatable
4-
= button_tag(type: 'button', class: 'btn btn-success btn-sm float-end import-action import-export-button', data: {'import-type' => 'import', 'file-id' => file_id}) do
4+
= button_tag(type: 'button', class: 'btn btn-success btn-sm float-end import-action import-export-button', data: {import_type: 'import', file_id: file_id}) do
55
i.fa-solid.fa-check.confirm-icon.export-button-icon
66
= t('exercises.import_proforma.button.overwrite')
77
- elsif exists
8-
= button_tag(type: 'button', class: 'btn btn-success btn-sm float-end import-action import-export-button', data: {'import-type' => 'create_new', 'file-id' => file_id}) do
8+
= button_tag(type: 'button', class: 'btn btn-success btn-sm float-end import-action import-export-button', data: {import_type: 'create_new', file_id: file_id}) do
99
i.fa-solid.fa-check.confirm-icon-alt.export-button-icon
1010
= t('exercises.import_proforma.button.import_copy')
1111
- else
12-
= button_tag(type: 'button', class: 'btn btn-success btn-sm float-end import-action import-export-button', data: {'import-type' => 'import', 'file-id' => file_id}) do
12+
= button_tag(type: 'button', class: 'btn btn-success btn-sm float-end import-action import-export-button', data: {import_type: 'import', file_id: file_id}) do
1313
i.fa-solid.fa-check.confirm-icon.export-button-icon
1414
= t('exercises.import_proforma.button.import')

app/views/exercises/index.html.slim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ h1 = Exercise.model_name.human(count: :other)
2222
= Exercise.human_attribute_name('public')
2323
- if policy(Exercise).batch_update?
2424
br
25-
span.batch = link_to(t('shared.batch_update'), '#', 'data-text': t('shared.update', model: Exercise.model_name.human(count: :other)))
25+
span.batch = link_to(t('shared.batch_update'), '#', data: {text: t('shared.update', model: Exercise.model_name.human(count: :other))})
2626
th.p-1 colspan=6 = t('shared.actions')
2727
tbody
2828
- @exercises.each do |exercise|
2929
tr data-id=exercise.id
3030
td.p-1.pt-2
31-
= link_to_if(policy(exercise).show?, exercise.title, exercise, 'data-turbo': 'false')
31+
= link_to_if(policy(exercise).show?, exercise.title, exercise, data: {turbo: false})
3232
- if exercise.internal_title.present?
3333
p.mb-0.text-muted
3434
i.fa-solid.fa-arrow-turn-up.fa-rotate-90
@@ -41,19 +41,19 @@ h1 = Exercise.model_name.human(count: :other)
4141
td.p-1.pt-2.public data-value=exercise.public? = symbol_for(exercise.public?)
4242
td.p-1.pt-2 = link_to(t('shared.edit'), edit_exercise_path(exercise)) if policy(exercise).edit?
4343
td.p-1.pt-2 = link_to(t('.implement'), implement_exercise_path(exercise)) if policy(exercise).implement?
44-
td.p-1.pt-2 = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbo': 'false') if policy(exercise).statistics?
44+
td.p-1.pt-2 = link_to(t('shared.statistics'), statistics_exercise_path(exercise), data: {turbo: false}) if policy(exercise).statistics?
4545

4646
td.p-1
4747
.btn-group
4848
button.btn.btn-outline-primary.btn-sm.dropdown-toggle data-bs-toggle='dropdown' type='button' = t('shared.actions_button')
4949
ul.dropdown-menu.float-end role='menu'
50-
li = link_to(t('shared.show'), exercise, 'data-turbo': 'false', class: 'dropdown-item') if policy(exercise).show?
50+
li = link_to(t('shared.show'), exercise, data: {turbo: false}, class: 'dropdown-item') if policy(exercise).show?
5151
li = link_to(UserExerciseFeedback.model_name.human(count: :other), feedback_exercise_path(exercise), class: 'dropdown-item') if policy(exercise).feedback?
5252
li = link_to(RequestForComment.model_name.human(count: :other), exercise_request_for_comments_path(exercise), class: 'dropdown-item') if policy(exercise).rfcs_for_exercise?
5353
li = link_to(ProgrammingGroup.model_name.human(count: :other), exercise_programming_groups_path(exercise), class: 'dropdown-item') if policy(exercise).programming_groups_for_exercise?
5454
li = button_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(exercise).destroy?
5555
li = button_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy'), turbo: false}, method: :post, class: 'dropdown-item') if policy(exercise).clone?
56-
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id': exercise.id, 'bs-toggle': 'modal', 'bs-target': '#transfer-modal'}) if policy(exercise).export_external_confirm?
56+
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {exercise_id: exercise.id, bs_toggle: 'modal', bs_target: '#transfer-modal'}) if policy(exercise).export_external_confirm?
5757
li = link_to(t('exercises.download_proforma.label'), download_proforma_exercise_path(exercise), class: 'dropdown-item', target: '_blank', rel: 'noopener noreferrer') if policy(exercise).download_proforma?
5858

5959
= render('shared/pagination', collection: @exercises)

app/views/exercises/show.html.slim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ h1.d-inline-block
1313
button.btn.btn-secondary.float-end.dropdown-toggle data-bs-toggle='dropdown' type='button'
1414
ul.dropdown-menu.dropdown-menu-end role='menu'
1515
li = link_to(t('exercises.index.implement'), implement_exercise_path(@exercise), class: 'dropdown-item') if policy(@exercise).implement?
16-
li = link_to(t('shared.statistics'), statistics_exercise_path(@exercise), 'data-turbo': 'false', class: 'dropdown-item') if policy(@exercise).statistics?
16+
li = link_to(t('shared.statistics'), statistics_exercise_path(@exercise), data: {turbo: false}, class: 'dropdown-item') if policy(@exercise).statistics?
1717
li = link_to(UserExerciseFeedback.model_name.human(count: :other), feedback_exercise_path(@exercise), class: 'dropdown-item') if policy(@exercise).feedback?
1818
li = link_to(RequestForComment.model_name.human(count: :other), exercise_request_for_comments_path(@exercise), class: 'dropdown-item') if policy(@exercise).rfcs_for_exercise?
1919
li = link_to(ProgrammingGroup.model_name.human(count: :other), exercise_programming_groups_path(@exercise), class: 'dropdown-item') if policy(@exercise).programming_groups_for_exercise?
2020
li = button_to(t('shared.destroy'), @exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(@exercise).destroy?
2121
li = button_to(t('exercises.index.clone'), clone_exercise_path(@exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post, class: 'dropdown-item') if policy(@exercise).clone?
22-
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id': @exercise.id, 'bs-toggle': 'modal', 'bs-target': '#transfer-modal'}) if policy(@exercise).export_external_confirm?
22+
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {exercise_id: @exercise.id, bs_toggle: 'modal', bs_target: '#transfer-modal'}) if policy(@exercise).export_external_confirm?
2323
li = link_to(t('exercises.download_proforma.label'), download_proforma_exercise_path(@exercise), class: 'dropdown-item', target: '_blank', rel: 'noopener noreferrer') if policy(@exercise).download_proforma?
2424

2525
= row(label: 'exercise.title', value: @exercise.title)

0 commit comments

Comments
 (0)