Skip to content

Commit 3821136

Browse files
author
Matt Swanson
committed
dont display archive in tutorial.
1 parent b54a47f commit 3821136

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

app/controllers/stories_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
class Stringer < Sinatra::Base
55
get "/news" do
66
@unread_stories = StoryRepository.unread
7+
@read_count = StoryRepository.read_count
78

89
erb :index
910
end
1011

1112
get "/archive" do
1213
@read_stories = StoryRepository.read(params[:page])
14+
@read_count = @read_stories.length
1315

1416
erb :archive
1517
end

app/repositories/story_repository.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def self.read(page = 1)
3131
Story.where(is_read: true).order("published desc").page(page).per_page(15)
3232
end
3333

34+
def self.read_count
35+
Story.where(is_read: true).count
36+
end
37+
3438
def self.extract_content(entry)
3539
if entry.content
3640
entry.content.sanitize

app/views/index.erb

Lines changed: 1 addition & 1 deletion
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 :action_bar, { stories: @unread_stories } %>
99
</div>
1010

1111
<% unless @unread_stories.empty? %>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div class="row-fluid">
2+
<div class="pull-left">
3+
<a class="btn" id="mark-all" title="<%= t('partials.action_bar.mark_all') %>">
4+
<i class="icon-ok"></i>
5+
<%= render_partial :mark_all_as_read_form,
6+
{stories: stories} %>
7+
</a>
8+
<a class="btn" href="/" id="refresh" title="<%= t('partials.action_bar.refresh') %>">
9+
<i class="icon-repeat"></i>
10+
</a>
11+
</div>
12+
13+
<div class="pull-right">
14+
<a class="btn btn-primary" id="feeds" href="/feeds" title="<%= t('partials.action_bar.view_feeds') %>">
15+
<i class="icon-list"></i>
16+
</a>
17+
<a class="btn btn-primary" id="add-feed" href="/feeds/new" title="<%= t('partials.action_bar.add_feed') %>">
18+
<i class="icon-plus"></i>
19+
</a>
20+
</div>
21+
</div>

app/views/tutorial.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</div>
2020

2121
<div id="action-bar">
22-
<%= render_partial :action_bar, {stories: @sample_stories} %>
22+
<%= render_partial :tutorial_action_bar, {stories: @sample_stories} %>
2323
</div>
2424

2525
<div id="stories">

0 commit comments

Comments
 (0)