Stats page
This commit is contained in:
@@ -17,6 +17,11 @@ class window.Ajax
|
||||
_ajax.setTitle 'About'
|
||||
false
|
||||
|
||||
loadStatPage: ->
|
||||
$('#content').load '/stat/'
|
||||
_ajax.setTitle 'Statistics'
|
||||
false
|
||||
|
||||
setArchor: (anchor) ->
|
||||
@referer = this.getAnchor()
|
||||
window.location.hash = '#' +anchor
|
||||
@@ -41,6 +46,8 @@ class window.Ajax
|
||||
_settings.loadSettingsPage()
|
||||
else if _ajax.getAnchor().match /\/about\//
|
||||
_ajax.loadAboutPage()
|
||||
else if _ajax.getAnchor().match /\/stat\//
|
||||
_ajax.loadStatPage()
|
||||
else
|
||||
_ajax.loadIndexPage();
|
||||
false
|
||||
|
||||
@@ -35,6 +35,9 @@ $ ->
|
||||
$('.about').live 'click', ->
|
||||
_ajax.go '/about/'
|
||||
false
|
||||
$('.stat').live 'click', ->
|
||||
_ajax.go '/stat/'
|
||||
false
|
||||
$('body').live 'click', ->
|
||||
$('.dropdown-toggle, .menu').parent('li').removeClass('open')
|
||||
false
|
||||
|
||||
@@ -24,4 +24,8 @@
|
||||
padding: 200px 20px;
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.stats {
|
||||
width: 50%;
|
||||
}
|
||||
@@ -15,6 +15,14 @@ class ApplicationController < ActionController::Base
|
||||
render partial: 'about'
|
||||
end
|
||||
|
||||
def stat
|
||||
@artists = Artist.count
|
||||
@albums = Album.count
|
||||
@tracks = Track.count
|
||||
@users = User.count
|
||||
render partial: 'stat'
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def authorize
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
%h2 BeatHaven statistics
|
||||
|
||||
%table.zebra-striped.stats
|
||||
%tr
|
||||
%td
|
||||
%strong Artists
|
||||
%td= @artists
|
||||
%tr
|
||||
%td
|
||||
%strong Albums
|
||||
%td= @albums
|
||||
%tr
|
||||
%td
|
||||
%strong Tracks
|
||||
%td= @tracks
|
||||
%tr
|
||||
%td
|
||||
%strong Users
|
||||
%td= @users
|
||||
@@ -0,0 +1,19 @@
|
||||
%h2 Статистика BeatHaven
|
||||
|
||||
%table.zebra-striped.stats
|
||||
%tr
|
||||
%td
|
||||
%strong Исполнителей
|
||||
%td= @artists
|
||||
%tr
|
||||
%td
|
||||
%strong Альбомов
|
||||
%td= @albums
|
||||
%tr
|
||||
%td
|
||||
%strong Треков
|
||||
%td= @tracks
|
||||
%tr
|
||||
%td
|
||||
%strong Пользователей
|
||||
%td= @users
|
||||
@@ -19,7 +19,9 @@
|
||||
%li
|
||||
%a{ :href => "http://blog.beathaven.org/", :target => "_blank" }= I18n.t 'global.news'
|
||||
%li
|
||||
%a.about{ :href => "#/about/" }= I18n.t 'global.about'
|
||||
%a.about{ :href => "#/about/" }= I18n.t 'global.about'
|
||||
%li
|
||||
%a.stat{ :href => "#/stat/" }= I18n.t 'global.stat'
|
||||
%form#search-form{ :action => "" }
|
||||
%input#search{ :type => "text", :placeholder => I18n.t('global.search') }
|
||||
#artist-load-spinner
|
||||
|
||||
Reference in New Issue
Block a user