Skip to content
Browse files

[^] fixcaching

  • Loading branch information...
1 parent b925991 commit df477f41950c62e8221779be5d70076b68bf121a @sergewhite committed
View
4 app/controllers/main_controller.rb
@@ -1,14 +1,14 @@
class MainController < ApplicationController
def index
@important_events = Event.published.important.ordered_by_day_of.first(5)
- @upcoming_left, @upcoming_right = Event.become.first(10).in_groups(2,false) {|group| p group}
+ @upcoming_left, @upcoming_right = Event.fetch_upcoming
@galery = Event.galery.ordered.first(4)
@videogalery = Event.videogalery.ordered.first(2)
@trailer = Event.trailer.ordered.first(3)
@news = News.published.ordered.first(4)
@rss = News.get_rss(12)
end
-
+
def top_events_widget
render :layout => false
end
View
8 app/models/event.rb
@@ -125,11 +125,17 @@ def new_event_item(params)
def prev
self.summary ? self.summary : self.body
end
-
+
def vc
self.views_count.present? ? self.views_count : 0
end
+
+ def self.fetch_upcoming
+ Rails.cache.fetch("cached_upcoming_events", :expires_in => 1.hour) do
+ self.become.first(10).in_groups(2,false) {|group| p group}
+ end
+ end
end
View
44 app/views/layouts/_plugable_bottom.erb
@@ -120,48 +120,6 @@
<%= render :partial => 'layouts/user' %>
- <div id="right_weather" class="top_line">
- <br />
- <!--bigmir)net TOP 100-->
- <script type="text/javascript" language="javascript"><!--
- bmN=navigator,bmD=document,bmD.cookie='b=b',i=0,bs=[],bm={v:16885179,s:16885179,t:0,c:bmD.cookie?1:0,n:Math.round((Math.random()* 1000000)),w:0};
- for(var f=self;f!=f.parent;f=f.parent)bm.w++;
- try{if(bmN.plugins&&bmN.mimeTypes.length&&(x=bmN.plugins['Shockwave Flash']))bm.m=parseInt(x.description.replace(/([a-zA-Z]|\s)+/,''));
- else for(var f=3;f<20;f++)if(eval('new ActiveXObject("ShockwaveFlash.ShockwaveFlash.'+f+'")'))bm.m=f}catch(e){;}
- try{bm.y=bmN.javaEnabled()?1:0}catch(e){;}
- try{bmS=screen;bm.v^=bm.d=bmS.colorDepth||bmS.pixelDepth;bm.v^=bm.r=bmS.width}catch(e){;}
- r=bmD.referrer.slice(7);if(r&&r.split('/')[0]!=window.location.host){bm.f=escape(r);bm.v^=r.length}
- bm.v^=window.location.href.length;for(var x in bm) if(/^[vstcnwmydrf]$/.test(x)) bs[i++]=x+bm[x];
- bmD.write('<a href="http://www.bigmir.net/" target="_blank" onClick="img=new Image();img.src="http://www.bigmir.net/?cl=16885179";"><img src="http://c.bigmir.net/?'+bs.join('&')+'" width="88" height="31" border="0" alt="bigmir)net TOP 100" title="bigmir)net TOP 100"></a>');
- //-->
- </script>
- <noscript>
- <a href="http://www.bigmir.net/" target="_blank"><img src="http://c.bigmir.net/?v16885179&s16885179&t0" width="88" height="31" alt="bigmir)net TOP 100" title="bigmir)net TOP 100" border="0" /></a>
- </noscript>
- <!--bigmir)net TOP 100-->
- <!-- I.UA counter --><a href="http://www.i.ua/" target="_blank" onclick="this.href='http://i.ua/r.php?117038';" title="Rated by I.UA">
- <script type="text/javascript" language="javascript"><!--
- iS='<img src="http://r.i.ua/s?u117038&p264&n'+Math.random();
- iD=document;if(!iD.cookie)iD.cookie="b=b; path=/";if(iD.cookie)iS+='&c1';
- iS+='&d'+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)
- +"&w"+screen.width+'&h'+screen.height;
- iT=iD.referrer.slice(7);iH=window.location.href.slice(7);
- ((iI=iT.indexOf('/'))!=-1)?(iT=iT.substring(0,iI)):(iI=iT.length);
- if(iT!=iH.substring(0,iI))iS+='&f'+escape(iD.referrer.slice(7));
- iS+='&r'+escape(iH);
- iD.write(iS+'" border="0" width="88" height="15" />');
- //--></script></a><!-- End of I.UA counter -->
- <meta name='yandex-verification' content='79b9942869152ec0' />
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-22804802-1']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
- </div>
+ <!--<div id="right_weather" class="top_line"></div> -->
</div>
</div>
View
42 app/views/layouts/application.html.erb
@@ -95,8 +95,50 @@
<% end %>
</div>
<div id="contacts">&copy; afisha.zhitomir.info <%= Date.today.year %>. Отдел сотрудничества: afisha@zhitomir.info, (063) 839-74-80</div>
+ <!-- I.UA counter --><a href="http://www.i.ua/" target="_blank" onclick="this.href='http://i.ua/r.php?117038';" title="Rated by I.UA" style="position: absolute; bottom: -4px;right: 0;">
+ <script type="text/javascript" language="javascript"><!--
+ iS='<img src="http://r.i.ua/s?u117038&p264&n'+Math.random();
+ iD=document;if(!iD.cookie)iD.cookie="b=b; path=/";if(iD.cookie)iS+='&c1';
+ iS+='&d'+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)
+ +"&w"+screen.width+'&h'+screen.height;
+ iT=iD.referrer.slice(7);iH=window.location.href.slice(7);
+ ((iI=iT.indexOf('/'))!=-1)?(iT=iT.substring(0,iI)):(iI=iT.length);
+ if(iT!=iH.substring(0,iI))iS+='&f'+escape(iD.referrer.slice(7));
+ iS+='&r'+escape(iH);
+ iD.write(iS+'" border="0" width="88" height="15" />');
+ //--></script></a><!-- End of I.UA counter -->
+
+ <!--bigmir)net TOP 100-->
+ <script type="text/javascript" language="javascript"><!--
+ bmN=navigator,bmD=document,bmD.cookie='b=b',i=0,bs=[],bm={v:16885179,s:16885179,t:0,c:bmD.cookie?1:0,n:Math.round((Math.random()* 1000000)),w:0};
+ for(var f=self;f!=f.parent;f=f.parent)bm.w++;
+ try{if(bmN.plugins&&bmN.mimeTypes.length&&(x=bmN.plugins['Shockwave Flash']))bm.m=parseInt(x.description.replace(/([a-zA-Z]|\s)+/,''));
+ else for(var f=3;f<20;f++)if(eval('new ActiveXObject("ShockwaveFlash.ShockwaveFlash.'+f+'")'))bm.m=f}catch(e){;}
+ try{bm.y=bmN.javaEnabled()?1:0}catch(e){;}
+ try{bmS=screen;bm.v^=bm.d=bmS.colorDepth||bmS.pixelDepth;bm.v^=bm.r=bmS.width}catch(e){;}
+ r=bmD.referrer.slice(7);if(r&&r.split('/')[0]!=window.location.host){bm.f=escape(r);bm.v^=r.length}
+ bm.v^=window.location.href.length;for(var x in bm) if(/^[vstcnwmydrf]$/.test(x)) bs[i++]=x+bm[x];
+ bmD.write('<a href="http://www.bigmir.net/" target="_blank" onClick="img=new Image();img.src="http://www.bigmir.net/?cl=16885179";"><img src="http://c.bigmir.net/?'+bs.join('&')+'" width="88" height="31" border="0" alt="bigmir)net TOP 100" title="bigmir)net TOP 100"></a>');
+ //-->
+ </script>
+ <noscript>
+ <a href="http://www.bigmir.net/" target="_blank" style="position: absolute; bottom: 30px;right: 0;"><img src="http://c.bigmir.net/?v16885179&s16885179&t0" width="88" height="31" alt="bigmir)net TOP 100" title="bigmir)net TOP 100" border="0" /></a>
+ </noscript>
+ <!--bigmir)net TOP 100-->
</div>
</div>
+
+ <meta name='yandex-verification' content='79b9942869152ec0' />
+ <script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-22804802-1']);
+ _gaq.push(['_trackPageview']);
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+ </script>
<% end %>
</body>
</html>
View
3 public/stylesheets/front.css
@@ -1600,4 +1600,5 @@ h4.news_header {max-height:27px; overflow: hidden;}
p.trailer_header {max-height:52px; overflow: hidden;}
div.galery_title {max-height:22px; overflow: hidden;font-size:9px;}
h3.event_title {max-height:32px; overflow: hidden;}
-#detail_view_container a {color:#00BFF2;}
+#detail_view_container a {color:#00BFF2;}
+#film_screenings td.cinema a {color:#242424;}

0 comments on commit df477f4

Please sign in to comment.
Something went wrong with that request. Please try again.