hummingbird-me/hummingbird

View on GitHub
app/views/layouts/application.html.haml

Summary

Maintainability
Test Coverage
!!!
%html
  %head(prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# hummingbird: http://ogp.me/ns/fb/hummingbird#")
    %title
      - if yield(:title).length > 0
        #{yield(:title)} | Hummingbird
      - else
        Hummingbird

    - if user_signed_in?
      :coffee
        @currentUser = {
          id: #{current_user.id.inspect},
          name: #{current_user.name.inspect},
          param: #{current_user.to_param.inspect},
          nb: #{current_user.ninja_banned?.inspect},
          admin: #{current_user.admin?.inspect}
        }
    - else
      :coffee
        @currentUser = null

    %link(rel="stylesheet" media="all" href="/old-application.css?3")
    = javascript_include_tag "old/application"
    = csrf_meta_tags
    / %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}


    %meta(property="fb:app_id" content="325314560922421")

    - if yield(:title).length > 0
      %meta(property="og:title"){:content => yield(:title)}
    - if @anime and @anime.respond_to? :poster_image
      %meta(property="og:image"){:content => @anime.poster_image.url}

    = yield(:extra_meta_content)

    // Typekit Code
    %script{:src => "//use.typekit.net/nlt2ped.js", :type => "text/javascript"}
    :javascript
      try{Typekit.load();}catch(e){}

    / Google Analytics
    :javascript
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-37633900-1']);
      _gaq.push(['_setDomainName', 'hummingbird.me']);
      _gaq.push(['_setAllowLinker', true]);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    / Async Adsense
    %script(async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js")

  %body{:class => ("guest-padding" if (not user_signed_in?) or (user_signed_in? and not current_user.confirmed?))}
    // Facebook Code
    #fb-root
    :javascript
      (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=452427161479702";
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));

    = render 'shared/header'

    - unless user_signed_in?
      = render 'shared/sign_in_modal'

    #page.off-canvas.slide-nav
      = content_for?(:content) ? yield(:content) : yield
    = render 'shared/footer'

    .status-bar
      %p
        %span Removed feed item.
        %a(href="javascript:void(0)") Undo.

    - if Rails.env.production?
      :javascript
        var analytics=analytics||[];analytics.load=function(e){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"===document.location.protocol?"https://":"http://")+"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"+e+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);var r=function(e){return function(){analytics.push([e].concat(Array.prototype.slice.call(arguments,0)))}},i=["identify","track","trackLink","trackForm","trackClick","trackSubmit","pageview","ab","alias","ready"];for(var s=0;s<i.length;s++)analytics[i[s]]=r(i[s])};
        analytics.load("c6svkipfq3");
      - if user_signed_in?
        :javascript
          analytics.identify('#{j current_user.name}', {
            email: '#{j current_user.email}',
            username: '#{j current_user.name}'
          });