Skip to content

Commit e4ac5ac

Browse files
author
Miguel Barrenechea
committed
Stories fix
1 parent b1297a5 commit e4ac5ac

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

app/controllers/stories_controller.rb

+13-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@ class StoriesController < ApplicationController
1313
respond_to :json, :only => :index
1414

1515
def index
16-
redirect_to "/stayinformed/crowdsourced-stories"
16+
stories_per_page = 5
17+
18+
unless params['for_map']
19+
redirect_to '/stayinformed/crowdsourced-stories'
20+
@page = (params[:page] || 1).to_i
21+
@total_pages = (Api::Story.visible.count.to_f / stories_per_page.to_f).ceil
22+
@visible = Api::Story.find_by_page(@page, stories_per_page)
23+
return
24+
end
25+
26+
@title = I18n.translate 'stories.index.title'
27+
28+
respond_with @stories
1729
end
1830

1931
def show

0 commit comments

Comments
 (0)