Skip to content

Commit 970df9e

Browse files
committed
[ Add ] Activity List widget
[ Optimize ] Replace Activities Calendar with Activities List
1 parent 75cbb6b commit 970df9e

File tree

7 files changed

+86
-29
lines changed

7 files changed

+86
-29
lines changed

ReadMe.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ git push
7171

7272
4. [博文资源](themes/Icarus/layout/widget/post_media.ejs)
7373

74-
5. [博文日历](themes/Icarus/layout/widget/calendar.ejs)
74+
5. [活动列表](themes/Icarus/layout/widget/activity_list.ejs)
7575

76-
6. [多点地图](themes/Icarus/layout/widget/marker_map.ejs)
76+
6. [活动日历](themes/Icarus/layout/widget/calendar.ejs)
7777

78-
7. [活动简讯](themes/Icarus/layout/widget/activity.ejs)
78+
7. [多点地图](themes/Icarus/layout/widget/marker_map.ejs)
79+
80+
8. [活动简讯](themes/Icarus/layout/widget/activity.ejs)
7981

8082
### 页面布局
8183

themes/Icarus/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ sidebar:
9797
right:
9898
# Whether the right sidebar is sticky when page scrolls
9999
# http://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/make-a-sidebar-sticky-when-page-scrolls/
100-
sticky: false
100+
sticky: true
101101
# Sidebar widget settings
102102
# http://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/
103103
widgets:

themes/Icarus/layout/activity.ejs

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1-
<h2 class="flex-box has-text-centered">
2-
<%= page.title %>
3-
<a class="btn btn-primary" href="launch">
4-
发起活动
5-
</a>
6-
</h2>
7-
<hr>
8-
<h3>日历</h3>
9-
<%-
10-
partial('widget/calendar', {
11-
posts: site.posts,
12-
type: page.type
13-
})
14-
%>
15-
<hr>
16-
<h3>地图</h3>
17-
<%-
18-
partial('widget/marker_map', {
19-
markers: site.posts.map(
20-
({title, permalink, address}) => (address && {title, URL: permalink, address})
21-
).filter( Boolean )
22-
})
23-
%>
1+
<main class="card">
2+
<div class="card-content content">
3+
<div class="flex-box">
4+
<h2 style="margin: 0">
5+
<%= page.title %>
6+
</h2>
7+
<a class="button is-link is-rounded" href="launch">
8+
发起活动
9+
</a>
10+
</div>
11+
12+
<h3>近期活动</h3>
13+
<%- partial('widget/activity_list', {
14+
posts: site.posts.sort('-date')
15+
}) %>
16+
<div style="text-align: center">
17+
<a class="button is-rounded" href="<%= url_for('categories/Activity/') %>">
18+
查看所有
19+
</a>
20+
</div>
21+
<hr>
22+
23+
<h3>FCC 成都社区的足迹</h3>
24+
<%-
25+
partial('widget/marker_map', {
26+
markers: site.posts.map(
27+
({title, permalink, address}) => (address && {title, URL: permalink, address})
28+
).filter( Boolean )
29+
})
30+
%>
31+
</div>
32+
</main>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<style>
2+
.activity-item {
3+
margin: 1rem 0;
4+
}
5+
.activity-item > :nth-child(n+2) {
6+
padding-left: 1rem;
7+
}
8+
.activity-item .flex-box {
9+
justify-content: space-between;
10+
}
11+
.activity-item .flex-box > :last-child {
12+
white-space: pre;
13+
text-align: center;
14+
}
15+
</style>
16+
17+
<% posts.filter(
18+
post => has_category(post, 'Activity')
19+
).slice(0, 5).forEach(post => { %>
20+
<a class="table-row activity-item" href="<%= post.permalink %>">
21+
<div class="image is-64x64">
22+
<img class="thumbnail" src="<%= get_thumbnail(post) %>" alt="<%= post.title %>">
23+
</div>
24+
<div>
25+
<div class="flex-box">
26+
<div>
27+
<h4><%= post.title %></h4>
28+
<%= post.description %>
29+
</div>
30+
<div>
31+
<%= date( post.start ) %>
32+
<%= time( post.start ) %>
33+
</div>
34+
</div>
35+
</div>
36+
</a>
37+
<% }) %>

themes/Icarus/layout/widget/post_media.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if ( authors ) { %>
2424
</div><%
2525
}
2626
27-
if ( photos ) { %>
27+
if ( photos[0] ) { %>
2828
<div class="content">
2929
<h3>精彩瞬间</h3>
3030
<%- partial('../widget/gallery', {images: photos}) %>

themes/Icarus/source/css/common.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ iframe, .embed-box {
1717
display: inline-block;
1818
vertical-align: top;
1919
}
20+
21+
.table-row {
22+
display: table;
23+
width: 100%;
24+
}
25+
.table-row > * {
26+
display: table-cell;
27+
vertical-align: middle;
28+
}

0 commit comments

Comments
 (0)