We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1297a5 commit e4ac5acCopy full SHA for e4ac5ac
app/controllers/stories_controller.rb
@@ -13,7 +13,19 @@ class StoriesController < ApplicationController
13
respond_to :json, :only => :index
14
15
def index
16
- redirect_to "/stayinformed/crowdsourced-stories"
+ 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
29
end
30
31
def show
0 commit comments