FB:Minor fix

This commit is contained in:
nikolark committed 2014-02-04 09:39:59 +01:00
1 parent 9864acb26b
commit 52629901e7
3 files changed
+9 -6

No files matched your search

+7 -5
View File
@@ -371,23 +371,25 @@ $(document).ready(function() {
var user_id = event.target.value;
if(user_id.trim().length === 0) {
$(input_selector).parent().removeClass('has-success has-feedback has-error');
$(input_selector).parent().find(".facebook-image img").hide();
$(input_selector).parent().find(".facebook-image img").attr('src', no_picture_url);
return;
}
var pictureUrl= "https://graph.facebook.com/" + user_id + "/picture";
var picture_url = "https://graph.facebook.com/" + user_id + "/picture";
var static_url = $("meta[name=x-django-static-url]").attr('content');
var no_picture_url = static_url +"img/unknown_person.png";
$.ajax({
url: pictureUrl,
url: picture_url,
statusCode: {
200: function() {
$(input_selector).parent().addClass('has-success has-feedback');
$(input_selector).parent().removeClass('has-error');
$(input_selector).parent().find(".facebook-image").show().html('<img src='+pictureUrl+' />')
$(input_selector).parent().find(".facebook-image img").attr('src', picture_url);
},
404: function() {
$(input_selector).parent().addClass('has-error has-feedback');
$(input_selector).parent().removeClass('has-success');
$(input_selector).parent().find(".facebook-image img").hide();
$(input_selector).parent().find(".facebook-image img").attr('src', no_picture_url);
}
}
});
+1
View File
@@ -4,6 +4,7 @@
<title>{%block title%}BBS{%endblock%}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="x-django-static-url" content="{{ STATIC_URL }}">
<link rel="stylesheet" href="{{ STATIC_URL }}stylesheets/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="{{ STATIC_URL }}stylesheets/print.css" type="text/css" media="print">
<!--[if lt IE 8]>
+1 -1
View File
@@ -37,7 +37,7 @@
<label for="id_facebook_username">{{ form.facebook_username.label }}</label>
<div class="input-group">
{{ form.facebook_username|add_class:"form-control input-lg"|attr:"placeholder: F.eks simbras"}}{{form.facebook_username.error}}
<span class="input-group-addon facebook-image"></span>
<span class="input-group-addon facebook-image"><img src="{{ STATIC_URL}}img/unknown_person.png" /></span>
</div>
</div>