File tree Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Expand file tree Collapse file tree 1 file changed +8
-17
lines changed Original file line number Diff line number Diff line change 15
15
end
16
16
end
17
17
18
- column do
19
- panel "最近的文章" do
20
- ul do
21
- Post . limit ( 15 ) . map do |post |
22
- omited_title = post . title . truncate ( 99 , separator : ' ' , omission : '...' )
23
- li link_to ( omited_title , system_post_path ( post ) )
24
- end
25
- end
26
- end
27
- end
28
-
29
- column do
30
- panel "最近的代码" do
31
- ul do
32
- Code . limit ( 15 ) . map do |code |
33
- omited_title = code . title . truncate ( 99 , separator : ' ' , omission : '...' )
34
- li link_to ( omited_title , system_code_path ( code ) )
18
+ { Post : "最近的文章" , Code : "最近的代码" } . each_pair do |key , value |
19
+ column do
20
+ panel value do
21
+ ul do
22
+ key . safe_constantize . limit ( 15 ) . map do |record |
23
+ omited_title = record . title . truncate ( 99 , separator : ' ' , omission : '...' )
24
+ li link_to ( omited_title , send ( "system_#{ record } _path" , record ) )
25
+ end
35
26
end
36
27
end
37
28
end
You can’t perform that action at this time.
0 commit comments