Skip to content

Commit

Permalink
编辑页面, 针对普通用户也显示院校信息.
Browse files Browse the repository at this point in the history
  • Loading branch information
zw963 committed Jun 11, 2024
1 parent 2ea1c12 commit a5d7c9d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/components/universities/form_fields.cr
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ class Universities::FormFields < BaseComponent
div class: "row" do
mount Shared::Field, op.name, "大学名称", &.text_input(placeholder: "大学完整名称")
end
else
div class: "row" do
div class: "m3" do
h4 op.name.value.to_s
end
div class: "m3" do
h4 op.batch_level.value.not_nil!.display_name
end
div class: "m3" do
if op.is_211.value
h4 "211 院校"
elsif op.is_985.value
h4 "985 院校"
elsif op.is_good.value
h4 "拥有双一流专业"
end
end
div class: "m3" do
h4 "#{op.record.not_nil!.city_display_name}"
end
end
end

if op.record
Expand Down
4 changes: 4 additions & 0 deletions src/models/university.cr
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,8 @@ class University < BaseModel
cwb.university_remark.to_s
end
end

def city_display_name
"#{province.name} #{city.name}"
end
end

0 comments on commit a5d7c9d

Please sign in to comment.