Stats page
This commit is contained in:
parent
50b5396f11
commit
2eec07dc4d
@ -17,6 +17,11 @@ class window.Ajax
|
|||||||
_ajax.setTitle 'About'
|
_ajax.setTitle 'About'
|
||||||
false
|
false
|
||||||
|
|
||||||
|
loadStatPage: ->
|
||||||
|
$('#content').load '/stat/'
|
||||||
|
_ajax.setTitle 'Statistics'
|
||||||
|
false
|
||||||
|
|
||||||
setArchor: (anchor) ->
|
setArchor: (anchor) ->
|
||||||
@referer = this.getAnchor()
|
@referer = this.getAnchor()
|
||||||
window.location.hash = '#' +anchor
|
window.location.hash = '#' +anchor
|
||||||
@ -41,6 +46,8 @@ class window.Ajax
|
|||||||
_settings.loadSettingsPage()
|
_settings.loadSettingsPage()
|
||||||
else if _ajax.getAnchor().match /\/about\//
|
else if _ajax.getAnchor().match /\/about\//
|
||||||
_ajax.loadAboutPage()
|
_ajax.loadAboutPage()
|
||||||
|
else if _ajax.getAnchor().match /\/stat\//
|
||||||
|
_ajax.loadStatPage()
|
||||||
else
|
else
|
||||||
_ajax.loadIndexPage();
|
_ajax.loadIndexPage();
|
||||||
false
|
false
|
||||||
|
@ -35,6 +35,9 @@ $ ->
|
|||||||
$('.about').live 'click', ->
|
$('.about').live 'click', ->
|
||||||
_ajax.go '/about/'
|
_ajax.go '/about/'
|
||||||
false
|
false
|
||||||
|
$('.stat').live 'click', ->
|
||||||
|
_ajax.go '/stat/'
|
||||||
|
false
|
||||||
$('body').live 'click', ->
|
$('body').live 'click', ->
|
||||||
$('.dropdown-toggle, .menu').parent('li').removeClass('open')
|
$('.dropdown-toggle, .menu').parent('li').removeClass('open')
|
||||||
false
|
false
|
||||||
|
@ -25,3 +25,7 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.stats {
|
||||||
|
width: 50%;
|
||||||
|
}
|
@ -15,6 +15,14 @@ class ApplicationController < ActionController::Base
|
|||||||
render partial: 'about'
|
render partial: 'about'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stat
|
||||||
|
@artists = Artist.count
|
||||||
|
@albums = Album.count
|
||||||
|
@tracks = Track.count
|
||||||
|
@users = User.count
|
||||||
|
render partial: 'stat'
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def authorize
|
def authorize
|
||||||
|
19
app/views/application/_stat.en.html.haml
Normal file
19
app/views/application/_stat.en.html.haml
Normal file
@ -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
|
19
app/views/application/_stat.ru.html.haml
Normal file
19
app/views/application/_stat.ru.html.haml
Normal file
@ -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
|
@ -20,6 +20,8 @@
|
|||||||
%a{ :href => "http://blog.beathaven.org/", :target => "_blank" }= I18n.t 'global.news'
|
%a{ :href => "http://blog.beathaven.org/", :target => "_blank" }= I18n.t 'global.news'
|
||||||
%li
|
%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 => "" }
|
%form#search-form{ :action => "" }
|
||||||
%input#search{ :type => "text", :placeholder => I18n.t('global.search') }
|
%input#search{ :type => "text", :placeholder => I18n.t('global.search') }
|
||||||
#artist-load-spinner
|
#artist-load-spinner
|
||||||
|
@ -3,6 +3,7 @@ en:
|
|||||||
search: "Search"
|
search: "Search"
|
||||||
news: "News"
|
news: "News"
|
||||||
about: "About"
|
about: "About"
|
||||||
|
stat: "Statistics"
|
||||||
login: "Log in"
|
login: "Log in"
|
||||||
logout: "Log out"
|
logout: "Log out"
|
||||||
do_add: "Add some music to playlist"
|
do_add: "Add some music to playlist"
|
||||||
|
@ -3,6 +3,7 @@ ru:
|
|||||||
search: "Поиск"
|
search: "Поиск"
|
||||||
news: "Новости"
|
news: "Новости"
|
||||||
about: "О проекте"
|
about: "О проекте"
|
||||||
|
stat: "Статистика"
|
||||||
login: "Войти"
|
login: "Войти"
|
||||||
logout: "Выйти"
|
logout: "Выйти"
|
||||||
do_add: "Добавьте музыку в плей-лист"
|
do_add: "Добавьте музыку в плей-лист"
|
||||||
|
@ -2,6 +2,7 @@ Beathaven::Application.routes.draw do
|
|||||||
match '/' => 'application#index'
|
match '/' => 'application#index'
|
||||||
match '/greetings/' => 'application#greetings'
|
match '/greetings/' => 'application#greetings'
|
||||||
match '/about/' => 'application#about'
|
match '/about/' => 'application#about'
|
||||||
|
match '/stat/' => 'application#stat'
|
||||||
|
|
||||||
match 'user/auth' => 'user#auth'
|
match 'user/auth' => 'user#auth'
|
||||||
match 'user/update' => 'user#update'
|
match 'user/update' => 'user#update'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user