-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnews.html.erb
175 lines (146 loc) · 3.99 KB
/
news.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name='generator' content='<%= Pluto.generator %>'>
<title><%= site.title %></title>
<%= stylesheet_link_tag 'css/news' %>
<!-- fix: use script_tag rails-style ??? -->
<script src='js/jquery-2.0.3.min.js'></script>
<script src='js/news.js'></script>
<%# = javascript_include_tag 'js/jquery-2.0.3.min.js' %>
<%# = javascript_include_tag 'js/news.js' %>
</head>
<body>
<h1><%= site.title %></h1>
<div class='stream' style='width: 800px;'>
<table>
<tr>
<td>
<div style='width: 50px; max-width: 50px;'></div>
</td>
<td width='100%'>
<!-- 2st column; filler column -->
<img src='i/view-headlines.png' id='show-headlines' title='Switch to headlines only view' width='16' height='16'>
<img src='i/view-snippets.png' id='show-snippets' title='Switch to snippet view' width='16' height='16'>
<img src='i/view-standard.png' id='show-fulltext' title='Switch to full text view' width='16' height='16'>
</td>
<td class='last-update' style='white-space: nowrap; text-align: right;'>
<!-- 3nd column -->
Updated
<% if site.fetched %>
<%= site.fetched.strftime('%A, %d %B %Y %H:%M') %>
<% end %>
</td>
</tr>
</table>
<!--
todo: order first by date and than by feed and than by datetime
- lets us group all feed items of a feed group together
-->
<%
items = site.items.latest.limit(24)
ItemCursor.new( items ).each do |item, new_date, new_feed|
%>
<div class='section' style='width: 800px;'>
<% if new_feed %>
<div class='header'>
<table width='100%'>
<tr>
<td>
<div style='width: 50px'>{}</div>
</td><!-- icon/logo -->
<td style='white-space: nowrap;'>
<span class='feed-title'>
<%= link_to item.feed.title, item.feed.url %>
(
<%= link_to 'Feed', item.feed.feed_url %>
)
</span>
</td><!-- feed title -->
<% if new_date %>
<td width='100%'>
<hr class='filler'>
</td><!-- filler -->
<td style='white-space: nowrap;'>
<span class='item-published'><%= item.published.strftime('%A, %d %B %Y') %></span>
</td><!-- item published -->
<% else %>
<td width='100%'>
<!-- note: width is a suggestion; will get smaller to fill space-->
</td>
<% end %>
</tr>
</table>
</div>
<% end %>
<div class='item' style='width: 800px;'>
<table width='100%'>
<tr>
<td>
<div style='width: 50px; max-width: 50px;'></div>
</td><!-- icon/logo; dummy for space -->
<td width='100%'>
<span class='item-title'>
<%= link_to item.title, item.url %>
</span>
</td>
</tr>
<tr>
<td>
<div style='width: 50px; max-width: 50px;'></div>
</td><!-- icon/logo; dummy for space -->
<td width='100%'>
<div class='item-body'>
<div class='item-snippet'>
<!-- use 'smarter' algorithm for cutoff snippet text
note: summary goes first; than try content -->
<% if item.summary %>
<%= textify( item.summary )[0..300] %>
<% elsif item.content %>
<%= textify( item.content )[0..300] %>
<% else %>
-/-
<% end %>
</div>
<div class='item-content item-summary'>
<!-- todo: use sanitize or simplify or whitelist
- todo/fix: check why summary can be nil/null
note: content goes first; than try summary
-->
<% if item.content %>
<%= textify( item.content ) %>
<% elsif item.summary %>
<%= textify( item.summary ) %>
<% else %>
-/-
<% end %>
</div>
<div class='item-footer'>
<%= item.published.strftime('%H:%M') %> •
<span class='item-time-ago-in-words'>
<%= time_ago_in_words( item.published ) %>
</span>
</div>
</div><!-- item-body -->
</td>
</tr>
</table>
</div> <!-- item -->
</div> <!-- section -->
<% end %><!-- each item -->
<div class='header'>
<table width='100%'>
<tr>
<td>
<div style='width: 50px; max-width: 50px;'></div>
</td>
<td width='100%'>
<hr class='item-separator'>
</td>
</tr>
</table>
</div>
</div> <!-- stream -->
</body>
</html>