Skip to content

Commit

Permalink
Rename old checkbox to checkbox_for
Browse files Browse the repository at this point in the history
  • Loading branch information
zw963 committed May 1, 2024
1 parent 0c23001 commit b693b3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/components/universities/checkbox_for.cr
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions src/components/universities/form_fields.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b693b3a

Please sign in to comment.