mediapop / django-friendface

Getting Facebook to work for Django.
2 stars 0 forks source link

Create basic Like gate with mobile support that can be extended #77

Open gaqzi opened 11 years ago

gaqzi commented 11 years ago

The same code gets copied around for our client projects for the like gate. And if we're going to make them work on mobile or purely on apps.facebook.com we need to add in the dynamic Like button from the JS API.

Similar to #50

kitsunde commented 11 years ago

If you tell LikeGateMixin the target it'll force render the like gate outside of the page, then add:

<div style="width:810px;margin:10px auto;overflow: hidden;">
    <div style="float:right;">
        <div class="fb-like"
             data-href="https://www.facebook.com/panasonicasia"
             data-send="false"
             data-layout="button_count"
             data-width="50"
             data-show-faces="false"></div>
    </div>
</div>

if it's not a page. This is what I did for panasonic.

kitsunde commented 11 years ago

And then:

window.fbAsyncInit = function(){
    FB.Canvas.setAutoGrow();

    FB.Event.subscribe('edge.create', function(targetUrl){
        top.location.href = "{{ this }}";
    });
};