Skip to content

Commit

Permalink
调整显示, 加仅显示备注学校过滤功能。
Browse files Browse the repository at this point in the history
  • Loading branch information
zw963 committed May 28, 2024
1 parent 1da4be6 commit 715590d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
11 changes: 7 additions & 4 deletions src/actions/universities/index.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Universities::Index < BrowserAction
param is_985 : Bool = false
param is_211 : Bool = false
param is_good : Bool = false
param is_exists_description : Bool = false
param chong_2023 : Bool = false
param chong_2022 : Bool = false
param chong_2021 : Bool = false
Expand Down Expand Up @@ -48,6 +49,8 @@ class Universities::Index < BrowserAction

query = query.is_good(true) if is_good

query = query.description.is_not_nil if is_exists_description

query = query.chong_2023(true) if chong_2023
query = query.chong_2022(true) if chong_2022
query = query.chong_2021(true) if chong_2021
Expand Down Expand Up @@ -77,7 +80,7 @@ class Universities::Index < BrowserAction
"range_min_value", "range_max_value",
"chong_2023", "chong_2022", "chong_2021", "chong_2020",
"wen_2023", "wen_2022", "wen_2021", "wen_2020",
"bao_2023", "bao_2022", "bao_2021", "bao_2020"
"bao_2023", "bao_2022", "bao_2021", "bao_2020",
]

if request.headers["HX-Trigger"]?
Expand Down Expand Up @@ -139,9 +142,9 @@ class Universities::Index < BrowserAction
max_value = range_max_value.zero? ? range_max.to_i : range_max_value

if filter_by_column.presence
params.from_query["range_min_value"] = min_value.to_s
params.from_query["range_max_value"] = max_value.to_s
params.from_query["order_by"] = "#{filter_by_column}_min" if click_on.blank?
params.from_query["range_min_value"] = min_value.to_s
params.from_query["range_max_value"] = max_value.to_s
params.from_query["order_by"] = "#{filter_by_column}_min" if click_on.blank?

case filter_by_column
when "ranking_2023"
Expand Down
25 changes: 17 additions & 8 deletions src/components/universities/main.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ class Universities::Main < BaseComponent
end
end

br

div class: "row" do
render_985_checkboxs
div class: "col m2" do
render_batch_level_dropdown
end
end

br

render_chong_wen_bao_checkboxs

br

mount PaginationLinks, pages unless pages.one_page?
render_universities
mount PaginationLinks, pages unless pages.one_page?
Expand Down Expand Up @@ -120,7 +126,7 @@ then set (next <input/>).value to my.value2
private def render_chong_wen_bao_checkboxs
div class: "row" do
fieldset class: "row", style: "width: 380px;" do
legend ""
legend "最近四年冲的学校"
span class: "switch m3" do
mount CheckBox, "chong_2023", "", all_name_inputs
end
Expand All @@ -139,7 +145,7 @@ then set (next <input/>).value to my.value2
end

fieldset class: "row", style: "width: 380px; margin-left: 20px;" do
legend ""
legend "最近四年稳的学校"
span class: "switch m3" do
mount CheckBox, "wen_2023", "", all_name_inputs
end
Expand All @@ -158,7 +164,7 @@ then set (next <input/>).value to my.value2
end

fieldset class: "row", style: "width: 380px; margin-left: 20px;" do
legend ""
legend "最近四年保的学校"
span class: "switch m3" do
mount CheckBox, "bao_2023", "", all_name_inputs
end
Expand All @@ -180,14 +186,17 @@ then set (next <input/>).value to my.value2

private def render_985_checkboxs
full_path = context.request.resource
div class: "switch col m3" do
div class: "switch col m2" do
mount CheckBox, "is_985", "仅显示985", all_name_inputs
end
div class: "switch col m3" do
div class: "switch col m2" do
mount CheckBox, "is_211", "仅显示211", all_name_inputs
end
div class: "switch col m3" do
mount CheckBox, "is_good", "显示包含双一流专业高校", all_name_inputs
div class: "switch col m2" do
mount CheckBox, "is_good", "仅显示包含双一流专业高校", all_name_inputs
end
div class: "switch col m2" do
mount CheckBox, "is_exists_description", "仅显示含备注学校", all_name_inputs
end
end

Expand Down Expand Up @@ -235,7 +244,7 @@ then set (next <input/>).value to my.value2
th "报考编码"
th "大学名称(点击名称编辑)"
th "录取批次"
th "补充信息"
th "备注"
order_by_score_description_2023 = "点击排序(低分优先)"
order_by_score_description_2022 = "点击排序(低分优先)"
order_by_score_description_2021 = "点击排序(低分优先)"
Expand Down

0 comments on commit 715590d

Please sign in to comment.