Rename PagedownFormBuilder to MarkdownFormBuilder

The term 'Pagedown' was originally associated with the pagedown-bootstrap
library, which is no longer in use.
This commit is contained in:
Julia Casamitjana
2024-04-11 10:44:44 +02:00
committed by Dominic Sauer
parent 0667cbeefb
commit 17a4485ce2
5 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@
* ToastUi editor initializer * ToastUi editor initializer
* *
* This script transforms form textareas created with * This script transforms form textareas created with
* "PagedownFormBuilder" into ToastUi markdown editors. * "MarkdownFormBuilder" into ToastUi markdown editors.
* *
*/ */

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class PagedownFormBuilder < ActionView::Helpers::FormBuilder class MarkdownFormBuilder < ActionView::Helpers::FormBuilder
def pagedown(method, args = {}) def markdown(method, args = {})
# Adopt simple form builder to work with form_for # Adopt simple form builder to work with form_for
@attribute_name = method @attribute_name = method
@input_html_options = args[:input_html] @input_html_options = args[:input_html]

View File

@ -9,7 +9,7 @@
- execution_environments = ExecutionEnvironment.where.not(file_type_id: nil).select(:file_type_id, :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) - file_types = FileType.where.not(file_extension: nil).select(:file_extension, :id)
= form_for(@exercise, data: {execution_environments:, file_types:}, multipart: true, builder: PagedownFormBuilder) do |f| = form_for(@exercise, data: {execution_environments:, file_types:}, multipart: true, builder: MarkdownFormBuilder) do |f|
= render('shared/form_errors', object: @exercise) = render('shared/form_errors', object: @exercise)
.mb-3 .mb-3
= f.label(:title, class: 'form-label') = f.label(:title, class: 'form-label')
@ -20,7 +20,7 @@
.help-block.form-text == t('.hints.internal_title') .help-block.form-text == t('.hints.internal_title')
.mb-3 .mb-3
= f.label(:description, class: 'form-label') = f.label(:description, class: 'form-label')
= f.pagedown :description = f.markdown :description
.mb-3 .mb-3
= f.label(:execution_environment_id, class: 'form-label') = 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') = f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {include_blank: t('exercises.form.none')}, class: 'form-control')

View File

@ -5,14 +5,14 @@
- append_javascript_pack_tag('toast-ui') - append_javascript_pack_tag('toast-ui')
- append_stylesheet_pack_tag('toast-ui') - append_stylesheet_pack_tag('toast-ui')
= form_for(@proxy_exercise, multipart: true, builder: PagedownFormBuilder) do |f| = form_for(@proxy_exercise, multipart: true, builder: MarkdownFormBuilder) do |f|
= render('shared/form_errors', object: @proxy_exercise) = render('shared/form_errors', object: @proxy_exercise)
.mb-3 .mb-3
= f.label(:title, class: 'form-label') = f.label(:title, class: 'form-label')
= f.text_field(:title, class: 'form-control', required: true) = f.text_field(:title, class: 'form-control', required: true)
.mb-3 .mb-3
= f.label(:description, class: 'form-label') = f.label(:description, class: 'form-label')
= f.pagedown :description = f.markdown :description
.mb-3 .mb-3
= f.label(:algorithm, class: 'form-label') = 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')

View File

@ -5,14 +5,14 @@
- append_javascript_pack_tag('toast-ui') - append_javascript_pack_tag('toast-ui')
- append_stylesheet_pack_tag('toast-ui') - append_stylesheet_pack_tag('toast-ui')
= form_for(@tip, builder: PagedownFormBuilder) do |f| = form_for(@tip, builder: MarkdownFormBuilder) do |f|
= render('shared/form_errors', object: @tip) = render('shared/form_errors', object: @tip)
.mb-3 .mb-3
= f.label(:title, class: 'form-label') = f.label(:title, class: 'form-label')
= f.text_field(:title, class: 'form-control', required: false) = f.text_field(:title, class: 'form-control', required: false)
.mb-3 .mb-3
= f.label(:description, class: 'form-label') = f.label(:description, class: 'form-label')
= f.pagedown :description = f.markdown :description
.mb-3 .mb-3
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'), class: 'form-label') = 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') = f.collection_select(:file_type_id, @file_types, :id, :name, {include_blank: true}, class: 'form-control')