From b693b3aa07a6703fa7952c3d3fb9614ed9a242d0 Mon Sep 17 00:00:00 2001 From: "Billy.Zheng" Date: Wed, 1 May 2024 20:03:39 +0800 Subject: [PATCH] Rename old checkbox to checkbox_for --- src/components/universities/checkbox_for.cr | 13 +++++++++++++ src/components/universities/form_fields.cr | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/components/universities/checkbox_for.cr diff --git a/src/components/universities/checkbox_for.cr b/src/components/universities/checkbox_for.cr new file mode 100644 index 0000000..ba54d0e --- /dev/null +++ b/src/components/universities/checkbox_for.cr @@ -0,0 +1,13 @@ +class Universities::CheckBoxFor < BaseComponent + needs attribute : Avram::PermittedAttribute(Bool) + needs id : String + needs description : String + + def render + label for: id, class: "s12 m8 input-field" do + checkbox(attribute, "false", "true", id: id) + span description + end + mount Shared::FieldErrors, attribute + end +end diff --git a/src/components/universities/form_fields.cr b/src/components/universities/form_fields.cr index 5fb76cc..dc84c3d 100644 --- a/src/components/universities/form_fields.cr +++ b/src/components/universities/form_fields.cr @@ -48,9 +48,9 @@ class Universities::FormFields < BaseComponent end div class: "row" do - mount CheckBox, op.is_211, "is_211", "是否 211 大学" - mount CheckBox, op.is_985, "is_985", "是否 985 大学" - mount CheckBox, op.is_good, "is_good", "是否拥有双一流专业" + mount CheckBoxFor, op.is_211, "is_211", "是否 211 大学" + mount CheckBoxFor, op.is_985, "is_985", "是否 985 大学" + mount CheckBoxFor, op.is_good, "is_good", "是否拥有双一流专业" end br