hummingbird-me/hummingbird

View on GitHub
app/views/layouts/redesign.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 Hummingbird

    = stylesheet_link_tag    "application", :media => "all"
    = csrf_meta_tags

    %meta(name="viewport" content="width=device-width, initial-scale=1.0")
    %meta(property="fb:app_id" content="325314560922421")
    %meta(name="fragment" content="!")
    %meta(name="og:title" content="Hummingbird")
    = yield :head

    :javascript
      // Twitter
      !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');

      // Facebook
      (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'));

  %body
    %noscript
      %nav.navbar.navbar-inverse.hb-nav.navbar-fixed-top
        %div.container
          %a.navbar-brand{href: "/"}
            %img{width: "119px", height: "20px", src: "/assets/logo-new.jpg", alt: "Hummingbird"}
          %ul.nav.navbar-nav
            %li.dropdown
              %a{href: "/anime"} Trending Anime
            %li.dropdown
              %a{href: "/anime/upcoming"} Upcoming Anime
            %li.dropdown
              %a{href: "https://forums.hummingbird.me/"} Community
      = yield :body

    :javascript
      (function(){
        var bsa = document.createElement('script');
           bsa.type = 'text/javascript';
           bsa.async = true;
           bsa.src = 'https://s3.buysellads.com/ac/bsa.js';
        (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa);
      })();

    #fb-root

    / Preload Models
    :javascript
      window.currentUserName = #{(user_signed_in? ? current_user.name : nil).to_json};
      window.preloadData = #{(@preload || []).to_json};
      window.genericPreload = #{(@generic_preload || {}).to_json};

    / Segment.io
    - if Rails.env.production?
      :javascript
        window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
        window.analytics.load("wsxq90kyox");
        window.analytics.page();
      - if user_signed_in?
        :javascript
          analytics.identify('#{current_user.id}-#{j current_user.name}', {
            email: '#{j current_user.email}',
            username: '#{j current_user.name}'
          });
    - else
      :javascript
        window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}

    = include_ember_script_tags :frontend