1
0
Fork 0

Organizing misc pages

This commit is contained in:
magnolia-fan 2011-11-27 12:41:28 +04:00
parent 6fa215cb2a
commit 8cf69faf32
12 changed files with 39 additions and 24 deletions

View File

@ -30,9 +30,11 @@ class window.BeatHaven
lang: 'ru'
init: ->
log "Initiatin BeatHaven ..."
window._vkontakte = new Vkontakte(2335068)
window._vkontakte.init()
window._vk_music = new VkontakteMusic
window._vk_music = new VkontakteMusic()
window._ajax = new Ajax()

View File

@ -8,6 +8,7 @@ class window.Vkontakte
@api_id
init: ->
log "Initiatin Vkontakte API ..."
window.vkAsyncInit = ->
VK.init apiId: _vkontakte.getApiId()
VK.Auth.getLoginStatus (response) ->

View File

@ -5,28 +5,19 @@ class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
def index; end
def greetings
render partial: 'greetings'
end
def about
render partial: 'about'
end
def stat
@artists = Artist.count
@albums = Album.count
@tracks = Track.count
@users = User.count
render partial: 'stat'
end
def cache_for time
response.headers['Cache-Control'] = 'public, max-age=' + time.seconds.to_s
end
def compile_page params
@data = params[:data]
render json: {
status: (params[:status] unless params[:status].nil?),
data: @data,
html: render_compact_partial(params[:partial])
}, include: (params[:include] unless params[:include].nil?)
end
protected
def authorize

View File

@ -0,0 +1,21 @@
class PageController < ApplicationController
def index
# Something
end
def greetings
render partial: 'greetings'
end
def about
render partial: 'about'
end
def stat
@artists = Artist.count
@albums = Album.count
@tracks = Track.count
@users = User.count
render partial: 'stat'
end
end

View File

@ -1,8 +1,8 @@
Beathaven::Application.routes.draw do
match '/' => 'application#index'
match '/greetings/' => 'application#greetings'
match '/about/' => 'application#about'
match '/stat/' => 'application#stat'
match '/' => 'page#index'
match '/greetings/' => 'page#greetings'
match '/about/' => 'page#about'
match '/stat/' => 'page#stat'
match 'user/auth' => 'user#auth'
match 'user/update' => 'user#update'
@ -21,5 +21,5 @@ Beathaven::Application.routes.draw do
match 'settings' => 'user#settings'
match 'artist/autocomplete' => 'last_fm#autocomplete'
match 'artist/(:name)' => 'artist#data', :constraints => { :name => /.*/ }
match 'artist/(:name)' => 'artist#data', constraints: { name: /.*/ }
end