Skip to content

Commit

Permalink
add comments to stats
Browse files Browse the repository at this point in the history
  • Loading branch information
cesswairimu committed Feb 3, 2019
1 parent efdb169 commit 1523829
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def wikis
export_as_json('wiki')
end

def comments
data = Comment.where(status: 1).all.to_json
send_data data, :type => 'application/json; header=present', :disposition => "attachment; filename=comment.json"
end

private

def export_as_json(type)
Expand Down
6 changes: 6 additions & 0 deletions app/views/stats/stats_json.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
Download wikis as Json
</button>
</a>
<a href= "/stats/comments">
</button>
<button type="button" class="btn-lg btn-primary" title="Download wikis">
Download comments as Json
</button>
</a>
</div>
<br> <br>
<% @hash.each do |k,v| %>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
get 'stats/subscriptions' => 'stats#subscriptions'
get 'stats/notes' => 'stats#notes'
get 'stats/wikis' => 'stats#wikis'
get 'stats/comments' => 'stats#comments'
get 'stats/json' => 'stats#stats_json'
get 'feed' => 'notes#rss'
get 'rss.xml' => 'legacy#rss'
Expand Down

0 comments on commit 1523829

Please sign in to comment.