Cache fixes, vk like
This commit is contained in:
parent
23cf09613d
commit
06f6b7a9d2
|
@ -32,7 +32,7 @@ class window.Ajax
|
||||||
return false if @previous_page == _ajax.getAnchor()
|
return false if @previous_page == _ajax.getAnchor()
|
||||||
@previous_page = _ajax.getAnchor()
|
@previous_page = _ajax.getAnchor()
|
||||||
path = _ajax.getAnchor()
|
path = _ajax.getAnchor()
|
||||||
if path == "/"
|
if path in ["", "/"]
|
||||||
path = "/greetings/"
|
path = "/greetings/"
|
||||||
|
|
||||||
log "Ajax controller is detecting page for #{path} ..."
|
log "Ajax controller is detecting page for #{path} ..."
|
||||||
|
|
|
@ -13,6 +13,7 @@ class window.Vkontakte
|
||||||
window.vkAsyncInit = ->
|
window.vkAsyncInit = ->
|
||||||
VK.init apiId: _vkontakte.getApiId()
|
VK.init apiId: _vkontakte.getApiId()
|
||||||
_vkontakte.auth()
|
_vkontakte.auth()
|
||||||
|
VK.Widgets.Like("vk-like", {type: "mini", height: 20})
|
||||||
|
|
||||||
|
|
||||||
setTimeout ->
|
setTimeout ->
|
||||||
|
|
|
@ -42,11 +42,12 @@ table.stats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fb-like, .vk-like {
|
.fb-like, #vk-like {
|
||||||
float: left;
|
float: left;
|
||||||
|
clear: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vk-like td {
|
#vk-like td {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
border: none;
|
border: none;
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
|
|
|
@ -11,8 +11,8 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def compile_page params
|
def compile_page params
|
||||||
compiler = lambda do |params|
|
compiler = lambda do |params|
|
||||||
@data = params[:data].call(&(params[:data].lambda? ? :call : :serialize)) unless params[:data].nil?
|
@data = params[:data].is_a?(Proc) ? params[:data].call : params[:data].serialize unless params[:data].nil?
|
||||||
@status = params[:status] unless params[:status].nil?
|
@status = params[:status]
|
||||||
{
|
{
|
||||||
renderer: "unified",
|
renderer: "unified",
|
||||||
data: @data,
|
data: @data,
|
||||||
|
@ -23,8 +23,8 @@ class ApplicationController < ActionController::Base
|
||||||
}.to_json.to_s
|
}.to_json.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
unless params[:cache].nil?
|
unless params[:cache_for].nil?
|
||||||
data = Rails.cache.fetch(params[:cache_key] || cache_key_for(params[:data]), expires_in: params[:cache]) do
|
data = Rails.cache.fetch(params[:cache_key] || cache_key_for(params[:data]), expires_in: params[:cache_for]) do
|
||||||
compiler.call(params)
|
compiler.call(params)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -32,7 +32,7 @@ class ArtistController < ApplicationController
|
||||||
title: @artist.name,
|
title: @artist.name,
|
||||||
status: @artist.status_str,
|
status: @artist.status_str,
|
||||||
callback: {object: :player, action: :updateLibrary},
|
callback: {object: :player, action: :updateLibrary},
|
||||||
cache: 3.minutes
|
cache_for: 1.day
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PlaylistController < ApplicationController
|
||||||
partial: "playlist/tracks",
|
partial: "playlist/tracks",
|
||||||
title: "#{artist.name}: Last.fm TOP 50",
|
title: "#{artist.name}: Last.fm TOP 50",
|
||||||
callback: {object: :player, action: :updateLibrary},
|
callback: {object: :player, action: :updateLibrary},
|
||||||
cache: 3.minutes,
|
cache_for: 7.days,
|
||||||
cache_key: "lastfmtop50_#{artist.id}"
|
cache_key: "lastfmtop50_#{artist.id}"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.fb-like{ "data-href" => "http://facebook.com/BeatHavenHQ", "data-send" => "false", "data-layout" => "button_count", "data-width" => "100", "data-show-faces" => "false", "data-font" => "lucida grande" }
|
.fb-like{ "data-href" => "http://facebook.com/BeatHavenHQ", "data-send" => "false", "data-layout" => "button_count", "data-width" => "100", "data-show-faces" => "false", "data-font" => "lucida grande" }
|
||||||
.vk-like
|
#vk-like
|
||||||
%script{ type: "text/javascript" }
|
%script{ type: "text/javascript" }
|
||||||
= "document.write(VK.Share.button(false, {type: \"round\", text: \"#{t('global.like')}\"}));".html_safe
|
= "VK.Widgets.Like(\"vk_like\", {type: \"button\", height: 20, pageUrl: \"http://beathaven.org/\", text: \"#{t('global.like')}\"})"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
%link{ rel: "search", type: "application/opensearchdescription+xml", title: "BeatHaven", href: "/opensearch.xml"}
|
%link{ rel: "search", type: "application/opensearchdescription+xml", title: "BeatHaven", href: "/opensearch.xml"}
|
||||||
= stylesheet_link_tag :application, cache: true
|
= stylesheet_link_tag :application, cache: true
|
||||||
= javascript_include_tag :application, cache: true
|
= javascript_include_tag :application, cache: true
|
||||||
= javascript_include_tag "http://vkontakte.ru/js/api/share.js", charset: "windows-1251"
|
= javascript_include_tag "http://userapi.com/js/api/openapi.js?45", charset: "windows-1251"
|
||||||
%body
|
%body
|
||||||
#fb-root
|
#fb-root
|
||||||
.topbar-wrapper
|
.topbar-wrapper
|
||||||
|
|
Loading…
Reference in New Issue