diff --git a/app/views/admin/dashboard/show.html.slim b/app/views/admin/dashboard/show.html.slim index 9b96bb57..d430fddf 100644 --- a/app/views/admin/dashboard/show.html.slim +++ b/app/views/admin/dashboard/show.html.slim @@ -9,16 +9,16 @@ h1 = t('breadcrumbs.dashboard.show') h2 Version -div.mb-4 +.mb-4 = application_name - =< t("admin.dashboard.show.release") + =< t('admin.dashboard.show.release') | : pre = Sentry.configuration.release - if Runner.management_active? - div.mb-4 + .mb-4 = Runner.strategy_class.name.demodulize - =< t("admin.dashboard.show.release") + =< t('admin.dashboard.show.release') | : pre = Admin::DashboardHelper.runner_management_release diff --git a/app/views/application/_breadcrumbs_and_title.html.slim b/app/views/application/_breadcrumbs_and_title.html.slim index 88008941..33a8d9d4 100644 --- a/app/views/application/_breadcrumbs_and_title.html.slim +++ b/app/views/application/_breadcrumbs_and_title.html.slim @@ -1,4 +1,4 @@ -- model = controller_path.classify.constantize rescue nil +- model = controller_path.classify.constantize rescue nil # rubocop:disable Style/RescueModifier - if model - object = model.find_by(id: params[:id]) - if (parent_model = model.try(:parent_resource)) @@ -26,7 +26,7 @@ - active_action = t("breadcrumbs.#{controller_name}.#{params[:action]}") -- title = "#{application_name}" +- title = application_name.to_s - title = "#{active_action} - #{title}" unless %w[index show].include? params[:action] - content_for :breadcrumbs do .container.mb-4 diff --git a/app/views/application/_color_mode_selector.html.slim b/app/views/application/_color_mode_selector.html.slim index 8b93e512..da4f22ca 100644 --- a/app/views/application/_color_mode_selector.html.slim +++ b/app/views/application/_color_mode_selector.html.slim @@ -4,14 +4,14 @@ li.nav-item.dropdown span.caret ul.dropdown-menu.p-0.mt-1 role='menu' li - button.dropdown-item.d-flex.align-items-center data={ 'bs-theme-value': 'light' } + button.dropdown-item.d-flex.align-items-center data={'bs-theme-value': 'light'} i.fa-fw.fa-solid.fa-sun = t('shared.color_mode.light') li - button.dropdown-item.d-flex.align-items-center data={ 'bs-theme-value': 'dark' } + button.dropdown-item.d-flex.align-items-center data={'bs-theme-value': 'dark'} i.fa-fw.fa-solid.fa-moon = t('shared.color_mode.dark') li - button.dropdown-item.d-flex.align-items-center data={ 'bs-theme-value': 'auto' } + button.dropdown-item.d-flex.align-items-center data={'bs-theme-value': 'auto'} i.fa-fw.fa-solid.fa-wand-magic-sparkles = t('shared.color_mode.auto') diff --git a/app/views/application/_flash.html.slim b/app/views/application/_flash.html.slim index b3c74f6b..c8a0c6a9 100644 --- a/app/views/application/_flash.html.slim +++ b/app/views/application/_flash.html.slim @@ -2,6 +2,6 @@ #flash.container.fixed_error_messages data-message-failure=t('shared.message_failure') data-websocket-failure=t('shared.websocket_failure') - ApplicationController._flash_types.each do |severity| - flash_mapping = {alert: :warning, notice: :success} - div.alert.flash class="alert-#{flash_mapping.fetch(severity, severity)} alert-dismissible fade show" + .alert.flash class="alert-#{flash_mapping.fetch(severity, severity)} alert-dismissible fade show" p.mb-0 id="flash-#{severity}" == flash[severity] - button.btn-close type="button" data-bs-dismiss="alert" aria-label="Close" + button.btn-close type='button' data-bs-dismiss='alert' aria-label='Close' diff --git a/app/views/application/_locale_selector.html.slim b/app/views/application/_locale_selector.html.slim index a6332186..3f429b61 100644 --- a/app/views/application/_locale_selector.html.slim +++ b/app/views/application/_locale_selector.html.slim @@ -3,5 +3,5 @@ li.nav-item.dropdown = t("locales.#{I18n.locale}") span.caret ul.dropdown-menu.p-0.mt-1 role='menu' - - I18n.available_locales.sort_by { |locale| t("locales.#{locale}") }.each do |locale| - li = link_to(t("locales.#{locale}"), AuthenticatedUrlHelper.add_query_parameters(request.url, locale: locale), 'data-turbolinks' => "false", class: 'dropdown-item') + - I18n.available_locales.sort_by {|locale| t("locales.#{locale}") }.each do |locale| + li = link_to(t("locales.#{locale}"), AuthenticatedUrlHelper.add_query_parameters(request.url, locale:), 'data-turbolinks': 'false', class: 'dropdown-item') diff --git a/app/views/application/_navigation.html.slim b/app/views/application/_navigation.html.slim index 926cf087..ace9b2d8 100644 --- a/app/views/application/_navigation.html.slim +++ b/app/views/application/_navigation.html.slim @@ -1,4 +1,4 @@ -- if current_user.try(:admin?) or current_user.try(:teacher?) +- if current_user.try(:admin?) || current_user.try(:teacher?) ul.nav.navbar-nav li.nav-item.dropdown a.nav-link.dropdown-toggle.mx-3 data-bs-toggle='dropdown' href='#' @@ -6,8 +6,8 @@ span.caret ul.dropdown-menu.p-0.mt-1 role='menu' - if current_user.admin? - li = link_to(t('breadcrumbs.dashboard.show'), admin_dashboard_path, class: 'dropdown-item', 'data-turbolinks' => "false") if policy([:admin, :dashboard]).show? - li = link_to(t('breadcrumbs.rails_admin.show'), rails_admin.dashboard_path, class: 'dropdown-item', 'data-turbolinks' => "false") if policy([:admin, :dashboard]).show? + li = link_to(t('breadcrumbs.dashboard.show'), admin_dashboard_path, class: 'dropdown-item', 'data-turbolinks': 'false') if policy(%i[admin dashboard]).show? + li = link_to(t('breadcrumbs.rails_admin.show'), rails_admin.dashboard_path, class: 'dropdown-item', 'data-turbolinks': 'false') if policy(%i[admin dashboard]).show? li = link_to(t('breadcrumbs.statistics.show'), statistics_path, class: 'dropdown-item') if policy(:statistics).show? li.dropdown-divider role='separator' = render('navigation_submenu', title: t('activerecord.models.exercise.other'), diff --git a/app/views/application/_navigation_submenu.html.slim b/app/views/application/_navigation_submenu.html.slim index fa66d605..3021e6b3 100644 --- a/app/views/application/_navigation_submenu.html.slim +++ b/app/views/application/_navigation_submenu.html.slim @@ -1,7 +1,7 @@ -- if models.any? { |model| policy(model).index? } +- if models.any? {|model| policy(model).index? } li.dropdown-submenu - - link = link.nil? ? "#" : link - a.dropdown-item.dropdown-toggle href=link data-bs-toggle="dropdown" = title + - link = '#' if link.nil? + a.dropdown-item.dropdown-toggle href=link data-bs-toggle='dropdown' = title ul.dropdown-menu.p-0 - models.each do |model| - = render('navigation_collection_link', model: model, cached: true) + = render('navigation_collection_link', model:, cached: true) diff --git a/app/views/application/_session.html.slim b/app/views/application/_session.html.slim index 815c09fd..9af9dd59 100644 --- a/app/views/application/_session.html.slim +++ b/app/views/application/_session.html.slim @@ -8,8 +8,8 @@ li = link_to(t('request_for_comments.index.all'), request_for_comments_path, class: 'dropdown-item') if policy(:request_for_comment).index? li = link_to(t('request_for_comments.index.my_rfc_activity'), my_rfc_activity_path, class: 'dropdown-item') li = link_to(t('request_for_comments.index.my_comment_requests'), my_request_for_comments_path, class: 'dropdown-item') - - if current_user.try(:admin?) or current_user.try(:teacher?) or current_user.try(:internal_user?) - li = link_to(t('consumers.show.link'), current_user.consumer, class: 'dropdown-item') if current_user.consumer and policy(current_user.consumer).show? + - if current_user.try(:admin?) || current_user.try(:teacher?) || current_user.try(:internal_user?) + li = link_to(t('consumers.show.link'), current_user.consumer, class: 'dropdown-item') if current_user.consumer && policy(current_user.consumer).show? li = link_to(t('internal_users.show.link'), current_user, class: 'dropdown-item') if policy(current_user).show? li = link_to(t('sessions.destroy.link'), sign_out_path, method: :delete, class: 'dropdown-item') - else diff --git a/app/views/application/help.html.slim b/app/views/application/help.html.slim index e784d05b..8274036e 100644 --- a/app/views/application/help.html.slim +++ b/app/views/application/help.html.slim @@ -1,8 +1,8 @@ - unless local_assigns[:modal] h1 = t('shared.help.headline') -- if local_assigns.has_key?(:execution_environment) - h2 = t('shared.help.execution_environment_specific_help', execution_environment: execution_environment) +- if local_assigns.key?(:execution_environment) + h2 = t('shared.help.execution_environment_specific_help', execution_environment:) = render_markdown(execution_environment.help) - content_for :modal_footer do diff --git a/app/views/application/welcome.html.slim b/app/views/application/welcome.html.slim index 0eee6f95..f530971f 100644 --- a/app/views/application/welcome.html.slim +++ b/app/views/application/welcome.html.slim @@ -1,8 +1,8 @@ -h1 = t('.title', application_name: application_name) +h1 = t('.title', application_name:) -- if current_user.try(:admin?) or current_user.try(:teacher?) +- if current_user.try(:admin?) || current_user.try(:teacher?) p = t('.text_signed_in_as_internal_user', user_name: current_user.displayname) - elsif current_user.try(:external_user?) - p = t('.text_signed_in_as_external_user', application_name: application_name) + p = t('.text_signed_in_as_external_user', application_name:) - else - p == t('.text_signed_out', application_name: application_name, sign_in_path: sign_in_path) + p == t('.text_signed_out', application_name:, sign_in_path:) diff --git a/app/views/code_ocean/files/_form.html.slim b/app/views/code_ocean/files/_form.html.slim index f1a556cf..20e511d9 100644 --- a/app/views/code_ocean/files/_form.html.slim +++ b/app/views/code_ocean/files/_form.html.slim @@ -14,7 +14,7 @@ - if FileTemplate.any? .mb-3 = f.label(:file_template_id, t('activerecord.attributes.file.file_template_id'), class: 'form-label') - = f.collection_select(:file_template_id, FileTemplate.all.order(:name), :id, :name, {:include_blank => true}, class: 'form-control') + = f.collection_select(:file_template_id, FileTemplate.order(:name), :id, :name, {include_blank: true}, class: 'form-control') = f.hidden_field(:context_id) .d-none#noTemplateLabel data-text=t('file_template.no_template_label') - .actions = render('shared/submit_button', f: f, object: CodeOcean::File.new) + .actions = render('shared/submit_button', f:, object: CodeOcean::File.new) diff --git a/app/views/codeharbor_links/_form.html.slim b/app/views/codeharbor_links/_form.html.slim index 6dd6cdb5..30c35916 100644 --- a/app/views/codeharbor_links/_form.html.slim +++ b/app/views/codeharbor_links/_form.html.slim @@ -13,7 +13,6 @@ .input-group-btn = button_tag t('codeharbor_link.generate'), type: 'button', class: 'generate-api_key btn btn-default' .actions - = render('shared/submit_button', f: f, object: @codeharbor_link) + = render('shared/submit_button', f:, object: @codeharbor_link) - if @codeharbor_link.persisted? = link_to(t('codeharbor_link.delete'), codeharbor_link_path(@codeharbor_link), data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'btn btn-danger float-end') - diff --git a/app/views/community_solutions/_form.html.slim b/app/views/community_solutions/_form.html.slim index 7f59b4f2..8aab047c 100644 --- a/app/views/community_solutions/_form.html.slim +++ b/app/views/community_solutions/_form.html.slim @@ -1,7 +1,7 @@ .exercise.clearfix div - h1 id="exercise-headline" - i id="description-symbol" class=(@embed_options[:collapse_exercise_description] ? 'fa-solid fa-chevron-right' : 'fa-solid fa-chevron-down') + h1#exercise-headline + i#description-symbol class=(@embed_options[:collapse_exercise_description] ? 'fa-solid fa-chevron-right' : 'fa-solid fa-chevron-down') => @community_solution.model_name.human(count: 1) = @community_solution.exercise.title @@ -20,7 +20,7 @@ hr = render_markdown(@community_solution.exercise.description) - a#toggle href="#" data-show=t('shared.show') data-hide=t('shared.hide') + a#toggle href='#' data-show=t('shared.show') data-hide=t('shared.hide') - if @embed_options[:collapse_exercise_description] = t('shared.show') - else @@ -37,12 +37,12 @@ .card-body.pt-0.pe-0.ps-1.pb-1 #files data-entries=FileTree.new(@files).to_js_tree_in_json div class=(@community_solution.exercise.hide_file_tree ? 'col-sm-12' : 'col-sm-9') - div.editor-col.col.p-0 id='frames' + .editor-col.col.p-0#frames - @files.each do |file| - = render('exercises/editor_frame', exercise: @community_solution.exercise, file: file) + = render('exercises/editor_frame', exercise: @community_solution.exercise, file:) .col-xl-6.container-fluid - div.bg-contrast.h-100.float-start.row style="width: 1px" + .bg-contrast.h-100.float-start.row style="width: 1px" div h4 = t('community_solutions.your_submission') @@ -54,11 +54,11 @@ .card-body.pt-0.pe-0.ps-1.pb-1 #own-files data-entries=FileTree.new(@own_files).to_js_tree_in_json div class=(@community_solution.exercise.hide_file_tree ? 'col-sm-12' : 'col-sm-9') - div.editor-col.col.p-0 id='own-frames' + .editor-col.col.p-0#own-frames - @own_files.each do |file| - = render('exercises/editor_frame', exercise: @community_solution.exercise, file: file, own_solution: true) + = render('exercises/editor_frame', exercise: @community_solution.exercise, file:, own_solution: true) #statusbar.visible.mt-2 style="height: 5em" p.text-center = render('exercises/editor_button', classes: 'btn-lg btn-success ms-5 me-3', data: {'data-url': community_solution_path(@community_solution), 'data-http-method': 'PUT', 'data-cause': 'change-community-solution', 'data-exercise-id': @community_solution.exercise.id}, icon: 'fa-solid fa-paper-plane', id: 'submit', label: t('community_solutions.change_community_solution')) = render('exercises/editor_button', classes: 'btn-lg btn-secondary ms-5', data: {'data-url': community_solution_path(@community_solution), 'data-http-method': 'PUT', 'data-cause': 'accept-community-solution', 'data-exercise-id': @community_solution.exercise.id}, icon: 'fa-solid fa-check', id: 'accept', label: t('community_solutions.accept_community_solution')) - button style="display:none" id="autosave" data-url=community_solution_path(@community_solution) data-http-method='PUT' data-cause='autosave-community-solution' data-exercise-id=@community_solution.exercise.id + button#autosave style="display:none" data-url=community_solution_path(@community_solution) data-http-method='PUT' data-cause='autosave-community-solution' data-exercise-id=@community_solution.exercise.id diff --git a/app/views/consumers/_form.html.slim b/app/views/consumers/_form.html.slim index 65a11ae1..9cb292dc 100644 --- a/app/views/consumers/_form.html.slim +++ b/app/views/consumers/_form.html.slim @@ -11,5 +11,5 @@ = f.text_field(:oauth_secret, class: 'form-control', required: true) .mb-3 = f.label(:rfc_visibility, class: 'form-label') - = f.collection_select(:rfc_visibility, Consumer.rfc_visibilities.map { |rfc_visibility, _id| [t("activerecord.attributes.consumer.rfc_visibility_type.#{rfc_visibility}"), rfc_visibility] }, :second, :first, {}, class: 'form-control form-control-sm') - .actions = render('shared/submit_button', f: f, object: @consumer) + = f.collection_select(:rfc_visibility, Consumer.rfc_visibilities.map {|rfc_visibility, _id| [t("activerecord.attributes.consumer.rfc_visibility_type.#{rfc_visibility}"), rfc_visibility] }, :second, :first, {}, class: 'form-control form-control-sm') + .actions = render('shared/submit_button', f:, object: @consumer) diff --git a/app/views/error_template_attributes/_form.html.slim b/app/views/error_template_attributes/_form.html.slim index e747a922..a532d2f6 100644 --- a/app/views/error_template_attributes/_form.html.slim +++ b/app/views/error_template_attributes/_form.html.slim @@ -14,4 +14,4 @@ label.form-check-label = f.check_box(:important, class: 'form-check-input') = t('activerecord.attributes.error_template_attribute.important') - .actions = render('shared/submit_button', f: f, object: @error_template_attribute) + .actions = render('shared/submit_button', f:, object: @error_template_attribute) diff --git a/app/views/error_template_attributes/index.html.slim b/app/views/error_template_attributes/index.html.slim index a695fded..608568ee 100644 --- a/app/views/error_template_attributes/index.html.slim +++ b/app/views/error_template_attributes/index.html.slim @@ -1,7 +1,7 @@ h1 = ErrorTemplateAttribute.model_name.human(count: 2) .table-responsive - table.table class="#{@error_template_attributes.present? ? 'sortable' : ''}" + table.table class=(@error_template_attributes.present? ? 'sortable' : '') thead tr th @@ -14,9 +14,9 @@ h1 = ErrorTemplateAttribute.model_name.human(count: 2) tr td - if error_template_attribute.important - span class="fa-solid fa-star" aria-hidden="true" + span.fa-solid.fa-star aria-hidden='true' - else - span class="fa-regular fa-star" aria-hidden="true" + span.fa-regular.fa-star aria-hidden='true' td = link_to_if(policy(error_template_attribute).show?, error_template_attribute.key, error_template_attribute) td = error_template_attribute.description td diff --git a/app/views/error_template_attributes/show.html.slim b/app/views/error_template_attributes/show.html.slim index 5d6ef58b..b8922515 100644 --- a/app/views/error_template_attributes/show.html.slim +++ b/app/views/error_template_attributes/show.html.slim @@ -2,10 +2,10 @@ h1 = @error_template_attribute = render('shared/edit_button', object: @error_template_attribute) -- [:key, :description].each do |attribute| +- %i[key description].each do |attribute| = row(label: "error_template_attribute.#{attribute}", value: @error_template_attribute.send(attribute)) -= row(label: "error_template_attribute.key") do += row(label: 'error_template_attribute.key') do code = @error_template_attribute.key -= row(label: "error_template_attribute.important", value: @error_template_attribute.important) += row(label: 'error_template_attribute.important', value: @error_template_attribute.important) // todo: used by diff --git a/app/views/error_templates/_form.html.slim b/app/views/error_templates/_form.html.slim index 80784d3a..bbf773f0 100644 --- a/app/views/error_templates/_form.html.slim +++ b/app/views/error_templates/_form.html.slim @@ -5,7 +5,7 @@ = f.text_field(:name, class: 'form-control', required: true) .mb-3 = f.label(:execution_environment_id, class: 'form-label') - = f.collection_select(:execution_environment_id, ExecutionEnvironment.all.order(:name), :id, :name, {include_blank: false}, class: 'form-control') + = f.collection_select(:execution_environment_id, ExecutionEnvironment.order(:name), :id, :name, {include_blank: false}, class: 'form-control') .mb-3 = f.label(:signature, class: 'form-label') = f.text_field(:signature, class: 'form-control') @@ -17,4 +17,4 @@ = f.label(:hint, class: 'form-label') = f.text_field(:hint, class: 'form-control') .help-block.form-text == t('error_templates.hints.hint_templates') - .actions = render('shared/submit_button', f: f, object: @error_template) + .actions = render('shared/submit_button', f:, object: @error_template) diff --git a/app/views/error_templates/index.html.slim b/app/views/error_templates/index.html.slim index a4765980..9b2b9629 100644 --- a/app/views/error_templates/index.html.slim +++ b/app/views/error_templates/index.html.slim @@ -1,7 +1,7 @@ h1 = ErrorTemplate.model_name.human(count: 2) .table-responsive - table.table class="#{@error_templates.present? ? 'sortable' : ''}" + table.table class=(@error_templates.present? ? 'sortable' : '') thead tr th = t('activerecord.attributes.error_template.name') diff --git a/app/views/error_templates/show.html.slim b/app/views/error_templates/show.html.slim index bc0d886c..c27907c8 100644 --- a/app/views/error_templates/show.html.slim +++ b/app/views/error_templates/show.html.slim @@ -4,16 +4,16 @@ h1 = row(label: 'error_template.name', value: @error_template.name) = row(label: 'exercise.execution_environment', value: link_to_if(policy(@error_template.execution_environment).show?, @error_template.execution_environment)) -= row(label: "error_template.signature") do += row(label: 'error_template.signature') do code = @error_template.signature -- [:description, :hint].each do |attribute| +- %i[description hint].each do |attribute| = row(label: "error_template.#{attribute}", value: @error_template.send(attribute)) h2.mt-4 = t 'error_templates.attributes' .table-responsive - table.table class="#{@error_template.error_template_attributes.present? ? 'sortable' : ''}" + table.table class=(@error_template.error_template_attributes.present? ? 'sortable' : '') thead tr th @@ -26,16 +26,16 @@ h2.mt-4 tr td - if attribute.important - span class="fa-solid fa-star" aria-hidden="true" + span.fa-solid.fa-star aria-hidden='true' - else - span class="fa-regular fa-star" aria-hidden="true" + span.fa-regular.fa-star aria-hidden='true' td = link_to_if(policy(attribute).show?, attribute.key, attribute) td = attribute.description td code = attribute.regex td = link_to(t('shared.show'), attribute) if policy(attribute).show? td = link_to(t('shared.edit'), edit_error_template_attribute_path(attribute)) if policy(attribute).edit? - td = link_to(t('shared.destroy'), attribute_error_template_url(:error_template_attribute_id => attribute.id), :method => :delete) if policy(attribute).destroy? + td = link_to(t('shared.destroy'), attribute_error_template_url(error_template_attribute_id: attribute.id), method: :delete) if policy(attribute).destroy? #add-attribute = collection_select({}, :error_template_attribute_id, diff --git a/app/views/execution_environments/_form.html.slim b/app/views/execution_environments/_form.html.slim index 34d8b2b4..c2391300 100644 --- a/app/views/execution_environments/_form.html.slim +++ b/app/views/execution_environments/_form.html.slim @@ -5,7 +5,7 @@ = f.text_field(:name, class: 'form-control', required: true) .mb-3 = f.label(:file_type_id, class: 'form-label') - = f.collection_select(:file_type_id, FileType.all.order(:name), :id, :name, {include_blank: true}, class: 'form-control') + = f.collection_select(:file_type_id, FileType.order(:name), :id, :name, {include_blank: true}, class: 'form-control') .mb-3 = f.label(:docker_image, class: 'form-label') |   @@ -53,4 +53,4 @@ = f.label(:help, class: 'form-label') = f.hidden_field(:help) .form-control.markdown - .actions = render('shared/submit_button', f: f, object: @execution_environment) + .actions = render('shared/submit_button', f:, object: @execution_environment) diff --git a/app/views/execution_environments/index.html.slim b/app/views/execution_environments/index.html.slim index 58fa7742..cdaa17e3 100644 --- a/app/views/execution_environments/index.html.slim +++ b/app/views/execution_environments/index.html.slim @@ -1,7 +1,7 @@ h1.d-inline-block = ExecutionEnvironment.model_name.human(count: 2) - if Runner.management_active? && policy(ExecutionEnvironment).sync_all_to_runner_management? - = button_to( { action: :sync_all_to_runner_management }, { form_class: 'float-end mb-2', class: 'btn btn-success' }) + = button_to({action: :sync_all_to_runner_management}, {form_class: 'float-end mb-2', class: 'btn btn-success'}) i.fa-solid.fa-upload = t('execution_environments.index.synchronize_all.button') diff --git a/app/views/execution_environments/shell.html.slim b/app/views/execution_environments/shell.html.slim index bb7416cc..8c71b0bf 100644 --- a/app/views/execution_environments/shell.html.slim +++ b/app/views/execution_environments/shell.html.slim @@ -1,6 +1,6 @@ h1 = @execution_environment -#shell data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @execution_environment.permitted_execution_time) data-message-out-of-memory=t('exercises.editor.out_of_memory', memory_limit: @execution_environment.memory_limit) data-id=@execution_environment.id +#shell data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @execution_environment.permitted_execution_time) data-message-out-of-memory=t('exercises.editor.out_of_memory', memory_limit: @execution_environment.memory_limit) data-id=@execution_environment.id label.form-label for='command' = t('execution_environments.shell.command') .input-group.mb-3 .input-group-text.form-switch.ps-5 class=('text-body-secondary' unless @execution_environment.privileged_execution?) @@ -9,14 +9,14 @@ h1 = @execution_environment input#command.form-control type='text' .card.mb-3 - .card-header#download-files role="tab" - a.file-heading.collapsed.d-flex.justify-content-between.align-items-center data-bs-toggle="collapse" href="#collapse_files" aria-expanded="false" - div.clearfix role="button" - i.fa-solid aria-hidden="true" + .card-header#download-files role='tab' + a.file-heading.collapsed.d-flex.justify-content-between.align-items-center data-bs-toggle='collapse' href='#collapse_files' aria-expanded='false' + .clearfix role='button' + i.fa-solid aria-hidden='true' span = t('execution_environments.shell.file_tree.headline') div - = render('exercises/editor_button', classes: 'btn-default btn-sm', data: {:'data-bs-toggle' => 'tooltip', :'data-url' => list_files_in_execution_environment_path(@execution_environment)}, icon: 'fa-solid fa-arrows-rotate', id: 'reload-files', label: t('execution_environments.shell.file_tree.reload'), title: t('execution_environments.shell.file_tree.reload_tooltip')) - .card-collapse.collapse id="collapse_files" role="tabpanel" + = render('exercises/editor_button', classes: 'btn-default btn-sm', data: {'data-bs-toggle': 'tooltip', 'data-url': list_files_in_execution_environment_path(@execution_environment)}, icon: 'fa-solid fa-arrows-rotate', id: 'reload-files', label: t('execution_environments.shell.file_tree.reload'), title: t('execution_environments.shell.file_tree.reload_tooltip')) + .card-collapse.collapse#collapse_files role='tabpanel' .card-body.pt-0.pe-0.ps-1.pb-1 #download-file-tree.justify-content-center.d-flex.my-3 span.mx-1 = t('execution_environments.shell.file_tree.empty') @@ -26,5 +26,5 @@ h1 = @execution_environment i.fa-solid.fa-info span.ms-2 = t('execution_environments.shell.file_tree.root_notice') - pre#output data-message-no-output=t('exercises.implement.no_output', timestamp: l(Time.now, format: :short)) + pre#output data-message-no-output=t('exercises.implement.no_output', timestamp: l(Time.zone.now, format: :short)) p = t('exercises.implement.no_output_yet') diff --git a/app/views/execution_environments/show.html.slim b/app/views/execution_environments/show.html.slim index 31b506b6..d70f13ab 100644 --- a/app/views/execution_environments/show.html.slim +++ b/app/views/execution_environments/show.html.slim @@ -5,15 +5,15 @@ h1.d-inline-block = @execution_environment ul.dropdown-menu.dropdown-menu-end role='menu' li = link_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? li = link_to(t('execution_environments.index.shell'), shell_execution_environment_path(@execution_environment), class: 'dropdown-item') if policy(@execution_environment).shell? - li = link_to(t('shared.statistics'), statistics_execution_environment_path(@execution_environment), 'data-turbolinks' => "false", class: 'dropdown-item') if policy(@execution_environment).statistics? + li = link_to(t('shared.statistics'), statistics_execution_environment_path(@execution_environment), 'data-turbolinks': 'false', class: 'dropdown-item') if policy(@execution_environment).statistics? li = link_to(t('shared.destroy'), @execution_environment, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(@execution_environment).destroy? = row(label: 'execution_environment.name', value: @execution_environment.name) = row(label: 'execution_environment.user', value: link_to_if(policy(@execution_environment.author).show?, @execution_environment.author, @execution_environment.author)) = row(label: 'execution_environment.file_type', value: @execution_environment.file_type.present? ? link_to(@execution_environment.file_type, @execution_environment.file_type) : nil) -- [:docker_image, :exposed_ports_list, :memory_limit, :cpu_limit, :network_enabled, :privileged_execution, :permitted_execution_time, :pool_size].each do |attribute| +- %i[docker_image exposed_ports_list memory_limit cpu_limit network_enabled privileged_execution permitted_execution_time pool_size].each do |attribute| = row(label: "execution_environment.#{attribute}", value: @execution_environment.send(attribute)) -- [:run_command, :test_command].each do |attribute| +- %i[run_command test_command].each do |attribute| = row(label: "execution_environment.#{attribute}") do code = @execution_environment.send(attribute) = row(label: 'execution_environment.testing_framework', value: @testing_framework_adapter.try(:framework_name)) diff --git a/app/views/execution_environments/statistics.html.slim b/app/views/execution_environments/statistics.html.slim index 43795d57..e9887827 100644 --- a/app/views/execution_environments/statistics.html.slim +++ b/app/views/execution_environments/statistics.html.slim @@ -1,7 +1,7 @@ h1 = @execution_environment .table-responsive - table.table.table-striped class="#{@execution_environment.present? ? 'sortable' : ''}" + table.table.table-striped class=(@execution_environment.present? ? 'sortable' : '') thead tr - ['.exercise', '.users_and_programming_groups', '.score', '.maximum_score', '.stddev_score', '.percentage_correct', '.runs', '.worktime', '.stddev_worktime'].each do |title| @@ -9,17 +9,17 @@ h1 = @execution_environment tbody - @execution_environment.exercises.each do |exercise| - us = contributor_statistics[exercise.id] - - if not us then us = {"contributors" => 0, "average_score" => 0.0, "maximum_score" => 0, "stddev_score" => 0.0, "percent_correct" => nil, "average_submission_count" => 0} + - us ||= {'contributors' => 0, 'average_score' => 0.0, 'maximum_score' => 0, 'stddev_score' => 0.0, 'percent_correct' => nil, 'average_submission_count' => 0} - wts = working_time_statistics[exercise.id] - - if wts then average_time = wts["average_time"] else 0 - - if wts then stddev_time = wts["stddev_time"] else 0 + - if wts then average_time = wts['average_time'] else 0 # rubocop:disable Lint/ElseLayout + - if wts then stddev_time = wts['stddev_time'] else 0 # rubocop:disable Lint/ElseLayout tr - td = link_to_if policy(exercise).statistics?, exercise.title, controller: "exercises", action: "statistics", id: exercise.id, 'data-turbolinks' => "false" - td = us["contributors"] - td = us["average_score"].to_f.round(4) - td = us["maximum_score"].to_f.round(2) - td = us["stddev_score"].to_f.round(4) - td = (us["percent_correct"].to_f or 0).round(4) - td = us["average_submission_count"].to_f.round(2) + td = link_to_if policy(exercise).statistics?, exercise.title, controller: 'exercises', action: 'statistics', id: exercise.id, 'data-turbolinks': 'false' + td = us['contributors'] + td = us['average_score'].to_f.round(4) + td = us['maximum_score'].to_f.round(2) + td = us['stddev_score'].to_f.round(4) + td = (us['percent_correct'].to_f || 0).round(4) + td = us['average_submission_count'].to_f.round(2) td = average_time td = stddev_time diff --git a/app/views/exercise_collections/_form.html.slim b/app/views/exercise_collections/_form.html.slim index 233aca3a..96ca60b5 100644 --- a/app/views/exercise_collections/_form.html.slim +++ b/app/views/exercise_collections/_form.html.slim @@ -24,7 +24,7 @@ td span.fa-solid.fa-bars td = item.exercise.title - td = link_to(t('shared.show'), item.exercise, 'data-turbolinks' => "false") + td = link_to(t('shared.show'), item.exercise, 'data-turbolinks': 'false') td a.remove-exercise href='#' = t('shared.destroy') .d-none @@ -33,6 +33,6 @@ button.btn.btn-outline-primary type='button' data-bs-toggle='modal' data-bs-target='#add-exercise-modal' = t('exercise_collections.form.add_exercises') button.btn.btn-secondary#sort-button type='button' = t('exercise_collections.form.sort_by_title') - .actions = render('shared/submit_button', f: f, object: @exercise_collection) + .actions = render('shared/submit_button', f:, object: @exercise_collection) = render('shared/modal', id: 'add-exercise-modal', title: t('.add_exercises'), template: 'exercise_collections/_add_exercise_modal') diff --git a/app/views/exercise_collections/show.html.slim b/app/views/exercise_collections/show.html.slim index 592935d4..54a5e0f2 100644 --- a/app/views/exercise_collections/show.html.slim +++ b/app/views/exercise_collections/show.html.slim @@ -18,11 +18,11 @@ h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises') th = t('activerecord.attributes.exercise.user') th = t('shared.actions') tbody - - @exercise_collection.items.sort_by{|item| item.position}.each do |exercise_collection_item| + - @exercise_collection.items.sort_by(&:position).each do |exercise_collection_item| - exercise = exercise_collection_item.exercise tr td = exercise_collection_item.position td = link_to_if(policy(exercise).show?, exercise.title, exercise) td = link_to_if(exercise.execution_environment && policy(exercise.execution_environment).show?, exercise.execution_environment, exercise.execution_environment) td = link_to_if(exercise.user && policy(exercise.user).show?, exercise.user.displayname, exercise.user) - td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbolinks' => "false") if policy(exercise).statistics? + td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbolinks': 'false') if policy(exercise).statistics? diff --git a/app/views/exercise_collections/statistics.html.slim b/app/views/exercise_collections/statistics.html.slim index 2269c315..e3d14c76 100644 --- a/app/views/exercise_collections/statistics.html.slim +++ b/app/views/exercise_collections/statistics.html.slim @@ -13,7 +13,7 @@ h1 = @exercise_collection / Only before specific date: date = DateTime.parse("2015-01-01 00:00:00.000000") ; @exercise_collection.exercises.joins(:submissions).where(["submissions.created_at > ?", date]).group("submissions.contributor_id", "submissions.contributor_type").count.count / Only with specific cause: @exercise_collection.exercises.joins(:submissions).where("submissions.cause" == 'assess').count -= row(label: 'exercises.statistics.average_worktime', value: @exercise_collection.average_working_time.round(3).to_s + 's') += row(label: 'exercises.statistics.average_worktime', value: "#{@exercise_collection.average_working_time.round(3)}s") #graph #data.d-none(data-working-times=ActiveSupport::JSON.encode(@exercise_collection.collection_statistics) data-average-working-time=@exercise_collection.average_working_time) @@ -28,7 +28,7 @@ h1 = @exercise_collection h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises') .table-responsive#exercise-list - table.table class="#{@exercise_collection.items.present? ? 'sortable' : ''}" + table.table class=(@exercise_collection.items.present? ? 'sortable' : '') thead tr th = '#' @@ -39,7 +39,7 @@ h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises') th = t('activerecord.attributes.exercise.average_score_percentage') th = t('shared.actions') tbody - - @exercise_collection.items.sort_by{|item| item.position}.each do |exercise_collection_item| + - @exercise_collection.items.sort_by(&:position).each do |exercise_collection_item| - exercise = exercise_collection_item.exercise tr td = exercise_collection_item.position @@ -48,4 +48,4 @@ h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises') td = exercise.submissions.send(:final).distinct.count(:contributor_id) td = exercise.finishers_percentage td = exercise.average_percentage - td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbolinks' => "false") if policy(exercise).statistics? + td = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbolinks': 'false') if policy(exercise).statistics? diff --git a/app/views/exercises/_code_field.html.slim b/app/views/exercises/_code_field.html.slim index 1945178a..a52aa4ee 100644 --- a/app/views/exercises/_code_field.html.slim +++ b/app/views/exercises/_code_field.html.slim @@ -1,7 +1,7 @@ .mb-3 = form.label(attribute, label, class: 'form-label') - = form.text_area(attribute, class: 'code-field form-control', rows: 16, style: "display:none;") - = render partial: 'editor_edit', locals: { exercise: @exercise } + = form.text_area(attribute, class: 'code-field form-control', rows: 16, style: 'display:none;') + = render partial: 'editor_edit', locals: {exercise: @exercise} .card.border-warning.p-2.my-2 - = form.file_field(attribute, class: 'form-control', style: "display: inline-block;") + = form.file_field(attribute, class: 'form-control', style: 'display: inline-block;') .help-block.form-text = t('exercises.file_form.hints.upload') diff --git a/app/views/exercises/_comment_dialogcontent.html.slim b/app/views/exercises/_comment_dialogcontent.html.slim index 706c8b9e..fad0deda 100644 --- a/app/views/exercises/_comment_dialogcontent.html.slim +++ b/app/views/exercises/_comment_dialogcontent.html.slim @@ -1,5 +1,5 @@ #otherComments - h5 =t('exercises.implement.comment.others') + h5 = t('exercises.implement.comment.others') .container label @@ -7,6 +7,6 @@ label = t('request_for_comments.subscribe_to_author') #myComment.d-grid - h5 =t('exercises.implement.comment.addyours') + h5 = t('exercises.implement.comment.addyours') textarea.form-control - button#addCommentButton.btn.btn-primary(type='button') =t('exercises.implement.comment.addCommentButton') + button#addCommentButton.btn.btn-primary(type='button') = t('exercises.implement.comment.addCommentButton') diff --git a/app/views/exercises/_download_file_tree.html.slim b/app/views/exercises/_download_file_tree.html.slim index 44ed6b52..0f95e1e0 100644 --- a/app/views/exercises/_download_file_tree.html.slim +++ b/app/views/exercises/_download_file_tree.html.slim @@ -1,4 +1,4 @@ -div.enforce-bottom-margin.overflow-scroll.d-none#download-files +.enforce-bottom-margin.overflow-scroll.d-none#download-files .card.border-secondary .card-header.d-flex.justify-content-between.align-items-center.px-0.py-1 .px-2 = t('exercises.download_file_tree.file_root') diff --git a/app/views/exercises/_editor.html.slim b/app/views/exercises/_editor.html.slim index 33eb8e0e..901ba6cc 100644 --- a/app/views/exercises/_editor.html.slim +++ b/app/views/exercises/_editor.html.slim @@ -1,10 +1,10 @@ - external_user_external_id = current_user.respond_to?(:external_id) ? current_user.external_id : '' -- show_break_interventions = @show_break_interventions || "false" -- show_rfc_interventions = @show_rfc_interventions || "false" -- show_tips_interventions = @show_tips_interventions || "false" +- show_break_interventions = @show_break_interventions || 'false' +- show_rfc_interventions = @show_rfc_interventions || 'false' +- show_tips_interventions = @show_tips_interventions || 'false' - hide_rfc_button = @hide_rfc_button || false -#editor.row data-exercise-id=@exercise.id data-message-depleted=t('exercises.editor.depleted') data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-message-out-of-memory=t('exercises.editor.out_of_memory', memory_limit: @exercise.execution_environment.memory_limit) data-submissions-url=submissions_path data-user-external-id=external_user_external_id data-working-times-url=working_times_exercise_path(@exercise) data-intervention-save-url=intervention_exercise_path(@exercise) data-rfc-interventions=show_rfc_interventions data-break-interventions=show_break_interventions data-tips-interventions=show_tips_interventions +#editor.row data-exercise-id=@exercise.id data-message-depleted=t('exercises.editor.depleted') data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-message-out-of-memory=t('exercises.editor.out_of_memory', memory_limit: @exercise.execution_environment.memory_limit) data-submissions-url=submissions_path data-user-external-id=external_user_external_id data-working-times-url=working_times_exercise_path(@exercise) data-intervention-save-url=intervention_exercise_path(@exercise) data-rfc-interventions=show_rfc_interventions data-break-interventions=show_break_interventions data-tips-interventions=show_tips_interventions - unless @embed_options[:hide_sidebar] - additional_classes = 'sidebar-col' - if @tips.blank? @@ -12,24 +12,23 @@ - additional_classes = 'sidebar-col-collapsed' - else - additional_classes = 'sidebar-col w-25' - div id="sidebar" class=additional_classes = render('editor_file_tree', exercise: @exercise, files: @files) + #sidebar class=additional_classes = render('editor_file_tree', exercise: @exercise, files: @files) - - div.editor-col.col.p-0 id='frames' + .editor-col.col.p-0#frames #editor-buttons.btn-group.enforce-bottom-margin = render('editor_button', disabled: true, icon: 'fa-solid fa-ban', id: 'dummy', label: t('exercises.editor.dummy')) = render('editor_button', icon: 'fa-solid fa-desktop', id: 'render', label: t('exercises.editor.render')) unless @embed_options[:hide_run_button] span.flex-grow-1.d-inline-flex#run-stop-button-group data-bs-placement='top' data-bs-toggle='tooltip' data-bs-container='body' title=t('shared.tooltips.shortcut', shortcut: 'ALT + r') - = render('editor_button', data: {:'data-message-failure' => t('exercises.editor.run_failure'), :'data-message-network' => t('exercises.editor.network'), :'data-message-success' => t('exercises.editor.run_success'),}, icon: 'fa-solid fa-play', id: 'run', label: t('exercises.editor.run'), classes: 'w-100 h-100 btn-primary') unless @embed_options[:disable_run] - = render('editor_button', icon: 'fa-solid fa-stop', id: 'stop', label: t('exercises.editor.stop'), classes: 'w-100 h-100 btn-primary') unless @embed_options[:disable_run] - = render('editor_button', data: {:'data-bs-placement' => 'top', :'data-bs-toggle' => 'tooltip', :'data-bs-container' => 'body'}, icon: 'fa-solid fa-rocket', id: 'test', label: t('exercises.editor.test'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + t')) unless @embed_options[:disable_run] - = render('editor_button', data: {:'data-bs-placement' => 'top', :'data-bs-toggle' => 'tooltip', :'data-bs-container' => 'body'}, icon: 'fa-solid fa-trophy', id: 'assess', label: t('exercises.editor.score'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + s')) unless @embed_options[:disable_score] + = render('editor_button', data: {'data-message-failure': t('exercises.editor.run_failure'), 'data-message-network': t('exercises.editor.network'), 'data-message-success': t('exercises.editor.run_success')}, icon: 'fa-solid fa-play', id: 'run', label: t('exercises.editor.run'), classes: 'w-100 h-100 btn-primary') unless @embed_options[:disable_run] + = render('editor_button', icon: 'fa-solid fa-stop', id: 'stop', label: t('exercises.editor.stop'), classes: 'w-100 h-100 btn-primary') unless @embed_options[:disable_run] + = render('editor_button', data: {'data-bs-placement': 'top', 'data-bs-toggle': 'tooltip', 'data-bs-container': 'body'}, icon: 'fa-solid fa-rocket', id: 'test', label: t('exercises.editor.test'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + t')) unless @embed_options[:disable_run] + = render('editor_button', data: {'data-bs-placement': 'top', 'data-bs-toggle': 'tooltip', 'data-bs-container': 'body'}, icon: 'fa-solid fa-trophy', id: 'assess', label: t('exercises.editor.score'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + s')) unless @embed_options[:disable_score] - unless hide_rfc_button - = render('editor_button', data: {:'data-bs-placement' => 'top', :'data-bs-toggle' => 'tooltip', :'data-bs-container' => 'body'}, icon: 'fa-solid fa-comment', id: 'requestComments', label: t('exercises.editor.requestComments'), title: t('exercises.editor.requestCommentsTooltip')) + = render('editor_button', data: {'data-bs-placement': 'top', 'data-bs-toggle': 'tooltip', 'data-bs-container': 'body'}, icon: 'fa-solid fa-comment', id: 'requestComments', label: t('exercises.editor.requestComments'), title: t('exercises.editor.requestCommentsTooltip')) - @files.each do |file| - file.read_only = true if @embed_options[:read_only] - = render('editor_frame', exercise: exercise, file: file) + = render('editor_frame', exercise:, file:) #statusbar.d-flex.justify-content-between div @@ -50,11 +49,11 @@ - if current_contributor.programming_group? span#pg_session = t('exercises.editor.is_offline', name: @programming_partners_name) - = " | " + = ' | ' = t('exercises.editor.lastsaved') - span id="autosave" + span#autosave - = " | " + = ' | ' button#start-over-active-file.p-0.border-0.btn-link.bg-body.text-primary data-message-confirm=t('exercises.editor.confirm_start_over_active_file') data-url=reload_exercise_path(@exercise) i.fa-solid.fa-circle-notch.fa-spin.d-none @@ -62,9 +61,8 @@ = t('exercises.editor.start_over_active_file') - unless @embed_options[:disable_run] && @embed_options[:disable_score] - div id='output_sidebar' class='output-col-collapsed' = render('exercises/editor_output') - + .output-col-collapsed#output_sidebar = render('exercises/editor_output') = render('shared/modal', id: 'comment-modal', title: t('exercises.implement.comment.request'), template: 'exercises/_request_comment_dialogcontent') unless @embed_options[:disable_rfc] = render('shared/modal', id: 'break-intervention-modal', title: t('exercises.implement.break_intervention.title'), template: 'interventions/_break_intervention_modal') unless @embed_options[:disable_interventions] -= render('shared/modal', id: 'tips-intervention-modal', title: t('exercises.implement.tips.heading'), template: 'interventions/_tips_intervention_modal') unless @embed_options[:disable_hints] or @tips.blank? += render('shared/modal', id: 'tips-intervention-modal', title: t('exercises.implement.tips.heading'), template: 'interventions/_tips_intervention_modal') unless @embed_options[:disable_hints] || @tips.blank? diff --git a/app/views/exercises/_editor_button.html.slim b/app/views/exercises/_editor_button.html.slim index c3370f29..03481ee2 100644 --- a/app/views/exercises/_editor_button.html.slim +++ b/app/views/exercises/_editor_button.html.slim @@ -1,4 +1,4 @@ button.btn class=local_assigns.fetch(:classes, 'btn-primary') *local_assigns.fetch(:data, {}) disabled=local_assigns.fetch(:disabled, false) id=id title=local_assigns[:title] type='button' - i.fa-solid.fa-circle-notch.fa-spin.d-none class=(label.blank? ? "m-0" : '') + i.fa-solid.fa-circle-notch.fa-spin.d-none class=(label.blank? ? 'm-0' : '') i class=(label.present? ? icon : "#{icon} m-0") = label diff --git a/app/views/exercises/_editor_edit.html.slim b/app/views/exercises/_editor_edit.html.slim index 18ea0109..451de67f 100644 --- a/app/views/exercises/_editor_edit.html.slim +++ b/app/views/exercises/_editor_edit.html.slim @@ -2,4 +2,4 @@ #frames .edit-frame .editor-content.d-none - .editor.allow_ace_tooltip \ No newline at end of file + .editor.allow_ace_tooltip diff --git a/app/views/exercises/_editor_file_tree.html.slim b/app/views/exercises/_editor_file_tree.html.slim index 402acf27..a188ded5 100644 --- a/app/views/exercises/_editor_file_tree.html.slim +++ b/app/views/exercises/_editor_file_tree.html.slim @@ -1,24 +1,24 @@ -div.d-grid.gap-2 id='sidebar-collapsed' class=(@exercise.hide_file_tree && @tips.blank? ? '' : 'd-none') - = render('editor_button', classes: 'btn-outline-contrast', data: {:'data-bs-toggle' => 'tooltip', :'data-bs-placement' => 'right'}, icon: 'fa-solid fa-square-plus', id: 'sidebar-collapse-collapsed', label:'', title:t('exercises.editor.expand_action_sidebar')) +.d-grid.gap-2#sidebar-collapsed class=(@exercise.hide_file_tree && @tips.blank? ? '' : 'd-none') + = render('editor_button', classes: 'btn-outline-contrast', data: {'data-bs-toggle': 'tooltip', 'data-bs-placement': 'right'}, icon: 'fa-solid fa-square-plus', id: 'sidebar-collapse-collapsed', label: '', title: t('exercises.editor.expand_action_sidebar')) - - unless @embed_options[:disable_hints] or @tips.blank? - = render('editor_button', classes: 'btn-secondary btn mb-4', data: {:'data-bs-toggle' => 'tooltip', :'data-bs-placement' => 'right'}, icon: 'fa-solid fa-lightbulb', id: 'tips-collapsed', label:'', title: t('exercises.form.tips')) + - unless @embed_options[:disable_hints] || @tips.blank? + = render('editor_button', classes: 'btn-secondary btn mb-4', data: {'data-bs-toggle': 'tooltip', 'data-bs-placement': 'right'}, icon: 'fa-solid fa-lightbulb', id: 'tips-collapsed', label: '', title: t('exercises.form.tips')) -div.d-grid.enforce-bottom-margin id='sidebar-uncollapsed' class=(@exercise.hide_file_tree && @tips.blank? ? 'd-none' : '') +.d-grid.enforce-bottom-margin#sidebar-uncollapsed class=(@exercise.hide_file_tree && @tips.blank? ? 'd-none' : '') = render('editor_button', classes: 'btn-outline-contrast overflow-hidden mb-2', icon: 'fa-solid fa-square-minus', id: 'sidebar-collapse', label: t('exercises.editor.collapse_action_sidebar')) #content-left-sidebar.overflow-scroll - unless @exercise.hide_file_tree - div.overflow-scroll + .overflow-scroll .card.border-secondary .card-header.d-flex.justify-content-between.align-items-center.px-0.py-1 .px-2 = I18n.t('exercises.editor_file_tree.file_root') div - if @exercise.allow_file_creation - = render('editor_button', classes: 'btn-default btn-sm', data: {:'data-bs-toggle' => 'tooltip', :'data-cause' => 'file'}, icon: 'fa-solid fa-plus', id: 'create-file', label: '', title: t('exercises.editor.create_file')) - = render('editor_button', classes: 'btn-default btn-sm', data: {:'data-bs-toggle' => 'tooltip', :'data-cause' => 'file' }, icon: 'fa-regular fa-trash-can', id: 'destroy-file', label: '', title: t('exercises.editor.destroy_file')) + = render('editor_button', classes: 'btn-default btn-sm', data: {'data-bs-toggle': 'tooltip', 'data-cause': 'file'}, icon: 'fa-solid fa-plus', id: 'create-file', label: '', title: t('exercises.editor.create_file')) + = render('editor_button', classes: 'btn-default btn-sm', data: {'data-bs-toggle': 'tooltip', 'data-cause': 'file'}, icon: 'fa-regular fa-trash-can', id: 'destroy-file', label: '', title: t('exercises.editor.destroy_file')) - unless @embed_options[:disable_download] - = render('editor_button', classes: 'btn-default btn-sm', data: {:'data-bs-toggle' => 'tooltip'}, icon: 'fa-solid fa-arrow-down', id: 'download', label:'', title: t('exercises.editor.download')) - = render('editor_button', classes: 'btn-default btn-sm', data: {:'data-bs-toggle' => 'tooltip', :'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => reload_exercise_path(@exercise)}, icon: 'fa-solid fa-clock-rotate-left', id: 'start-over', label: '', title: t('exercises.editor.start_over')) + = render('editor_button', classes: 'btn-default btn-sm', data: {'data-bs-toggle': 'tooltip'}, icon: 'fa-solid fa-arrow-down', id: 'download', label: '', title: t('exercises.editor.download')) + = render('editor_button', classes: 'btn-default btn-sm', data: {'data-bs-toggle': 'tooltip', 'data-message-confirm': t('exercises.editor.confirm_start_over'), 'data-url': reload_exercise_path(@exercise)}, icon: 'fa-solid fa-clock-rotate-left', id: 'start-over', label: '', title: t('exercises.editor.start_over')) .card-body.pt-0.pe-0.ps-1.pb-1 @@ -26,7 +26,7 @@ div.d-grid.enforce-bottom-margin id='sidebar-uncollapsed' class=(@exercise.hide_ hr - - unless @embed_options[:disable_hints] or @tips.blank? + - unless @embed_options[:disable_hints] || @tips.blank? = render(partial: 'tips_content') - if @exercise.allow_file_creation? diff --git a/app/views/exercises/_editor_frame.html.slim b/app/views/exercises/_editor_frame.html.slim index b0b9791d..af9c98f5 100644 --- a/app/views/exercises/_editor_frame.html.slim +++ b/app/views/exercises/_editor_frame.html.slim @@ -1,4 +1,4 @@ -div class=(defined?(own_solution) ? "own-frame" : "frame") data-executable=file.file_type.executable? data-filename=file.filepath data-renderable=file.file_type.renderable? data-role=file.role data-binary=file.file_type.binary? data-read-only=file.read_only +div class=(defined?(own_solution) ? 'own-frame' : 'frame') data-executable=file.file_type.executable? data-filename=file.filepath data-renderable=file.file_type.renderable? data-role=file.role data-binary=file.file_type.binary? data-read-only=file.read_only - if file.file_type.binary? - file_path = protected_upload_path(id: file.id, filename: file.filepath) .binary-file data-file-id=file.ancestor_id @@ -13,4 +13,4 @@ div class=(defined?(own_solution) ? "own-frame" : "frame") data-executable=file. = link_to(file.native_file.file.filename, file_path) - else .editor-content.d-none data-file-id=file.ancestor_id = file.content - div class=(defined?(own_solution) ? "own-editor" : "editor") data-file-id=file.ancestor_id data-indent-size=file.file_type.indent_size data-mode=file.file_type.editor_mode data-allow-auto-completion=exercise.allow_auto_completion.to_s data-id=file.id + div class=(defined?(own_solution) ? 'own-editor' : 'editor') data-file-id=file.ancestor_id data-indent-size=file.file_type.indent_size data-mode=file.file_type.editor_mode data-allow-auto-completion=exercise.allow_auto_completion.to_s data-id=file.id diff --git a/app/views/exercises/_editor_output.html.slim b/app/views/exercises/_editor_output.html.slim index cff864c1..dc90e609 100644 --- a/app/views/exercises/_editor_output.html.slim +++ b/app/views/exercises/_editor_output.html.slim @@ -1,13 +1,12 @@ -div.d-grid id='output_sidebar_collapsed' - = render('editor_button', classes: 'btn-outline-contrast btn', data: {:'data-bs-toggle' => 'tooltip', :'data-bs-placement' => 'left'}, title: t('exercises.editor.expand_output_sidebar'), icon: 'fa-solid fa-square-plus', id: 'toggle-sidebar-output-collapsed', label: '') -div.d-grid id='output_sidebar_uncollapsed' class='d-none col-sm-12 enforce-bottom-margin' data-message-no-output=t('exercises.implement.no_output_yet') +.d-grid#output_sidebar_collapsed + = render('editor_button', classes: 'btn-outline-contrast btn', data: {'data-bs-toggle': 'tooltip', 'data-bs-placement': 'left'}, title: t('exercises.editor.expand_output_sidebar'), icon: 'fa-solid fa-square-plus', id: 'toggle-sidebar-output-collapsed', label: '') +.d-grid.d-none.col-sm-12.enforce-bottom-margin#output_sidebar_uncollapsed data-message-no-output=t('exercises.implement.no_output_yet') = render('editor_button', classes: 'btn-outline-contrast btn overflow-hidden mb-2', icon: 'fa-solid fa-square-minus', id: 'toggle-sidebar-output', label: t('exercises.editor.collapse_output_sidebar')) - #content-right-sidebar.overflow-scroll = render('download_file_tree') - div.enforce-bottom-margin.overflow-auto.d-none id='score_div' + .enforce-bottom-margin.overflow-auto.d-none#score_div #results h2 = t('exercises.implement.results') p.test-count == t('exercises.implement.test_count', count: 0) @@ -67,12 +66,12 @@ div.d-grid id='output_sidebar_uncollapsed' class='d-none col-sm-12 enforce-botto hr #turtlediv.enforce-big-bottom-margin.overflow-auto.d-none canvas#turtlecanvas width=400 height=400 - div.enforce-big-bottom-margin.overflow-auto + .enforce-big-bottom-margin.overflow-auto #prompt.input-group.mb-2.d-none span.input-group-text data-prompt=t('exercises.editor.input') = t('exercises.editor.input') input#prompt-input.form-control type='text' span.input-group-btn - button#prompt-submit.btn.btn-primary type="button" = t('exercises.editor.send') + button#prompt-submit.btn.btn-primary type='button' = t('exercises.editor.send') - unless @embed_options[:disable_hints] #error-hints.mb-2.p-2 .heading = t('exercises.implement.error_hints.heading') diff --git a/app/views/exercises/_export_actions.html.slim b/app/views/exercises/_export_actions.html.slim index 8e74c12f..984f090c 100644 --- a/app/views/exercises/_export_actions.html.slim +++ b/app/views/exercises/_export_actions.html.slim @@ -2,12 +2,10 @@ = button_tag type: 'button', class: 'btn btn-primary float-end export-button export-retry-button', data: {exercise_id: exercise.id} do i.fa-solid.fa-arrows-rotate.confirm-icon = t('exercises.export_codeharbor.buttons.retry') -- else - - unless exported - - if !uuid_found || update_right - = button_tag type: 'button', class: 'btn btn-primary float-end export-action export-button', data: {exercise_id: exercise.id} do - i.fa-solid.fa-check.confirm-icon - = t('exercises.export_codeharbor.buttons.export') +- elsif !exported && (!uuid_found || update_right) + = button_tag type: 'button', class: 'btn btn-primary float-end export-action export-button', data: {exercise_id: exercise.id} do + i.fa-solid.fa-check.confirm-icon + = t('exercises.export_codeharbor.buttons.export') = button_tag type: 'submit', class: 'btn btn-secondary float-end export-button', data: {bs_dismiss: 'modal'} do i.fa-solid.fa-xmark.abort-icon diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index d0397845..d731245d 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -1,14 +1,14 @@ - id = f.object.id li.card.mt-2 - .card-header role="tab" id="heading" - - collapsed_class = f.index != 'index' ? 'collapsed' : nil - - aria_expanded = f.index != 'index' ? 'false' : 'true' - a class=['file-heading', collapsed_class] data-bs-toggle="collapse" href="#collapse#{f.index}" aria-expanded="#{aria_expanded}" - div.clearfix role="button" - i.fa-solid aria-hidden="true" + .card-header#heading role='tab' + - collapsed_class = f.index == 'index' ? nil : 'collapsed' + - aria_expanded = f.index == 'index' ? 'true' : 'false' + a class=['file-heading', collapsed_class] data-bs-toggle='collapse' href="#collapse#{f.index}" aria-expanded=aria_expanded + .clearfix role='button' + i.fa-solid aria-hidden='true' span = f.object.filepath - .card-collapse.collapse class=('in' if f.object.name.nil?) id="collapse#{f.index}" role="tabpanel" + .card-collapse.collapse class=('in' if f.object.name.nil?) id="collapse#{f.index}" role='tabpanel' .card-body - if policy(f.object).destroy? && id.present? .clearfix @@ -25,7 +25,7 @@ li.card.mt-2 = f.collection_select(:file_type_id, @file_types, :id, :name, {}, class: 'form-control') .mb-3 = f.label(:role, t('activerecord.attributes.file.role'), class: 'form-label') - = f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map { |role| [t("files.roles.#{role}"), role] }, {}, class: 'form-control') + = f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map {|role| [t("files.roles.#{role}"), role] }, {}, class: 'form-control') .form-check label.form-check-label = f.check_box(:hidden, class: 'form-check-input') diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index cbb36904..33df8268 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -4,10 +4,10 @@ meta name='turbolinks-visit-control' content='reload' - append_javascript_pack_tag('sortable') -- execution_environments = ExecutionEnvironment.where('file_type_id IS NOT NULL').select(:file_type_id, :id) -- file_types = FileType.where('file_extension IS NOT NULL').select(:file_extension, :id) +- execution_environments = ExecutionEnvironment.where.not(file_type_id: nil).select(:file_type_id, :id) +- file_types = FileType.where.not(file_extension: nil).select(:file_extension, :id) -= form_for(@exercise, data: {execution_environments: execution_environments, file_types: file_types}, multipart: true, builder: PagedownFormBuilder) do |f| += form_for(@exercise, data: {execution_environments:, file_types:}, multipart: true, builder: PagedownFormBuilder) do |f| = render('shared/form_errors', object: @exercise) .mb-3 = f.label(:title, class: 'form-label') @@ -18,7 +18,7 @@ .help-block.form-text == t('.hints.internal_title') .mb-3 = f.label(:description, class: 'form-label') - = f.pagedown :description, input_html: { preview: true, rows: 10 } + = f.pagedown :description, input_html: {preview: true, rows: 10} .mb-3 = f.label(:execution_environment_id, class: 'form-label') = f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {include_blank: t('exercises.form.none')}, class: 'form-control') @@ -63,11 +63,11 @@ h2 = t('exercises.form.tags') ul.list-unstyled.card-group li.card - .card-header role="tab" id="heading" - a.file-heading data-bs-toggle="collapse" href="#tag-collapse" - div.clearfix role="button" + .card-header#heading role='tab' + a.file-heading data-bs-toggle='collapse' href='#tag-collapse' + .clearfix role='button' span = t('exercises.form.click_to_collapse') - .card-collapse.collapse id="tag-collapse" role="tabpanel" + .card-collapse.collapse#tag-collapse role='tabpanel' .table-responsive table.table#tags-table thead @@ -79,17 +79,17 @@ tr td = b.check_box class: 'form-check-input' td = b.object.tag.name - td = number_field "tag_factors[#{b.object.tag.id}]", :factor, :value => b.object.factor, in: 1..10, step: 1, class: 'form-control form-control-sm' + td = number_field "tag_factors[#{b.object.tag.id}]", :factor, value: b.object.factor, in: 1..10, step: 1, class: 'form-control form-control-sm' h2 = t('.tips') ul.list-unstyled.card-group li.card - .card-header role="tab" id="tip-heading" - a.file-heading data-bs-toggle="collapse" href="#tip-collapse" - div.clearfix role="button" + .card-header#tip-heading role='tab' + a.file-heading data-bs-toggle='collapse' href='#tip-collapse' + .clearfix role='button' span = t('exercises.form.click_to_collapse') - .card-collapse.collapse.mx-2 id="tip-collapse" role="tabpanel" - = f.hidden_field(:tips, id: "tips-json", value: "") + .card-collapse.collapse.mx-2#tip-collapse role='tabpanel' + = f.hidden_field(:tips, id: 'tips-json', value: '') .list-group.nested-sortable-list.mt-2#tip-list = render(partial: 'tips/sortable_tip', collection: @tips, as: :exercise_tip) button.btn.btn-outline-primary.my-2.w-100 type='button' data-bs-toggle='modal' data-bs-target='#add-tips-modal' = t('.add_tips') @@ -103,6 +103,6 @@ ul#dummies.d-none = f.fields_for(:files, CodeOcean::File.new, child_index: 'index') do |files_form| = render('file_form', f: files_form) - .actions = render('shared/submit_button', f: f, object: @exercise) + .actions = render('shared/submit_button', f:, object: @exercise) = render('shared/modal', id: 'add-tips-modal', title: t('.add_tips'), template: 'exercises/_add_tip_modal') diff --git a/app/views/exercises/_request_comment_dialogcontent.html.slim b/app/views/exercises/_request_comment_dialogcontent.html.slim index 62b5dc60..0b656e85 100644 --- a/app/views/exercises/_request_comment_dialogcontent.html.slim +++ b/app/views/exercises/_request_comment_dialogcontent.html.slim @@ -1,7 +1,6 @@ #rfc_intervention_text style='display: none;' == t('exercises.implement.rfc_intervention.text') == t('exercises.implement.comment.question') - textarea.form-control.flex-grow-1#question(style='resize:none; height: 15vh;') p = '' / data-cause='requestComments' is not used here right now, we pass the button #requestComments (not askForCommentsButton) as initiator of the action. @@ -9,5 +8,5 @@ p = '' .d-grid.gap-2 button#askForCommentsButton.btn.btn-primary(type='button' data-cause='requestComments' data-message-success=t('exercises.editor.request_for_comments_sent')) i.fa-solid.fa-circle-notch.fa-spin.d-none - =t('exercises.implement.comment.request') - button#closeAskForCommentsButton.btn.btn-warning(type='button') =t('activerecord.attributes.request_for_comments.close') + = t('exercises.implement.comment.request') + button#closeAskForCommentsButton.btn.btn-warning(type='button') = t('activerecord.attributes.request_for_comments.close') diff --git a/app/views/exercises/_tips_content.html.slim b/app/views/exercises/_tips_content.html.slim index e3070e5f..a67f6a02 100644 --- a/app/views/exercises/_tips_content.html.slim +++ b/app/views/exercises/_tips_content.html.slim @@ -5,9 +5,9 @@ - append_javascript_pack_tag('highlight') - append_stylesheet_pack_tag('highlight') -#tips.card.d-block.overflow-scroll role="tab" +#tips.card.d-block.overflow-scroll role='tab' .card-header.py-2 i.fa-solid.fa-lightbulb = t('exercises.implement.tips.heading') .card-body.p-2 - = render(partial: 'tips/collapsed_card', collection: @tips, as: :exercise_tip, locals: { tip_prefix: '' }) + = render(partial: 'tips/collapsed_card', collection: @tips, as: :exercise_tip, locals: {tip_prefix: ''}) diff --git a/app/views/exercises/external_users/statistics.html.slim b/app/views/exercises/external_users/statistics.html.slim index 17386f79..6d2c3de7 100644 --- a/app/views/exercises/external_users/statistics.html.slim +++ b/app/views/exercises/external_users/statistics.html.slim @@ -3,19 +3,17 @@ h1 ' (external user = link_to_if(policy(@external_user).show?, @external_user.displayname, @external_user) ' ) -- submissions = @all_events.filter{|event| event.is_a? Submission} +- submissions = @all_events.filter {|event| event.is_a? Submission } - current_submission = submissions.first - if current_submission - - initial_files = current_submission.files.to_a - - all_files = [] - - file_types = Set.new() + - file_types = Set.new - submissions.each do |submission| - submission.files.each do |file| - file_types.add(ActiveSupport::JSON.encode(file.file_type)) - all_files.push(submission.files) - - all_files.reject!(&:blank?) - - file_types.reject!(&:blank?) + - all_files.compact_blank! + - file_types.reject!(&:blank?) # rubocop:disable Rails/CompactBlank because it's a set .d-none#data data-submissions=ActiveSupport::JSON.encode(submissions) data-files=ActiveSupport::JSON.encode(all_files) data-file-types=ActiveSupport::JSON.encode(file_types) @@ -28,16 +26,16 @@ h1 #current-file.editor .flex-container - button.btn.btn-secondary id='play-button' + button.btn.btn-secondary#play-button span.fa-solid.fa-play #submissions-slider.flex-item - input type='range' orient='horizontal' list='datapoints' min=0 max=all_files.length-1 value=0 style="width: 100%" + input.w-100 type='range' orient='horizontal' list='datapoints' value=0 min=0 max=all_files.length - 1 datalist#datapoints - - index=0 + - index = 0 - submissions.each do |submission| - next if submission.files.blank? option data-submission=submission - =index + = index - index += 1 - if policy(@exercise).detailed_statistics? .bg-body-secondary.w-100.p-2.mb-4.align-items-center.d-flex.justify-content-between @@ -45,12 +43,12 @@ h1 span.ps-1.pb-1 i.fa-solid.fa-circle-info.align-middle small.me-5.ms-1 = t('.toggle_status_on') - = link_to t('.toggle_autosave_off'), statistics_external_user_exercise_path(show_autosaves: false), class: "btn btn-outline-contrast float-end btn-sm" + = link_to t('.toggle_autosave_off'), statistics_external_user_exercise_path(show_autosaves: false), class: 'btn btn-outline-contrast float-end btn-sm' - else span.ps-1.pb-1 i.fa-solid.fa-circle-info.align-middle small.me-5.ms-1 = t('.toggle_status_off') - = link_to t('.toggle_autosave_on'), statistics_external_user_exercise_path(show_autosaves: true), class: "btn btn-outline-contrast float-end btn-sm" + = link_to t('.toggle_autosave_on'), statistics_external_user_exercise_path(show_autosaves: true), class: 'btn btn-outline-contrast float-end btn-sm' #timeline .table-responsive table.table @@ -62,8 +60,8 @@ h1 th.header = t('.tests') th.header = t('.time_difference') if policy(@exercise).detailed_statistics? tbody - - @all_events.each_with_index do |this, index| - - highlight = (index > 0 and @deltas.present? and @deltas[index] == 0 and this.created_at.to_s != @all_events[index - 1].created_at.to_s) + - @all_events.each_with_index do |this, event_index| + - highlight = event_index.positive? && @deltas.present? && @deltas[event_index].zero? && this.created_at.to_s != @all_events[event_index - 1].created_at.to_s - row_classes = '' - row_classes += ' highlight' if highlight - row_classes += ' before_deadline' if this.is_a?(Submission) && this.before_deadline? @@ -72,22 +70,22 @@ h1 tr data-id=this.id class=row_classes - if this.is_a?(Submission) td class=(this.files.present? ? 'clickable' : '') - = this.created_at.strftime("%F %T") + = this.created_at.strftime('%F %T') td = this.cause td = this.score td.align-middle - -this.testruns.sort_by {|t| [t.file&.name ? 0 : 1, t.file&.name]}.each do |run| + -this.testruns.sort_by {|t| [t.file&.name ? 0 : 1, t.file&.name] }.each do |run| - if run.passed .unit-test-result.positive-result title=[run.file&.filepath, run.log].join("\n").strip - else .unit-test-result.unknown-result title=[run.file&.filepath, run.log].join("\n").strip - td = @working_times_until[index] if index > 0 if policy(@exercise).detailed_statistics? + td = @working_times_until[event_index] if event_index.positive? && policy(@exercise).detailed_statistics? - elsif this.is_a? UserExerciseIntervention - td = this.created_at.strftime("%F %T") + td = this.created_at.strftime('%F %T') td = this.intervention.name - td = - td = - td = @working_times_until[index] if index > 0 if policy(@exercise).detailed_statistics? + td + td + td = @working_times_until[event_index] if event_index.positive? && policy(@exercise).detailed_statistics? small b = t('.legend') @@ -105,8 +103,8 @@ h1 p.mt-2 = t('.filter') - if current_user.try(:admin?) p = t('.addendum', delta: StatisticsHelper::WORKING_TIME_DELTA_IN_SECONDS / 60) - .d-none#wtimes data-working_times=ActiveSupport::JSON.encode(@working_times_until); - div#progress_chart.col-lg-12 + .d-none#wtimes data-working_times=ActiveSupport::JSON.encode(@working_times_until) + #progress_chart.col-lg-12 .graph-functions-2 - else diff --git a/app/views/exercises/feedback.html.slim b/app/views/exercises/feedback.html.slim index bbd974a4..d6513523 100644 --- a/app/views/exercises/feedback.html.slim +++ b/app/views/exercises/feedback.html.slim @@ -8,7 +8,7 @@ h1 = link_to_if(policy(@exercise).show?, @exercise, exercise_path(@exercise)) span.col-sm-9 =< @exercise.maximum_score .header.mt-3 = t('activerecord.models.user_exercise_feedback.other') - - if @feedbacks.nil? or @feedbacks.size == 0 + - if @feedbacks.blank? .no-feedback = t('user_exercise_feedback.no_feedback') ul.list-unstyled @@ -16,22 +16,22 @@ h1 = link_to_if(policy(@exercise).show?, @exercise, exercise_path(@exercise)) - time_presets = UserExerciseFeedbacksController.new.time_presets - @feedbacks.each_with_index do |feedback, index| li.card.mt-2 - .card-header role="tab" id="heading" - div.clearfix.feedback-header + .card-header#heading role='tab' + .clearfix.feedback-header - if policy(@exercise).detailed_statistics? span.username = link_to_if(policy(feedback.user).show?, feedback.user.displayname, statistics_external_user_exercise_path(id: @exercise.id, external_user_id: feedback.user.id)) - if feedback.anomaly_notification - i class="fa-regular fa-envelope" data-bs-placement="top" data-bs-toggle="tooltip" data-bs-container="body" title=feedback.anomaly_notification.reason + i.fa-regular.fa-envelope data-bs-placement='top' data-bs-toggle='tooltip' data-bs-container='body' title=feedback.anomaly_notification.reason span.date = feedback.created_at - .card-collapse role="tabpanel" + .card-collapse role='tabpanel' .card-body.feedback .text style="white-space: pre-wrap;" = feedback.feedback_text .difficulty = "#{t('user_exercise_feedback.difficulty')} #{comment_presets[feedback.difficulty].join(' - ')}" if feedback.difficulty .worktime = "#{t('user_exercise_feedback.working_time')} #{time_presets[feedback.user_estimated_worktime].join(' - ')}" if feedback.user_estimated_worktime - if policy(@exercise).detailed_statistics? .card-footer - div.clearfix.feedback-header + .clearfix.feedback-header span.points.flex-grow-1 = "#{t('exercises.statistics.score')}: #{@submissions[index].score}" - span.working_time.float-end = "#{t('exercises.statistics.worktime')}: #{@exercise.average_working_time_for(feedback.user) or 0}" + span.working_time.float-end = "#{t('exercises.statistics.worktime')}: #{@exercise.average_working_time_for(feedback.user) || 0}" = render('shared/pagination', collection: @feedbacks) diff --git a/app/views/exercises/implement.html.slim b/app/views/exercises/implement.html.slim index 4d323038..e2fc3943 100644 --- a/app/views/exercises/implement.html.slim +++ b/app/views/exercises/implement.html.slim @@ -1,25 +1,25 @@ - content_for :head do // Force a full page reload, see https://github.com/turbolinks/turbolinks/issues/326. Otherwise, lti_parameters might be nil - meta name="turbolinks-cache-control" content="no-cache" + meta name='turbolinks-cache-control' content='no-cache' #editor-column - unless @embed_options[:hide_exercise_description] .exercise.clearfix - div.col-9div.d-lg-flex.flex-row.justify-content-between.align-items-baseline - div.col-lg-7 - h1 id="exercise-headline" - i id="description-symbol" class=(@embed_options[:collapse_exercise_description] ? 'fa-solid fa-chevron-right' : 'fa-solid fa-chevron-down') + .col-9.d-lg-flex.flex-row.justify-content-between.align-items-baseline + .col-lg-7 + h1#exercise-headline + i#description-symbol class=(@embed_options[:collapse_exercise_description] ? 'fa-solid fa-chevron-right' : 'fa-solid fa-chevron-down') = @exercise.title - div.col-lg-5.float-lg-end.ms-md-3.mb-md-3.d-flex.justify-content-end.pe-lg-3 + .col-lg-5.float-lg-end.ms-md-3.mb-md-3.d-flex.justify-content-end.pe-lg-3 - if current_contributor.programming_group? span.me-3.mt-1 - button.btn.btn-sm.btn-primary.text-nowrap.w-100#start_chat data= { url: "https://jitsi.fem.tu-ilmenau.de/openHPI_ProgrammingGroup#{current_contributor.id}" } + button.btn.btn-sm.btn-primary.text-nowrap.w-100#start_chat data= {url: "https://jitsi.fem.tu-ilmenau.de/openHPI_ProgrammingGroup#{current_contributor.id}"} i.fa-solid.fa-video = t('exercises.editor.start_video') - div.small.text-body-tertiary.text-nowrap.mt-1 + .small.text-body-tertiary.text-nowrap.mt-1 a href='https://www.tu-ilmenau.de/datenschutz' target='_blank' rel='noopener' = t('exercises.implement.external_privacy_policy') @@ -30,13 +30,13 @@ span.badge.rounded-pill.bg-primary.float-end.mt-2.mb-5.score - - if !current_contributor.programming_group? + - unless current_contributor.programming_group? span.badge.rounded-pill.bg-primary.float-end.mt-2.score #description-card.lead class=(@embed_options[:collapse_exercise_description] ? 'description-card-collapsed' : 'description-card') = render_markdown(@exercise.description) - a#toggle href="#" data-show=t('shared.show') data-hide=t('shared.hide') + a#toggle href='#' data-show=t('shared.show') data-hide=t('shared.hide') - if @embed_options[:collapse_exercise_description] = t('shared.show') - else diff --git a/app/views/exercises/index.html.slim b/app/views/exercises/index.html.slim index 13c47f57..1bc9dbf3 100644 --- a/app/views/exercises/index.html.slim +++ b/app/views/exercises/index.html.slim @@ -22,38 +22,38 @@ h1 = Exercise.model_name.human(count: 2) = t('activerecord.attributes.exercise.public') - if policy(Exercise).batch_update? br - span.batch = link_to(t('shared.batch_update'), '#', 'data-text' => t('shared.update', model: t('activerecord.models.exercise.other'))) + span.batch = link_to(t('shared.batch_update'), '#', 'data-text': t('shared.update', model: t('activerecord.models.exercise.other'))) th.p-1 colspan=6 = t('shared.actions') tbody - @exercises.each do |exercise| tr data-id=exercise.id td.p-1.pt-2 - = link_to_if(policy(exercise).show?, exercise.title, exercise, 'data-turbolinks' => "false") + = link_to_if(policy(exercise).show?, exercise.title, exercise, 'data-turbolinks': 'false') - if exercise.internal_title.present? p.mb-0.text-muted i.fa-solid.fa-arrow-turn-up.fa-rotate-90 span = exercise.internal_title td.p-1.pt-2 = link_to_if(exercise.execution_environment && policy(exercise.execution_environment).show?, exercise.execution_environment, exercise.execution_environment) - td.p-1.pt-2 = exercise.files.filter(&:teacher_defined_assessment?).length + td.p-1.pt-2 = exercise.files.count(&:teacher_defined_assessment?) td.p-1.pt-2 = exercise.maximum_score td.p-1.pt-2 = exercise.exercise_tags.length td.p-1.pt-2 = exercise.expected_difficulty td.p-1.pt-2.public data-value=exercise.public? = symbol_for(exercise.public?) td.p-1.pt-2 = link_to(t('shared.edit'), edit_exercise_path(exercise)) if policy(exercise).edit? td.p-1.pt-2 = link_to(t('.implement'), implement_exercise_path(exercise)) if policy(exercise).implement? - td.p-1.pt-2 = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbolinks' => "false") if policy(exercise).statistics? + td.p-1.pt-2 = link_to(t('shared.statistics'), statistics_exercise_path(exercise), 'data-turbolinks': 'false') if policy(exercise).statistics? td.p-1 .btn-group - button.btn.btn-outline-primary.btn-sm.dropdown-toggle data-bs-toggle="dropdown" type="button" = t('shared.actions_button') - ul.dropdown-menu.float-end role="menu" - li = link_to(t('shared.show'), exercise, 'data-turbolinks' => "false", class: 'dropdown-item') if policy(exercise).show? + button.btn.btn-outline-primary.btn-sm.dropdown-toggle data-bs-toggle='dropdown' type='button' = t('shared.actions_button') + ul.dropdown-menu.float-end role='menu' + li = link_to(t('shared.show'), exercise, 'data-turbolinks': 'false', class: 'dropdown-item') if policy(exercise).show? li = link_to(t('activerecord.models.user_exercise_feedback.other'), feedback_exercise_path(exercise), class: 'dropdown-item') if policy(exercise).feedback? li = link_to(t('activerecord.models.request_for_comment.other'), exercise_request_for_comments_path(exercise), class: 'dropdown-item') if policy(exercise).rfcs_for_exercise? li = link_to(t('activerecord.models.programming_group.other'), exercise_programming_groups_path(exercise), class: 'dropdown-item') if policy(exercise).programming_groups_for_exercise? li = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(exercise).destroy? li = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post, class: 'dropdown-item') if policy(exercise).clone? - li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id' => exercise.id}) if policy(exercise).export_external_confirm? + li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id': exercise.id}) if policy(exercise).export_external_confirm? = render('shared/pagination', collection: @exercises) p = render('shared/new_button', model: Exercise) diff --git a/app/views/exercises/show.html.slim b/app/views/exercises/show.html.slim index e1562212..0121a945 100644 --- a/app/views/exercises/show.html.slim +++ b/app/views/exercises/show.html.slim @@ -15,14 +15,14 @@ h1.d-inline-block = render('shared/edit_button', object: @exercise) button.btn.btn-secondary.float-end.dropdown-toggle data-bs-toggle='dropdown' type='button' ul.dropdown-menu.dropdown-menu-end role='menu' - li = link_to(t('exercises.index.implement'), implement_exercise_path(@exercise), 'data-turbolinks' => "false", class: 'dropdown-item') if policy(@exercise).implement? - li = link_to(t('shared.statistics'), statistics_exercise_path(@exercise), 'data-turbolinks' => "false", class: 'dropdown-item') if policy(@exercise).statistics? + li = link_to(t('exercises.index.implement'), implement_exercise_path(@exercise), 'data-turbolinks': 'false', class: 'dropdown-item') if policy(@exercise).implement? + li = link_to(t('shared.statistics'), statistics_exercise_path(@exercise), 'data-turbolinks': 'false', class: 'dropdown-item') if policy(@exercise).statistics? li = link_to(t('activerecord.models.user_exercise_feedback.other'), feedback_exercise_path(@exercise), class: 'dropdown-item') if policy(@exercise).feedback? li = link_to(t('activerecord.models.request_for_comment.other'), exercise_request_for_comments_path(@exercise), class: 'dropdown-item') if policy(@exercise).rfcs_for_exercise? li = link_to(t('activerecord.models.programming_group.other'), exercise_programming_groups_path(@exercise), class: 'dropdown-item') if policy(@exercise).programming_groups_for_exercise? li = link_to(t('shared.destroy'), @exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(@exercise).destroy? li = link_to(t('exercises.index.clone'), clone_exercise_path(@exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post, class: 'dropdown-item') if policy(@exercise).clone? - li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id' => @exercise.id}) if policy(@exercise).export_external_confirm? + li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id': @exercise.id}) if policy(@exercise).export_external_confirm? = row(label: 'exercise.title', value: @exercise.title) = row(label: 'exercise.internal_title', value: @exercise.internal_title) @@ -40,11 +40,11 @@ h1.d-inline-block = row(label: 'exercise.allow_auto_completion', value: @exercise.allow_auto_completion?) = row(label: 'exercise.difficulty', value: @exercise.expected_difficulty) = row(label: 'exercise.uuid', value: @exercise.uuid) -= row(label: 'exercise.tags', value: @exercise.exercise_tags.map{|et| "#{et.tag.name} (#{et.factor})"}.sort.join(", ")) += row(label: 'exercise.tags', value: @exercise.exercise_tags.map {|et| "#{et.tag.name} (#{et.factor})" }.sort.join(', ')) = row(label: 'exercise.embedding_parameters', class: 'mb-4') do = content_tag(:input, nil, class: 'form-control bg-body-secondary mb-4', readonly: true, value: @exercise.unpublished? ? t('exercises.show.is_unpublished') : embedding_parameters(@exercise)) -- unless @tips.blank? +- if @tips.present? .mt-2 = render(partial: 'tips_content') @@ -53,15 +53,15 @@ h2.mt-4 = t('activerecord.attributes.exercise.files') ul.list-unstyled#files - @exercise.files.each do |file| li.card.mt-2 - .card-header role="tab" id="heading" - a.file-heading.collapsed data-bs-toggle="collapse" data-bs-parent="#files" href=".collapse#{file.id}" - div.clearfix role="button" - i.fa-solid aria-hidden="true" + .card-header#heading role='tab' + a.file-heading.collapsed data-bs-toggle='collapse' data-bs-parent='#files' href=".collapse#{file.id}" + .clearfix role='button' + i.fa-solid aria-hidden='true' span = file.filepath - .card-collapse.collapse class="collapse#{file.id}" role="tabpanel" + .card-collapse.collapse class="collapse#{file.id}" role='tabpanel' .card-body - if policy(file).destroy? - .clearfix = link_to(t('shared.destroy'), file, class:'btn btn-warning btn-sm float-end', data: {confirm: t('shared.confirm_destroy')}, method: :delete) - = render('shared/file', file: file) + .clearfix = link_to(t('shared.destroy'), file, class: 'btn btn-warning btn-sm float-end', data: {confirm: t('shared.confirm_destroy')}, method: :delete) + = render('shared/file', file:) = render('shared/modal', id: 'export-modal', title: t('exercises.export_codeharbor.dialogtitle'), template: 'exercises/_export_dialogcontent') diff --git a/app/views/exercises/statistics.html.slim b/app/views/exercises/statistics.html.slim index 706e45b2..53e7402b 100644 --- a/app/views/exercises/statistics.html.slim +++ b/app/views/exercises/statistics.html.slim @@ -7,7 +7,7 @@ h1 = @exercise = row(label: '.participants', value: @exercise.contributors.size) -- [:intermediate, :final].each do |scope| +- %i[intermediate final].each do |scope| = row(label: ".#{scope}_submissions") do /TODO: Refactor next line = "#{@exercise.submissions.send(scope).count} (#{t('.users_and_programming_groups', count: Submission.from(@exercise.submissions.send(scope).group(:contributor_id, :contributor_type).select(:contributor_id, :contributor_type)).count)})" @@ -24,7 +24,7 @@ h1 = @exercise - else = empty - finishers_count = @exercise.contributors.size - - finishers_percentage = finishers_count == 0 ? 0 : (100.0 / finishers_count * @exercise.finishers_count).round(2) + - finishers_percentage = finishers_count.zero? ? 0 : (100.0 / finishers_count * @exercise.finishers_count).round(2) p = progress_bar(finishers_percentage) = row(label: '.average_score') do @@ -43,27 +43,27 @@ h1 = @exercise = row(label: '.average_worktime') do p = @exercise.average_working_time -- Hash[:internal_users => t('.internal_users'), :external_users => t('.external_users'), :programming_groups => t('.programming_groups')].each_pair do |symbol, label| +- {internal_users: t('.internal_users'), external_users: t('.external_users'), programming_groups: t('.programming_groups')}.each_pair do |symbol, label| - submissions = Submission.where(contributor: @exercise.send(symbol), exercise: @exercise).in_study_group_of(current_user) - - if !policy(@exercise).detailed_statistics? + - unless policy(@exercise).detailed_statistics? - submissions = submissions.final - if submissions.any? strong = label - - if symbol==:external_users + - if symbol == :external_users - working_time_array = [] - - @exercise.send(symbol).distinct().each do |user| - - working_time = @exercise.average_working_time_for(user) or 0 + - @exercise.send(symbol).distinct.each do |user| + - working_time = @exercise.average_working_time_for(user) || 0 - working_time_array.push working_time hr .d-none#data data-working-time=ActiveSupport::JSON.encode(working_time_array) .working-time-graphs - div#chart_1 + #chart_1 hr - div#chart_2 + #chart_2 hr - contributors = symbol.to_s.classify.constantize.where(id: submissions.joins(symbol).group(:contributor_id).select(:contributor_id).distinct) .table-responsive.mb-4 - table.table.table-striped class="#{contributors.present? ? 'sortable' : ''}" + table.table.table-striped class=(contributors.present? ? 'sortable' : '') thead tr th.header = t('.user') @@ -73,11 +73,11 @@ h1 = @exercise th.header = t('.worktime') if policy(@exercise).detailed_statistics? tbody - contributors.each do |contributor| - - if contributor_statistics[contributor.class.name][contributor.id] then us = contributor_statistics[contributor.class.name][contributor.id] else us = {"maximum_score" => nil, "runs" => nil} - - label = "#{contributor.displayname}" + - us = contributor_statistics[contributor.class.name][contributor.id] || {'maximum_score' => nil, 'runs' => nil} + - label = contributor.displayname.to_s tr - td = link_to_if symbol==:external_users && policy(contributor).statistics?, label, {controller: "exercises", action: "external_user_statistics", external_user_id: contributor.id, id: @exercise.id} - td = us['maximum_score'] or 0 + td = link_to_if symbol == :external_users && policy(contributor).statistics?, label, {controller: 'exercises', action: 'external_user_statistics', external_user_id: contributor.id, id: @exercise.id} + td = us['maximum_score'] || 0 td.align-middle - latest_user_submission = submissions.where(contributor:).final.latest - if latest_user_submission.present? @@ -88,4 +88,4 @@ h1 = @exercise - elsif latest_user_submission.after_late_deadline? .unit-test-result.negative-result td = us['runs'] if policy(@exercise).detailed_statistics? - td = @exercise.average_working_time_for(contributor) or 0 if policy(@exercise).detailed_statistics? + td = @exercise.average_working_time_for(contributor) || 0 if policy(@exercise).detailed_statistics? diff --git a/app/views/exercises/study_group_dashboard.html.slim b/app/views/exercises/study_group_dashboard.html.slim index ed9bfd5e..c416fa9a 100644 --- a/app/views/exercises/study_group_dashboard.html.slim +++ b/app/views/exercises/study_group_dashboard.html.slim @@ -7,16 +7,16 @@ h1 = t('.live_dashboard') -div.teacher_dashboard data-exercise-id=@exercise.id.to_s data-study-group-id=@study_group_id.to_s +.teacher_dashboard data-exercise-id=@exercise.id.to_s data-study-group-id=@study_group_id.to_s h4.mt-4 = t('.time_spent_per_learner') -.d-none#initial_graph_data data-graph_data=ActiveSupport::JSON.encode(@graph_data); -div.w-100#chart_stacked +.d-none#initial_graph_data data-graph_data=ActiveSupport::JSON.encode(@graph_data) +.w-100#chart_stacked .d-none.bg-info.container.py-2#no_chart_data - i class="fa-solid fa-info" aria-hidden="true" + i.fa-solid.fa-info aria-hidden='true' = t('.no_data_yet') h4.mt-4 @@ -27,9 +27,9 @@ h4.mt-4 thead tr th.text-center - i.me-0 class="fa-regular fa-lightbulb" aria-hidden="true" title = t('request_for_comments.solved') + i.me-0.fa-regular.fa-lightbulb aria-hidden='true' title = t('request_for_comments.solved') th.text-center - i.me-0 class="fa-solid fa-comment" aria-hidden="true" title = t('request_for_comments.comments') align="center" + i.me-0.fa-solid.fa-comment aria-hidden='true' title = t('request_for_comments.comments') align='center' th.col-12 = t('activerecord.attributes.request_for_comments.question') th = t('activerecord.attributes.request_for_comments.username') th.text-nowrap = t('activerecord.attributes.request_for_comments.requested_at') diff --git a/app/views/external_users/index.html.slim b/app/views/external_users/index.html.slim index 24279460..59ba5ddf 100644 --- a/app/views/external_users/index.html.slim +++ b/app/views/external_users/index.html.slim @@ -15,10 +15,10 @@ h1 = ExternalUser.model_name.human(count: 2) = f.search_field(:external_id_cont, class: 'form-control', placeholder: t('activerecord.attributes.external_user.external_id')) .row .col-auto - = f.select :platform_admin_true, [[t('shared.admin_filter.only'), 1], [t('shared.admin_filter.none'), 0]], { include_blank: t('shared.admin_filter.all'), selected: params[:q] ? params[:q][:platform_admin_true] : '' } + = f.select :platform_admin_true, [[t('shared.admin_filter.only'), 1], [t('shared.admin_filter.none'), 0]], {include_blank: t('shared.admin_filter.all'), selected: params[:q] ? params[:q][:platform_admin_true] : ''} .col-auto.mt-3.mt-lg-0 = f.label(:consumer_id_eq, t('activerecord.attributes.external_user.consumer'), class: 'visually-hidden form-label') - = f.collection_select(:consumer_id_eq, Consumer.with_external_users, :id, :name, class: 'form-control', include_blank: true, prompt: t('activerecord.attributes.external_user.consumer') ) + = f.collection_select(:consumer_id_eq, Consumer.with_external_users, :id, :name, class: 'form-control', include_blank: true, prompt: t('activerecord.attributes.external_user.consumer')) - else .col-auto = f.label(:name_cont, t('activerecord.attributes.external_user.name'), class: 'visually-hidden form-label') diff --git a/app/views/external_users/show.html.slim b/app/views/external_users/show.html.slim index 6e852e9d..012ca559 100644 --- a/app/views/external_users/show.html.slim +++ b/app/views/external_users/show.html.slim @@ -8,10 +8,10 @@ h1 = @user.displayname = row(label: 'external_user.consumer', value: link_to_if(@user.consumer.present? && policy(@user.consumer).show?, @user.consumer, @user.consumer)) = row(label: 'external_user.platform_admin', value: @user.platform_admin?) if current_user.admin? = row(label: 'users.show.study_groups') do - - visible_memberships = @user.study_group_memberships.select { |study_group_membership| policy(study_group_membership.study_group).show? } + - visible_memberships = @user.study_group_memberships.select {|study_group_membership| policy(study_group_membership.study_group).show? } - if visible_memberships.any? - ul.mb-0 class="#{visible_memberships.one? ? 'single_entry_inline_list' : 'inline_list'}" - - visible_memberships = visible_memberships.sort_by{ |study_group_membership| study_group_membership.study_group.name} + ul.mb-0 class=(visible_memberships.one? ? 'single_entry_inline_list' : 'inline_list') + - visible_memberships = visible_memberships.sort_by {|study_group_membership| study_group_membership.study_group.name } - visible_memberships.each do |study_group_membership| li => link_to(study_group_membership.study_group.name, study_group_membership.study_group) diff --git a/app/views/external_users/statistics.html.slim b/app/views/external_users/statistics.html.slim index fbcd86a0..5d674c5a 100644 --- a/app/views/external_users/statistics.html.slim +++ b/app/views/external_users/statistics.html.slim @@ -1,13 +1,13 @@ h1 = t('.title') - submissions = Submission.where(contributor: @user).in_study_group_of(current_user) -- exercises = Exercise.where(id: submissions.joins(:exercise).group(:exercise_id).select(:exercise_id).distinct).reject(&:nil?) +- exercises = Exercise.where(id: submissions.joins(:exercise).group(:exercise_id).select(:exercise_id).distinct).compact - if submissions.any? && !policy(exercises.first).detailed_statistics? - submissions = submissions.final - if submissions.any? .table-responsive - table.table.table-striped class="#{exercises.present? ? 'sortable' : ''}" + table.table.table-striped class=(exercises.present? ? 'sortable' : '') thead tr th.header = t('.exercise') @@ -18,14 +18,14 @@ h1 = t('.title') tbody - exercises.each do |exercise| // Grab any submission in context of study group (or all if admin). Then check for permission - - any_submission = submissions.where(exercise: exercise).first + - any_submission = submissions.where(exercise:).first - if any_submission && policy(any_submission).show_study_group? && statistics[exercise.id] - stats = statistics[exercise.id] tr - td = link_to exercise, controller: "exercises", action: "external_user_statistics", external_user_id: @user.id, id: exercise.id - td = stats["maximum_score"] or 0 + td = link_to exercise, controller: 'exercises', action: 'external_user_statistics', external_user_id: @user.id, id: exercise.id + td = stats['maximum_score'] || 0 td.align-middle - - latest_viewable_submission = submissions.where(exercise: exercise).final.latest + - latest_viewable_submission = submissions.where(exercise:).final.latest - if latest_viewable_submission.present? - if latest_viewable_submission.before_deadline? .unit-test-result.positive-result.before_deadline @@ -33,7 +33,7 @@ h1 = t('.title') .unit-test-result.unknown-result.within_grace_period - elsif latest_viewable_submission.after_late_deadline? .unit-test-result.negative-result.after_late_deadline - td = stats["runs"] or 0 if policy(exercises.first).detailed_statistics? - td = stats["working_time"] or 0 if policy(exercises.first).detailed_statistics? + td = stats['runs'] || 0 if policy(exercises.first).detailed_statistics? + td = stats['working_time'] || 0 if policy(exercises.first).detailed_statistics? - else = t('exercises.external_users.statistics.no_data_available') diff --git a/app/views/file_templates/_form.html.slim b/app/views/file_templates/_form.html.slim index be5390da..ea378cfa 100644 --- a/app/views/file_templates/_form.html.slim +++ b/app/views/file_templates/_form.html.slim @@ -5,8 +5,8 @@ = f.text_field(:name, class: 'form-control', required: true) .mb-3 = f.label(:file_type_id, class: 'form-label') - = f.collection_select(:file_type_id, FileType.all.order(:name), :id, :name, {}, class: 'form-control') + = f.collection_select(:file_type_id, FileType.order(:name), :id, :name, {}, class: 'form-control') .mb-3 = f.label(:content, class: 'form-label') = f.text_area(:content, class: 'form-control') - .actions = render('shared/submit_button', f: f, object: @file_template) + .actions = render('shared/submit_button', f:, object: @file_template) diff --git a/app/views/file_types/_form.html.slim b/app/views/file_types/_form.html.slim index 7228b170..156c8bfa 100644 --- a/app/views/file_types/_form.html.slim +++ b/app/views/file_types/_form.html.slim @@ -25,4 +25,4 @@ label.form-check-label = f.check_box(:renderable, class: 'form-check-input') = t('activerecord.attributes.file_type.renderable') - .actions = render('shared/submit_button', f: f, object: @file_type) + .actions = render('shared/submit_button', f:, object: @file_type) diff --git a/app/views/file_types/show.html.slim b/app/views/file_types/show.html.slim index d6e39500..4759c602 100644 --- a/app/views/file_types/show.html.slim +++ b/app/views/file_types/show.html.slim @@ -4,5 +4,5 @@ h1 = row(label: 'file_type.name', value: @file_type.name) = row(label: 'file_type.user', value: link_to_if(policy(@file_type.author).show?, @file_type.author, @file_type.author)) -- [:editor_mode, :file_extension, :indent_size, :binary, :executable, :renderable].each do |attribute| +- %i[editor_mode file_extension indent_size binary executable renderable].each do |attribute| = row(label: "file_type.#{attribute}", value: @file_type.send(attribute)) diff --git a/app/views/internal_users/_form.html.slim b/app/views/internal_users/_form.html.slim index 049671cf..84e55a56 100644 --- a/app/views/internal_users/_form.html.slim +++ b/app/views/internal_users/_form.html.slim @@ -17,11 +17,11 @@ h2.mt-4 = t('internal_users.form.study_groups') ul.list-unstyled.card-group li.card - .card-header role="tab" id="heading" - a.file-heading data-bs-toggle="collapse" href="#study-group-collapse" - div.clearfix role="button" + .card-header#heading role='tab' + a.file-heading data-bs-toggle='collapse' href='#study-group-collapse' + .clearfix role='button' span = t('internal_users.form.click_to_collapse') - .card-collapse.collapse id="study-group-collapse" role="tabpanel" + .card-collapse.collapse#study-group-collapse role='tabpanel' .table-responsive table.table.overflow-hidden#study-groups-table thead @@ -31,8 +31,8 @@ th = t('activerecord.attributes.study_group_membership.role') = collection_check_boxes :user, :study_group_ids, @study_group_memberships, :study_group_id, :id, {namespace: :internal_user} do |b| tr - td = b.check_box class: 'form-check-input', name: "internal_user[study_group_ids][]" + td = b.check_box class: 'form-check-input', name: 'internal_user[study_group_ids][]' td = b.object.study_group.name - td = select "study_group_membership_roles[#{b.object.study_group.id}]", :role, StudyGroupMembership::ROLES.map { |role| [t("activerecord.attributes.study_group_membership.role_type.#{role}"), role] }, {selected: b.object.persisted? ? b.object.role : nil, include_blank: true}, class: 'form-control form-control-sm' + td = select "study_group_membership_roles[#{b.object.study_group.id}]", :role, StudyGroupMembership::ROLES.map {|role| [t("activerecord.attributes.study_group_membership.role_type.#{role}"), role] }, {selected: b.object.persisted? ? b.object.role : nil, include_blank: true}, class: 'form-control form-control-sm' - .actions = render('shared/submit_button', f: f, object: @user) + .actions = render('shared/submit_button', f:, object: @user) diff --git a/app/views/internal_users/index.html.slim b/app/views/internal_users/index.html.slim index 9e7e6c39..6e349b6d 100644 --- a/app/views/internal_users/index.html.slim +++ b/app/views/internal_users/index.html.slim @@ -9,7 +9,7 @@ h1 = InternalUser.model_name.human(count: 2) = f.label(:email_cont, t('activerecord.attributes.internal_user.email'), class: 'visually-hidden form-label') = f.search_field(:email_cont, class: 'form-control', placeholder: t('activerecord.attributes.internal_user.email')) .col-auto - = f.select :platform_admin_true, [[t('shared.admin_filter.only'), 1], [t('shared.admin_filter.none'), 0]], { include_blank: t('shared.admin_filter.all'), selected: params[:q] ? params[:q][:platform_admin_true] : '' } + = f.select :platform_admin_true, [[t('shared.admin_filter.only'), 1], [t('shared.admin_filter.none'), 0]], {include_blank: t('shared.admin_filter.all'), selected: params[:q] ? params[:q][:platform_admin_true] : ''} .table-responsive table.table.mt-4 thead diff --git a/app/views/internal_users/show.html.slim b/app/views/internal_users/show.html.slim index 983f08c1..c69adc65 100644 --- a/app/views/internal_users/show.html.slim +++ b/app/views/internal_users/show.html.slim @@ -8,10 +8,10 @@ h1 = row(label: 'internal_user.platform_admin', value: @user.platform_admin?) if current_user.admin? = row(label: 'internal_user.activated', value: @user.activated?) = row(label: 'users.show.study_groups') do - - visible_memberships = @user.study_group_memberships.select { |study_group_membership| policy(study_group_membership.study_group).show? } + - visible_memberships = @user.study_group_memberships.select {|study_group_membership| policy(study_group_membership.study_group).show? } - if visible_memberships.any? - ul.mb-0 class="#{visible_memberships.one? ? 'single_entry_inline_list' : 'inline_list'}" - - visible_memberships = visible_memberships.sort_by{ |study_group_membership| study_group_membership.study_group.name} + ul.mb-0 class=(visible_memberships.one? ? 'single_entry_inline_list' : 'inline_list') + - visible_memberships = visible_memberships.sort_by {|study_group_membership| study_group_membership.study_group.name } - visible_memberships.each do |study_group_membership| li => link_to(study_group_membership.study_group.name, study_group_membership.study_group) diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index fc63b1f7..c5ba93a7 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -1,5 +1,5 @@ doctype html -html lang="#{I18n.locale || I18n.default_locale}" data-default-locale="#{I18n.default_locale}" +html lang=I18n.locale data-default-locale=I18n.default_locale head meta charset='utf8' meta name='viewport' content='width=device-width, initial-scale=1' @@ -36,9 +36,9 @@ html lang="#{I18n.locale || I18n.default_locale}" data-default-locale="#{I18n.de = render('session') div data-controller=controller_name = render('flash') - - if current_user.try(:admin?) or current_user.try(:teacher?) && !@embed_options[:hide_navbar] + - if current_user.try(:admin?) || (current_user.try(:teacher?) && !@embed_options[:hide_navbar]) = yield(:breadcrumbs) - - if (controller_name == "exercises" && action_name == "implement") || (controller_name == 'community_solutions' && action_name == 'edit') + - if (controller_name == 'exercises' && action_name == 'implement') || (controller_name == 'community_solutions' && action_name == 'edit') .container-fluid = yield - else @@ -46,4 +46,4 @@ html lang="#{I18n.locale || I18n.default_locale}" data-default-locale="#{I18n.de = yield - template_variables = {execution_environment: @exercise.execution_environment} if action_name == 'implement' - = render('shared/modal', classes: 'modal-lg', id: 'modal-help', template: 'application/help', template_variables: template_variables, title: t('shared.help.headline')) + = render('shared/modal', classes: 'modal-lg', id: 'modal-help', template: 'application/help', template_variables:, title: t('shared.help.headline')) diff --git a/app/views/programming_groups/_form.html.slim b/app/views/programming_groups/_form.html.slim index 4b240d77..170ea777 100644 --- a/app/views/programming_groups/_form.html.slim +++ b/app/views/programming_groups/_form.html.slim @@ -8,7 +8,7 @@ .col-md-6 .input-group.mb-3 = f.text_field(:programming_partner_ids, class: 'form-control', required: true, value: (@programming_group.programming_partner_ids - [current_user.id_with_type]).join(', ')) - = render('shared/submit_button', f: f, object: @programming_group) + = render('shared/submit_button', f:, object: @programming_group) /.help-block.form-text = t('.hints.programming_partner_ids') .col-md-6 .join_programming_pair.button.btn.btn-primary.d-none.d-md-block diff --git a/app/views/programming_groups/_form_edit.html.slim b/app/views/programming_groups/_form_edit.html.slim index 0bb36d5e..b8b2f5d4 100644 --- a/app/views/programming_groups/_form_edit.html.slim +++ b/app/views/programming_groups/_form_edit.html.slim @@ -3,7 +3,7 @@ h3 = t('activerecord.attributes.programming_group.member') .table-responsive - table.table class="#{@members.present? ? 'sortable' : ''}" + table.table class=(@members.present? ? 'sortable' : '') thead tr th = t('activerecord.attributes.exercise.selection') @@ -13,4 +13,4 @@ td = b.check_box class: 'form-check-input' td = link_to_if(policy(b.object.user).show?, b.object.user.displayname, b.object.user) - .actions = render('shared/submit_button', f: f, object: @programming_group) + .actions = render('shared/submit_button', f:, object: @programming_group) diff --git a/app/views/programming_groups/index.html.slim b/app/views/programming_groups/index.html.slim index a94e9e36..1434757a 100644 --- a/app/views/programming_groups/index.html.slim +++ b/app/views/programming_groups/index.html.slim @@ -14,7 +14,7 @@ h1 = "#{ProgrammingGroup.model_name.human(count: 2)} for Exercise '#{@exercise.title}'" .table-responsive - table.table.mt-4 class="#{@programming_groups.present? ? 'sortable' : ''}" + table.table.mt-4 class=(@programming_groups.present? ? 'sortable' : '') thead tr th.sortable_nosort = sort_link(@search, :id, t('activerecord.attributes.programming_group.name')) @@ -33,11 +33,11 @@ tr td = link_to_if(policy(programming_group).show?, programming_group.displayname, programming_group) - if params[:exercise_id].blank? - td = link_to_if(policy(programming_group.exercise).show?, programming_group.exercise.title, programming_group.exercise, 'data-turbolinks' => "false") - td == programming_group.users.map { |user| link_to_if(policy(user).show?, user.name, user) }.join(', ') + td = link_to_if(policy(programming_group.exercise).show?, programming_group.exercise.title, programming_group.exercise, 'data-turbolinks': 'false') + td == programming_group.users.map {|user| link_to_if(policy(user).show?, user.name, user) }.join(', ') td = programming_group.users.size td = l(programming_group.created_at, format: :short) td = link_to(t('shared.show'), programming_group) if policy(programming_group).show? td = link_to(t('shared.edit'), edit_programming_group_path(programming_group)) if policy(programming_group).edit? - td = link_to(t('shared.destroy'), programming_group, data: { confirm: t('shared.confirm_destroy') }, method: :delete) if policy(programming_group).destroy? + td = link_to(t('shared.destroy'), programming_group, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(programming_group).destroy? = render('shared/pagination', collection: @programming_groups) diff --git a/app/views/programming_groups/new.html.slim b/app/views/programming_groups/new.html.slim index 14f483f2..94a426d6 100644 --- a/app/views/programming_groups/new.html.slim +++ b/app/views/programming_groups/new.html.slim @@ -15,7 +15,6 @@ h1.d-inline-block = t('programming_groups.new.create_programming_pair') h5 = t('programming_groups.new.work_with_a_friend') p = t('programming_groups.new.enter_partner_id', exercise_title: @exercise.title) - => t('programming_groups.new.own_user_id') b = current_user.id_with_type .d-md-none diff --git a/app/views/programming_groups/show.html.slim b/app/views/programming_groups/show.html.slim index cdeb47bc..0fb8195f 100644 --- a/app/views/programming_groups/show.html.slim +++ b/app/views/programming_groups/show.html.slim @@ -10,10 +10,10 @@ h1 h2.mt-4 = t('activerecord.attributes.study_group.members') .table-responsive - table.table class="#{@programming_group.users.present? ? 'sortable' : ''}" + table.table class=(@programming_group.users.present? ? 'sortable' : '') thead tr - th = t('navigation.sections.contributors') + th = t('navigation.sections.contributors') - @programming_group.users.each do |user| tr td = link_to_if(policy(user).show?, user.displayname, user) diff --git a/app/views/proxy_exercises/_form.html.slim b/app/views/proxy_exercises/_form.html.slim index b390f3a1..49f18c65 100644 --- a/app/views/proxy_exercises/_form.html.slim +++ b/app/views/proxy_exercises/_form.html.slim @@ -5,10 +5,10 @@ = f.text_field(:title, class: 'form-control', required: true) .mb-3 = f.label(:description, class: 'form-label') - = f.pagedown :description, input_html: { preview: true, rows: 10 } + = f.pagedown :description, input_html: {preview: true, rows: 10} .mb-3 = f.label(:algorithm, class: 'form-label') - = f.collection_select(:algorithm, ProxyExercise.algorithms.map { |algorithm, _id| [t("activerecord.attributes.proxy_exercise.algorithm_type.#{algorithm}"), algorithm] }, :second, :first, {}, class: 'form-control form-control-sm') + = f.collection_select(:algorithm, ProxyExercise.algorithms.map {|algorithm, _id| [t("activerecord.attributes.proxy_exercise.algorithm_type.#{algorithm}"), algorithm] }, :second, :first, {}, class: 'form-control form-control-sm') .form-check.mb-3 label.form-check-label = f.check_box(:public, class: 'form-check-input') @@ -28,4 +28,4 @@ td = link_to_if(policy(b.object).show?, b.object, b.object) td = l(b.object.created_at, format: :short) - .actions = render('shared/submit_button', f: f, object: @proxy_exercise) \ No newline at end of file + .actions = render('shared/submit_button', f:, object: @proxy_exercise) diff --git a/app/views/proxy_exercises/edit.html.slim b/app/views/proxy_exercises/edit.html.slim index 8aa200c9..39ddd012 100644 --- a/app/views/proxy_exercises/edit.html.slim +++ b/app/views/proxy_exercises/edit.html.slim @@ -1,3 +1,3 @@ -h1 = t('activerecord.models.proxy_exercise.one', model: ProxyExercise.model_name.human)+ ": " + @proxy_exercise.title +h1 = "#{t('activerecord.models.proxy_exercise.one', model: ProxyExercise.model_name.human)}: #{@proxy_exercise.title}" = render('form') diff --git a/app/views/proxy_exercises/index.html.slim b/app/views/proxy_exercises/index.html.slim index 74266aab..40423990 100644 --- a/app/views/proxy_exercises/index.html.slim +++ b/app/views/proxy_exercises/index.html.slim @@ -27,11 +27,11 @@ h1 = ProxyExercise.model_name.human(count: 2) td.p-1 .btn-group - button.btn.btn-outline-primary.btn-sm.dropdown-toggle data-bs-toggle="dropdown" type="button" = t('shared.actions_button') + button.btn.btn-outline-primary.btn-sm.dropdown-toggle data-bs-toggle='dropdown' type='button' = t('shared.actions_button') span.caret span.visually-hidden Toggle Dropdown - ul.dropdown-menu.float-end role="menu" - li = link_to(t('shared.show'), proxy_exercise, 'data-turbolinks' => "false", class: 'dropdown-item') if policy(proxy_exercise).show? + ul.dropdown-menu.float-end role='menu' + li = link_to(t('shared.show'), proxy_exercise, 'data-turbolinks': 'false', class: 'dropdown-item') if policy(proxy_exercise).show? li = link_to(t('shared.destroy'), proxy_exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(proxy_exercise).destroy? li = link_to(t('.clone'), clone_proxy_exercise_path(proxy_exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post, class: 'dropdown-item') if policy(proxy_exercise).clone? diff --git a/app/views/request_for_comments/_admin_menu.html.slim b/app/views/request_for_comments/_admin_menu.html.slim index 030e3276..e22a4677 100644 --- a/app/views/request_for_comments/_admin_menu.html.slim +++ b/app/views/request_for_comments/_admin_menu.html.slim @@ -1,9 +1,9 @@ hr h5.mt-4 Admin Menu ul.text - li = link_to "Clear question text (in case of explicit text)", clear_question_request_for_comment_path(id: @request_for_comment.id), method: :post if policy(@request_for_comment).clear_question? + li = link_to 'Clear question text (in case of explicit text)', clear_question_request_for_comment_path(id: @request_for_comment.id), method: :post if policy(@request_for_comment).clear_question? li = link_to "User's current status of this exercise", statistics_external_user_exercise_path(id: @request_for_comment.exercise_id, external_user_id: @request_for_comment.user_id) if policy(@request_for_comment.exercise).statistics? - li = link_to "All exercises of this user", statistics_external_user_path(id: @request_for_comment.user_id) if policy(@request_for_comment.user).statistics? + li = link_to 'All exercises of this user', statistics_external_user_path(id: @request_for_comment.user_id) if policy(@request_for_comment.user).statistics? ul.text - li = link_to "Implement the exercise yourself", implement_exercise_path(id: @request_for_comment.exercise_id) if policy(@request_for_comment.exercise).implement? - li = link_to "Show the exercise", exercise_path(id: @request_for_comment.exercise_id) if policy(@request_for_comment.exercise).show? + li = link_to 'Implement the exercise yourself', implement_exercise_path(id: @request_for_comment.exercise_id) if policy(@request_for_comment.exercise).implement? + li = link_to 'Show the exercise', exercise_path(id: @request_for_comment.exercise_id) if policy(@request_for_comment.exercise).show? diff --git a/app/views/request_for_comments/_list_entry.html.slim b/app/views/request_for_comments/_list_entry.html.slim index 1c841138..65c72bdb 100644 --- a/app/views/request_for_comments/_list_entry.html.slim +++ b/app/views/request_for_comments/_list_entry.html.slim @@ -1,9 +1,9 @@ tr.table-row-clickable data-id=request_for_comment.id data-href=request_for_comment_path(request_for_comment) td.p-2 - if request_for_comment.solved? - span.fa-solid.fa-check.fa-2x.text-success aria-hidden="true" + span.fa-solid.fa-check.fa-2x.text-success aria-hidden='true' - elsif request_for_comment.full_score_reached - span.fa-solid.fa-check.fa-2x style="color: var(--bs-secondary-text-emphasis);" aria-hidden="true" + span.fa-solid.fa-check.fa-2x.text-secondary-emphasis aria-hidden='true' - else = '' td.text-center = request_for_comment.comments.size diff --git a/app/views/request_for_comments/index.html.slim b/app/views/request_for_comments/index.html.slim index c0f52d6c..38b92aff 100644 --- a/app/views/request_for_comments/index.html.slim +++ b/app/views/request_for_comments/index.html.slim @@ -8,25 +8,25 @@ h1 = RequestForComment.model_name.human(count: 2) = f.label(:exercise_title_cont, t('activerecord.attributes.request_for_comments.exercise'), class: 'visually-hidden form-label') = f.search_field(:exercise_title_cont, class: 'form-control', placeholder: t('activerecord.attributes.request_for_comments.exercise')) .col-auto.mt-3.mt-md-0 - = f.label(:title_cont, t('request_for_comments.solved'), class: 'visually-hidden form-label') - = f.select(:solved_not_eq, [[t('request_for_comments.show_all'), 2], [t('request_for_comments.show_unsolved'), 1], [t('request_for_comments.show_solved'), 0]]) + = f.label(:title_cont, t('request_for_comments.solved'), class: 'visually-hidden form-label') + = f.select(:solved_not_eq, [[t('request_for_comments.show_all'), 2], [t('request_for_comments.show_unsolved'), 1], [t('request_for_comments.show_solved'), 0]]) - unless current_user.consumer.rfc_visibility_study_group? .row .col - = f.label(:submission_study_group_id_eq, t('request_for_comments.index.study_groups.placeholder'), class: 'visually-hidden form-label') + = f.label(:submission_study_group_id_eq, t('request_for_comments.index.study_groups.placeholder'), class: 'visually-hidden form-label') = f.grouped_collection_select(:submission_study_group_id_in, @study_groups_grouping, :second, :first, :id, :to_s, {}, - { class: 'form-control', multiple: true, "data-placeholder": t('request_for_comments.index.study_groups.placeholder') }) + {class: 'form-control', multiple: true, 'data-placeholder': t('request_for_comments.index.study_groups.placeholder')}) .table-responsive - table.table.mt-4 class="#{@request_for_comments.present? ? 'sortable' : ''}" + table.table.mt-4 class=(@request_for_comments.present? ? 'sortable' : '') thead tr th - i class="fa-regular fa-lightbulb" aria-hidden="true" title = t('request_for_comments.solved') align="right" - th.sorttable_nosort = sort_link(@search, :title, t('activerecord.attributes.request_for_comments.exercise')) + i.fa-regular.fa-lightbulb aria-hidden='true' title = t('request_for_comments.solved') align='right' + th.sorttable_nosort = sort_link(@search, :title, t('activerecord.attributes.request_for_comments.exercise')) th = t('activerecord.attributes.request_for_comments.question') th - i class="fa-solid fa-comment" aria-hidden="true" title = t('request_for_comments.comments') align="center" + i.fa-solid.fa-comment aria-hidden='true' title = t('request_for_comments.comments') align='center' th = t('activerecord.attributes.request_for_comments.username') th = t('activerecord.attributes.request_for_comments.requested_at') th = t('activerecord.attributes.request_for_comments.last_update') @@ -35,10 +35,10 @@ h1 = RequestForComment.model_name.human(count: 2) tr data-id=request_for_comment.id - if request_for_comment.solved? td - span class="fa-solid fa-check" aria-hidden="true" + span.fa-solid.fa-check aria-hidden='true' - elsif request_for_comment.full_score_reached td - span class="fa-solid fa-check" style="color: var(--bs-secondary-text-emphasis);" aria-hidden="true" + span.fa-solid.fa-check.text-secondary-emphasis aria-hidden='true' - else td = '' td = link_to_if(policy(request_for_comment).show?, request_for_comment.submission.exercise.title, request_for_comment) diff --git a/app/views/request_for_comments/show.html.slim b/app/views/request_for_comments/show.html.slim index 923c90fa..4c71f450 100644 --- a/app/views/request_for_comments/show.html.slim +++ b/app/views/request_for_comments/show.html.slim @@ -1,12 +1,12 @@ .list-group - h4#exercise_caption.list-group-item-heading data-exercise-id="#{@request_for_comment.exercise.id}" data-rfc-id="#{@request_for_comment.id}" + h4#exercise_caption.list-group-item-heading data-exercise-id=@request_for_comment.exercise.id data-rfc-id=@request_for_comment.id - if @request_for_comment.solved? - span.fa-solid.fa-check.me-2 aria-hidden="true" + span.fa-solid.fa-check.me-2 aria-hidden='true' = link_to_if(policy(@request_for_comment.exercise).show?, @request_for_comment.exercise.title, [:implement, @request_for_comment.exercise]) p.list-group-item-text - user = @request_for_comment.user - - submission = @request_for_comment.submission - - testruns = Testrun.where(:submission_id => @request_for_comment.submission) + - submission = @request_for_comment.submission + - testruns = Testrun.where(submission_id: @request_for_comment.submission) = link_to_if(policy(user).show?, user.displayname, user) | | #{@request_for_comment.created_at.localtime} - if @request_for_comment.submission.study_group.present? && policy(@request_for_comment.submission).show_study_group? @@ -25,33 +25,33 @@ = t('activerecord.attributes.request_for_comments.question') .text - question = @request_for_comment.question - = question.blank? ? t('request_for_comments.no_question') : question + = question.presence || t('request_for_comments.no_question') - - if policy(@request_for_comment).mark_as_solved? and not @request_for_comment.solved? + - if policy(@request_for_comment).mark_as_solved? && !@request_for_comment.solved? = render('mark_as_solved') - - if testruns.size > 0 + - if testruns.size.positive? .testruns - - output_runs = testruns.select {|run| run.cause == 'run'} - - if output_runs.size > 0 - h5.mt-4= t('request_for_comments.runtime_output') + - output_runs = testruns.select {|run| run.cause == 'run' } + - if output_runs.size.positive? + h5.mt-4 = t('request_for_comments.runtime_output') .collapsed.testrun-output.text span.fa-solid.fa-chevron-down.collapse-button - output_runs.each do |testrun| - pre= testrun.log or t('request_for_comments.no_output') + pre = testrun.log || t('request_for_comments.no_output') - assess_runs = testruns.select {|run| run.cause == 'assess' } - unless current_user.admin? - - assess_runs = assess_runs.select {|run| run.file.present? ? !run.file.hidden_feedback?: true } - - if assess_runs.size > 0 - h5.mt-4= t('request_for_comments.test_results') + - assess_runs = assess_runs.select {|run| run.file.present? ? !run.file.hidden_feedback? : true } + - if assess_runs.size.positive? + h5.mt-4 = t('request_for_comments.test_results') .testrun-assess-results - assess_runs.each do |testrun| .testrun-container - div class=("result #{testrun.passed ? 'passed' : 'failed'}") + div class="result #{testrun.passed ? 'passed' : 'failed'}" .collapsed.testrun-output.text span.fa-solid.fa-chevron-down.collapse-button - pre= testrun.log or t('request_for_comments.no_output') + pre = testrun.log || t('request_for_comments.no_output') - if current_user.admin? && user.is_a?(ExternalUser) = render('admin_menu') @@ -69,12 +69,12 @@ | do not put a carriage return in the line below. it will be present in the presentation of the source code, otherwise. | also, all settings from the rails model needed for the editor configuration in the JavaScript are attached to the editor as data attributes here. - submission.files.each do |file| - = (file.path or "") + "/" + file.name + file.file_type.file_extension + = "#{file.path || ''}/#{file.name}#{file.file_type.file_extension}" br |    - i.fa-solid.fa-arrow-down aria-hidden="true" + i.fa-solid.fa-arrow-down aria-hidden='true' = t('request_for_comments.click_here') - #commentitor.editor data-file-id="#{file.id}" data-mode="#{file.file_type.editor_mode}" data-read-only="true" + #commentitor.editor data-file-id=file.id data-mode=file.file_type.editor_mode data-read-only='true' = file.content = render('shared/modal', id: 'comment-modal', title: t('exercises.implement.comment.dialogtitle'), template: 'exercises/_comment_dialogcontent') diff --git a/app/views/sessions/destroy_through_lti.html.slim b/app/views/sessions/destroy_through_lti.html.slim index 8399d9bf..c2184c6e 100644 --- a/app/views/sessions/destroy_through_lti.html.slim +++ b/app/views/sessions/destroy_through_lti.html.slim @@ -3,7 +3,7 @@ h1 = t('.headline') p = t(".success_#{@lti_parameter ? 'with' : 'without'}_outcome", consumer: current_user.consumer) ==< t(".finished_#{@lti_parameter ? 'with' : 'without'}_consumer", consumer: h(current_user.consumer.name), url: @url) - =< t(".do_not_use_backbutton") + =< t('.do_not_use_backbutton') h2 = t('shared.statistics') diff --git a/app/views/shared/_modal.html.slim b/app/views/shared/_modal.html.slim index 0733b314..c4f18e2c 100644 --- a/app/views/shared/_modal.html.slim +++ b/app/views/shared/_modal.html.slim @@ -6,9 +6,9 @@ button.btn-close data-bs-dismiss='modal' type='button' span.visually-hidden Close .modal-body - - if local_assigns.has_key?(:body) + - if local_assigns.key?(:body) = body - else - = render(layout: false, locals: (local_assigns[:template_variables] || {}).merge(modal: true), template: template) + = render(layout: false, locals: (local_assigns[:template_variables] || {}).merge(modal: true), template:) .modal-footer = yield(:modal_footer) diff --git a/app/views/statistics/activity_history.html.slim b/app/views/statistics/activity_history.html.slim index da9a50c9..bf9e7162 100644 --- a/app/views/statistics/activity_history.html.slim +++ b/app/views/statistics/activity_history.html.slim @@ -12,14 +12,14 @@ .graph id="#{resource}-activity-history" form .mb-3 - label for="from-date" = t('.from') - input type="date" class="form-control" id="from-date" name="from" value=(params[:from] || DateTime.new(2016).to_date) + label for='from-date' = t('.from') + input.form-control#from-date type='date' name='from' value=params[:from] || DateTime.new(2016).to_date .mb-3 - label for="to-date" = t('.to') - input type="date" class="form-control" id="to-date" name="to" value=(params[:to] || DateTime.now.to_date) + label for='to-date' = t('.to') + input.form-control#to-date type='date' name='to' value=params[:to] || DateTime.now.to_date .mb-3 - label for="interval" = t('.interval') - select class="form-control" id="interval" name="interval" - = [:year, :quarter, :month, :day, :hour, :minute, :second].each do | key | + label for='interval' = t('.interval') + select.form-control#interval name='interval' + = %i[year quarter month day hour minute second].each do |key| option selected=(key.to_s == params[:interval]) = key - button type="submit" class="btn btn-primary" = t('.update') + button.btn.btn-primary type='submit' = t('.update') diff --git a/app/views/statistics/show.html.slim b/app/views/statistics/show.html.slim index 9b7edefe..63af3da6 100644 --- a/app/views/statistics/show.html.slim +++ b/app/views/statistics/show.html.slim @@ -1,9 +1,8 @@ - #statistics-container - - statistics_data.each do | section | + - statistics_data.each do |section| h2 = section[:name] .statistics-wrapper data-key=section[:key] - - section[:entries].each do | entry | + - section[:entries].each do |entry| a href=entry[:url] div data-key=entry[:key] .title = entry[:name] diff --git a/app/views/study_groups/_form.html.slim b/app/views/study_groups/_form.html.slim index fc2407f8..f0118a90 100644 --- a/app/views/study_groups/_form.html.slim +++ b/app/views/study_groups/_form.html.slim @@ -6,7 +6,7 @@ h3 = t('activerecord.attributes.study_group.members') .table-responsive - table.table class="#{@members.present? ? 'sortable' : ''}" + table.table class=(@members.present? ? 'sortable' : '') thead tr th = t('activerecord.attributes.exercise.selection') @@ -16,4 +16,4 @@ td = b.check_box class: 'form-check-input' td = link_to_if(policy(b.object.user).show?, b.object.user.displayname, b.object.user) - .actions = render('shared/submit_button', f: f, object: @study_group) + .actions = render('shared/submit_button', f:, object: @study_group) diff --git a/app/views/study_groups/show.html.slim b/app/views/study_groups/show.html.slim index f25921e9..c4f52522 100644 --- a/app/views/study_groups/show.html.slim +++ b/app/views/study_groups/show.html.slim @@ -9,13 +9,12 @@ h1 = row(label: 'study_group.consumer', value: link_to_if(policy(@study_group).show?, @study_group.consumer, @study_group.consumer)) = row(label: 'study_group.member_count', value: @study_group.user_count) - h2.mt-4 = t('activerecord.attributes.study_group.members') .table-responsive - table.table class="#{@study_group.users.present? ? 'sortable' : ''}" + table.table class=(@study_group.users.present? ? 'sortable' : '') thead tr - th = t('navigation.sections.users') + th = t('navigation.sections.users') - @study_group.users.each do |user| tr td = link_to_if(policy(user).show?, user.displayname, user) diff --git a/app/views/submissions/index.html.slim b/app/views/submissions/index.html.slim index b5df6709..ae0b388a 100644 --- a/app/views/submissions/index.html.slim +++ b/app/views/submissions/index.html.slim @@ -6,7 +6,7 @@ h1 = Submission.model_name.human(count: 2) = f.collection_select(:exercise_id_eq, Exercise.with_submissions, :id, :title, class: 'form-control', prompt: t('activerecord.attributes.submission.exercise')) .col-auto = f.label(:cause_eq, t('activerecord.attributes.submission.cause'), class: 'visually-hidden form-label') - = f.select(:cause_eq, Submission.select(:cause).distinct.map(&:cause).sort, class: 'form-control', prompt: t('activerecord.attributes.submission.cause')) + = f.select(:cause_eq, Submission.distinct.pluck(:cause).sort, class: 'form-control', prompt: t('activerecord.attributes.submission.cause')) .table-responsive table.table.mt-4 diff --git a/app/views/submissions/show.html.slim b/app/views/submissions/show.html.slim index 62f58ee7..2f545546 100644 --- a/app/views/submissions/show.html.slim +++ b/app/views/submissions/show.html.slim @@ -18,4 +18,4 @@ h2.mt-4 = t('activerecord.attributes.submission.files') ul.list-unstyled - @files.each do |file| li.card.mt-2 - .card-body = render('shared/file', file: file) + .card-body = render('shared/file', file:) diff --git a/app/views/tags/_form.html.slim b/app/views/tags/_form.html.slim index 14763915..619ba8b6 100644 --- a/app/views/tags/_form.html.slim +++ b/app/views/tags/_form.html.slim @@ -3,4 +3,4 @@ .mb-3 = f.label(:name, class: 'form-label') = f.text_field(:name, class: 'form-control', required: true) - .actions = render('shared/submit_button', f: f, object: @tag) + .actions = render('shared/submit_button', f:, object: @tag) diff --git a/app/views/tags/index.html.slim b/app/views/tags/index.html.slim index 84e57dbb..a63ecdc2 100644 --- a/app/views/tags/index.html.slim +++ b/app/views/tags/index.html.slim @@ -12,7 +12,7 @@ h1 = Tag.model_name.human(count: 2) td = link_to_if(policy(tag).show?, tag.name, tag) td = link_to(t('shared.show'), tag) if policy(tag).show? td = link_to(t('shared.edit'), edit_tag_path(tag)) if policy(tag).edit? - td = link_to(t('shared.destroy'), tag, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if tag.can_be_destroyed? && policy(tag).destroy? + td = link_to(t('shared.destroy'), tag, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if tag.can_be_destroyed? && policy(tag).destroy? = render('shared/pagination', collection: @tags) p = render('shared/new_button', model: Tag, path: new_tag_path) diff --git a/app/views/tips/_collapsed_card.html.slim b/app/views/tips/_collapsed_card.html.slim index 4c2adaee..bc6595c6 100644 --- a/app/views/tips/_collapsed_card.html.slim +++ b/app/views/tips/_collapsed_card.html.slim @@ -1,16 +1,16 @@ - tip = exercise_tip.tip - index = exercise_tip_counter + 1 -.card class="#{exercise_tip.parent_exercise_tip_id? || exercise_tip.rank != 1 ? 'mt-2' : ''}" - .card-header.p-2 id="tip-heading-#{exercise_tip.id}" role="tab" +.card class=(exercise_tip.parent_exercise_tip_id? || exercise_tip.rank != 1 ? 'mt-2' : '') + .card-header.p-2 id="tip-heading-#{exercise_tip.id}" role='tab' .card-title.mb-0 - a.collapsed aria-controls="tip-collapse-#{exercise_tip.id}" aria-expanded="false" data-bs-parent="#tips" data-bs-toggle="collapse" href="#tip-collapse-#{exercise_tip.id}" - .clearfix role="button" - i.fa-solid aria-hidden="true" + a.collapsed aria-controls="tip-collapse-#{exercise_tip.id}" aria-expanded='false' data-bs-parent='#tips' data-bs-toggle='collapse' href="#tip-collapse-#{exercise_tip.id}" + .clearfix role='button' + i.fa-solid aria-hidden='true' span = t('activerecord.models.tip.one') =< tip_prefix + index.to_s = ": #{tip.title}" if tip.title? - .card.card-collapse.collapse id="tip-collapse-#{exercise_tip.id}" aria-labelledby="tip-heading-#{exercise_tip.id}" role="tabpanel" data-exercise-tip-id=exercise_tip.id + .card.card-collapse.collapse id="tip-collapse-#{exercise_tip.id}" aria-labelledby="tip-heading-#{exercise_tip.id}" role='tabpanel' data-exercise-tip-id=exercise_tip.id .card-body.p-3 - if tip.description? h5 @@ -24,4 +24,4 @@ = tip.example = render(partial: 'tips/collapsed_card', collection: exercise_tip.children, as: :exercise_tip, - locals: { tip_prefix: "#{tip_prefix + index.to_s}." }) + locals: {tip_prefix: "#{tip_prefix + index.to_s}."}) diff --git a/app/views/tips/_form.html.slim b/app/views/tips/_form.html.slim index 1af4f291..fc18afe6 100644 --- a/app/views/tips/_form.html.slim +++ b/app/views/tips/_form.html.slim @@ -5,17 +5,17 @@ = f.text_field(:title, class: 'form-control', required: false) .mb-3 = f.label(:description, class: 'form-label') - = f.pagedown :description, input_html: { preview: true, rows: 5 } + = f.pagedown :description, input_html: {preview: true, rows: 5} .mb-3 = f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'), class: 'form-label') = f.collection_select(:file_type_id, @file_types, :id, :name, {include_blank: true}, class: 'form-control') .mb-3 = f.label(:example, class: 'form-label') - = f.text_area(:example, class: 'code-field form-control', rows: 5, style: "display:none;", required: false) + = f.text_area(:example, class: 'code-field form-control', rows: 5, style: 'display:none;', required: false) #editor-edit.original-input data-file-id=@tip.id #frames .edit-frame .editor-content.d-none .editor.allow_ace_tooltip - .actions = render('shared/submit_button', f: f, object: @tip) + .actions = render('shared/submit_button', f:, object: @tip) .editor diff --git a/app/views/tips/_sortable_tip.html.slim b/app/views/tips/_sortable_tip.html.slim index 80587e0e..415ef25d 100644 --- a/app/views/tips/_sortable_tip.html.slim +++ b/app/views/tips/_sortable_tip.html.slim @@ -4,5 +4,5 @@ = tip.to_s a.fa-regular.fa-eye.ms-2 href=tip_path(tip) target='_blank' a.fa-solid.fa-xmark.ms-2.remove-tip href='#' - .list-group.nested-sortable-list class="#{exercise_tip.children.present? ? 'mt-3' : ''}" + .list-group.nested-sortable-list class=(exercise_tip.children.present? ? 'mt-3' : '') = render(partial: 'tips/sortable_tip', collection: exercise_tip.children, as: :exercise_tip) diff --git a/app/views/tips/index.html.slim b/app/views/tips/index.html.slim index 2e257374..22832ae1 100644 --- a/app/views/tips/index.html.slim +++ b/app/views/tips/index.html.slim @@ -1,7 +1,7 @@ h1 = Tip.model_name.human(count: 2) .table-responsive - table.table class="#{@tips.present? ? 'sortable' : ''}" + table.table class=(@tips.present? ? 'sortable' : '') thead tr th = t('activerecord.attributes.tip.title') @@ -14,7 +14,7 @@ h1 = Tip.model_name.human(count: 2) td = tip.file_type ? link_to_if(policy(tip.file_type).show?, tip.file_type.name, tip.file_type) : '' td = link_to(t('shared.show'), tip) if policy(tip).show? td = link_to(t('shared.edit'), edit_tip_path(tip)) if policy(tip).edit? - td = link_to(t('shared.destroy'), tip, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if tip.can_be_destroyed? && policy(tip).destroy? + td = link_to(t('shared.destroy'), tip, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if tip.can_be_destroyed? && policy(tip).destroy? = render('shared/pagination', collection: @tips) p = render('shared/new_button', model: Tip, path: new_tip_path) diff --git a/app/views/tips/show.html.slim b/app/views/tips/show.html.slim index be52d4c5..8cbc26ef 100644 --- a/app/views/tips/show.html.slim +++ b/app/views/tips/show.html.slim @@ -11,7 +11,5 @@ h1 = row(label: 'tip.title', value: @tip.title) = row(label: 'tip.description', value: render_markdown(@tip.description), class: 'm-0') -= row(label: 'file.file_type', value: @tip.file_type_id? ? \ - link_to_if(policy(@tip.file_type).show?, @tip.file_type.name, @tip.file_type) : '') -= row(label: 'tip.example', value: @tip.file_type_id? ? \ - code_tag(@tip.example, @tip.file_type.programming_language) : '') += row(label: 'file.file_type', value: @tip.file_type_id? ? link_to_if(policy(@tip.file_type).show?, @tip.file_type.name, @tip.file_type) : '') += row(label: 'tip.example', value: @tip.file_type_id? ? code_tag(@tip.example, @tip.file_type.programming_language) : '') diff --git a/app/views/user_exercise_feedbacks/_form.html.slim b/app/views/user_exercise_feedbacks/_form.html.slim index 3acc3468..f68f5430 100644 --- a/app/views/user_exercise_feedbacks/_form.html.slim +++ b/app/views/user_exercise_feedbacks/_form.html.slim @@ -1,7 +1,7 @@ = form_for([@exercise, @uef]) do |f| div - h1 id="exercise-headline" - = t('activerecord.models.user_exercise_feedback.one') + " " + @exercise.title + h1#exercise-headline + = "#{t('activerecord.models.user_exercise_feedback.one')} #{@exercise.title}" = render('shared/form_errors', object: @uef) p == t('user_exercise_feedback.description') @@ -9,18 +9,18 @@ u = t('activerecord.attributes.exercise.description') = render_markdown(@exercise.description) .mb-3 - = f.text_area(:feedback_text, class: 'form-control', required: true, :rows => "10") + = f.text_area(:feedback_text, class: 'form-control', required: true, rows: '10') h4.mt-4 = t('user_exercise_feedback.difficulty') - = f.collection_radio_buttons :difficulty, @texts, :first, :last do |b| + = f.collection_radio_buttons :difficulty, @texts, :first, :last do |b| .form-check label.form-check-label = b.radio_button(class: 'form-check-input') = b.text h4.mt-4 = t('user_exercise_feedback.working_time') - = f.collection_radio_buttons :user_estimated_worktime, @times, :first, :last do |b| + = f.collection_radio_buttons :user_estimated_worktime, @times, :first, :last do |b| .form-check label.form-check-label = b.radio_button(class: 'form-check-input') = b.text - = f.hidden_field(:exercise_id, :value => @exercise.id) - .actions = render('shared/submit_button', f: f, object: @uef) + = f.hidden_field(:exercise_id, value: @exercise.id) + .actions = render('shared/submit_button', f:, object: @uef) diff --git a/app/views/user_mailer/exercise_anomaly_detected.html.slim b/app/views/user_mailer/exercise_anomaly_detected.html.slim index 9b0835da..9bad9386 100644 --- a/app/views/user_mailer/exercise_anomaly_detected.html.slim +++ b/app/views/user_mailer/exercise_anomaly_detected.html.slim @@ -9,18 +9,18 @@ table(border=1) td = t('exercises.statistics.average_worktime', locale: :de) td = t('shared.actions', locale: :de) tbody - - @anomalies.keys.each do | id | + - @anomalies.each_key do |id| - exercise = Exercise.find(id) tr td = link_to_if(ExercisePolicy.new(@user, exercise).show?, exercise.title, exercise_url(exercise)) td = @anomalies[id] td = link_to_if(ExercisePolicy.new(@user, exercise).statistics?, t('shared.statistics', locale: :de), statistics_exercise_url(exercise)) - == t('mailers.user_mailer.exercise_anomaly_detected.body2', receiver_displayname: @receiver_displayname, collection_name: @collection.name) + table(border=1) thead tr @@ -28,7 +28,7 @@ table(border=1) td = t('exercises.statistics.average_worktime', locale: :en) td = t('shared.actions', locale: :en) tbody - - @anomalies.keys.each do | id | + - @anomalies.each_key do |id| - exercise = Exercise.find(id) tr td = link_to_if(ExercisePolicy.new(@user, exercise).show?, exercise.title, exercise_url(exercise)) diff --git a/app/views/user_mailer/got_new_comment.slim b/app/views/user_mailer/got_new_comment.slim index 2f9977e7..f15d9c08 100644 --- a/app/views/user_mailer/got_new_comment.slim +++ b/app/views/user_mailer/got_new_comment.slim @@ -4,4 +4,4 @@ commenting_user_displayname: @commenting_user_displayname, comment_text: @comment_text, link_my_comments: link_to(t('request_for_comments.index.my_comment_requests'), my_request_for_comments_url), - link_all_comments: link_to(t('request_for_comments.index.all'), request_for_comments_url) ) + link_all_comments: link_to(t('request_for_comments.index.all'), request_for_comments_url)) diff --git a/app/views/user_mailer/got_new_comment_for_subscription.html.slim b/app/views/user_mailer/got_new_comment_for_subscription.html.slim index 0bfae772..d86485ef 100644 --- a/app/views/user_mailer/got_new_comment_for_subscription.html.slim +++ b/app/views/user_mailer/got_new_comment_for_subscription.html.slim @@ -4,4 +4,4 @@ author_displayname: @author_displayname, comment_text: @comment_text, link_my_comments: link_to(t('request_for_comments.index.my_comment_requests'), my_request_for_comments_url), - link_all_comments: link_to(t('request_for_comments.index.all'), request_for_comments_url) ) + link_all_comments: link_to(t('request_for_comments.index.all'), request_for_comments_url)) diff --git a/app/views/user_mailer/send_thank_you_note.slim b/app/views/user_mailer/send_thank_you_note.slim index 6215ed54..aa0b0fe9 100644 --- a/app/views/user_mailer/send_thank_you_note.slim +++ b/app/views/user_mailer/send_thank_you_note.slim @@ -2,4 +2,4 @@ receiver_displayname: @receiver_displayname, link_to_comment: link_to(@rfc_link, @rfc_link), author: @author, - thank_you_note: @thank_you_note ) + thank_you_note: @thank_you_note)