Skip to content

Commit 53bced3

Browse files
committed
created a new single feed action bar with a "Return to Home" button and edited the "Refresh" button to refresh the single feed only instead of going back to /news
1 parent b14183e commit 53bced3

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed

app/controllers/stories_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class Stringer < Sinatra::Base
1414
@stories = StoryRepository.feed(params[:feed_id])
1515
@unread_stories = @stories.find_all {|story| !story.is_read }
1616

17+
@feed_id = params[:feed_id]
18+
1719
erb :feed
1820
end
1921

app/views/feed.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<% end %>
66

77
<div id="action-bar">
8-
<%= render_partial :action_bar, { stories: @unread_stories } %>
8+
<%= render_partial :single_feed_action_bar, { stories: @unread_stories } %>
99
</div>
1010

1111
<div id="feed-title">
@@ -17,4 +17,4 @@
1717
<div id="stories">
1818
<ul id="story-list">
1919
</ul>
20-
</div>
20+
</div>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<div class="row-fluid">
2+
<div class="pull-left">
3+
<a class="btn" id="home" href="/news" title="<%= t('partials.feed_action_bar.home') %>">
4+
<i class="icon-reply"></i>
5+
</a>
6+
<a class="btn" id="mark-all" title="<%= t('partials.action_bar.mark_all') %>">
7+
<i class="icon-ok"></i>
8+
<%= render_partial :mark_all_as_read_form,
9+
{stories: stories} %>
10+
</a>
11+
<a class="btn" href="/feed/<%= @feed_id %>" id="refresh" title="<%= t('partials.action_bar.refresh') %>">
12+
<i class="icon-repeat"></i>
13+
</a>
14+
</div>
15+
16+
<div class="pull-right">
17+
<a class="btn btn-primary" id="starred" href="/starred" title="<%= t('partials.action_bar.starred_stories') %>">
18+
<i class="icon-star"></i>
19+
</a>
20+
<a class="btn btn-primary" id="archive" href="/archive" title="<%= t('partials.action_bar.archived_stories') %>">
21+
<i class="icon-time"></i>
22+
</a>
23+
<a class="btn btn-primary" id="feeds" href="/feeds" title="<%= t('partials.action_bar.view_feeds') %>">
24+
<i class="icon-list"></i>
25+
</a>
26+
<a class="btn btn-primary" id="add-feed" href="/feeds/new" title="<%= t('partials.action_bar.add_feed') %>">
27+
<i class="icon-plus"></i>
28+
</a>
29+
</div>
30+
</div>
31+
32+
<script type="text/javascript">
33+
$(document).ready(function() {
34+
$("#mark-all").click(function(e) {
35+
e.preventDefault();
36+
37+
$("form#mark-all-as-read").submit();
38+
});
39+
40+
Mousetrap.bind("r", function() {
41+
var refresh = $("a#refresh")[0];
42+
if (refresh) refresh.click();
43+
});
44+
45+
Mousetrap.bind("a", function() {
46+
var add_feed = $("a#add-feed")[0];
47+
if (add_feed) add_feed.click();
48+
});
49+
50+
Mousetrap.bind("shift+a", function() {
51+
$("form#mark-all-as-read").submit();
52+
});
53+
});
54+
</script>

0 commit comments

Comments
 (0)