Skip to content

Commit d503e84

Browse files
committed
Changed /read route to /archive and updated related links.
1 parent e5c5612 commit d503e84

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

‎app/controllers/stories_controller.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class Stringer < Sinatra::Base
88
erb :index
99
end
1010

11-
get "/read" do
11+
get "/archive" do
1212
@read_stories = StoryRepository.read.page(params[:page]).per_page(15)
1313

14-
erb :read
14+
erb :archive
1515
end
1616

1717
post "/mark_as_read" do

‎app/views/archive.erb‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
<% content_for :title do %>
2-
<% unless @all_stories.empty? %>
3-
<%= "(#{@all_stories.count})" %>
4-
<% end %>
5-
<% end %>
6-
71
<div id="action-bar">
82
<%= render_partial :feed_action_bar %>
93
</div>
104

11-
<% unless @all_stories.empty? %>
5+
<% unless @read_stories.empty? %>
126
<div id="stories">
137
<ul id="story-list">
14-
<% @all_stories.each do |story| %>
8+
<% @read_stories.each do |story| %>
159
<%= render_partial :story, { story: story } %>
1610
<% end %>
1711
</ul>
1812
</div>
13+
<div id="pagination">
14+
<% if @read_stories.previous_page %>
15+
<a href="?page=<%= @read_stories.previous_page %>"><i class="icon-double-angle-left"></i> Previous</a>
16+
<% end %>
17+
Page <%= @read_stories.current_page %> of <%= @read_stories.total_pages %>
18+
<% if @read_stories.next_page %>
19+
<a href="?page=<%= @read_stories.next_page %>">Next <i class="icon-double-angle-right"></i></a>
20+
<% end %>
21+
</div>
1922
<% else %>
2023
<div id="add-some-feeds">
21-
<p>Sorry, you don't have any feeds in your archive yet!</p>
24+
<p>Sorry, you haven't read any stories yet!</p>
2225
</div>
2326
<% end %>

‎app/views/partials/_action_bar.erb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212

1313
<div class="pull-right">
14-
<a class="btn btn-primary" id="feeds" href="/read" title="Read stories">
14+
<a class="btn btn-primary" id="feeds" href="/archive" title="Archived stories">
1515
<i class="icon-time"></i>
1616
</a>
1717
<a class="btn btn-primary" id="feeds" href="/feeds" title="<%= t('partials.action_bar.view_feeds') %>">

‎app/views/partials/_feed_action_bar.erb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</div>
77

88
<div class="pull-right">
9-
<a class="btn btn-primary" id="feeds" href="/read" title="Read stories">
9+
<a class="btn btn-primary" id="feeds" href="/archive" title="Archived stories">
1010
<i class="icon-time"></i>
1111
</a>
1212
<a class="btn btn-primary" id="feeds" href="/feeds" title="<%= t('partials.feed_action_bar.feeds') %>">

0 commit comments

Comments
 (0)