Added TOS and Privacy URLS for FB app

This commit is contained in:
=
2012-08-15 22:50:41 +01:00
parent f2a0031c55
commit e76d892d08
24 changed files with 122 additions and 45 deletions

3
core/social/Facebook.py Normal file
View File

@@ -0,0 +1,3 @@
from core.social._Social import _Social
class Facebook(_Social):
pass

2
core/social/_Social.py Normal file
View File

@@ -0,0 +1,2 @@
class _Social:
pass

1
core/social/__init__.py Normal file
View File

@@ -0,0 +1 @@
__author__ = 'fergalm'

View File

@@ -91,6 +91,7 @@ TEMPLATE_LOADERS = (
#'django.template.loaders.app_directories.load_template_source',
)
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'django_facebook.context_processors.facebook',
'django.core.context_processors.request',
'django.contrib.auth.context_processors.auth',
"allauth.socialaccount.context_processors.socialaccount",
@@ -124,6 +125,7 @@ INSTALLED_APPS = (
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'django_facebook',
'djcelery',
'crispy_forms',
'pipeline',
@@ -170,6 +172,8 @@ LOGGING = {
},
}
}
FACEBOOK_APP_ID = '154504534677009'
FACEBOOK_APP_SECRET = localsettings.FACEBOOK_APP_SECRET
BROKER_HOST = "127.0.0.1"
BROKER_PORT = 5672

View File

@@ -11,6 +11,9 @@ admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/img/favicon.ico'}),
(r'^channel\.html$', 'django.views.generic.simple.redirect_to', {'url': '/static/html/fb_channel.html'}),
(r'^privacy\.html$', 'django.views.generic.simple.redirect_to', {'url': '/static/html/privacy.html'}),
(r'^tos\.html$', 'django.views.generic.simple.redirect_to', {'url': '/static/html/tos.html'}),
url(r'^', include('spa.urls')),
(r'^grappelli/', include('grappelli.urls')),
url(r'^accounts/', include('allauth.urls')),

View File

@@ -14,5 +14,6 @@ django-tastypie>=0.9.11
django-tinymce>=1.5.1b2
git+git://github.com/PaulUithol/backbone-tastypie.git#egg=backbone-tastypie
git+git://github.com/maraujop/django-crispy-forms.git#django-crispy-forms
git+git://github.com/tschellenbach/Django-facebook.git#django-facebook
django-grappelli
humanize
humanize

View File

@@ -11,12 +11,16 @@ register = template.Library()
@register.filter
def nice_name(user):
if user == "":
return "Unknown User"
return "Anonymous"
if user.is_authenticated():
profile = user.get_profile()
if profile is not None:
if profile.display_name <> "":
return profile.display_name
else:
return "Anonymous"
if type(user) is UserProfile:
return user.user.get_full_name() or user.user.username
elif type(user) is User:
return user.get_full_name() or user.username
return user.get_full_name() or user.username
@register.filter
def avatar_image(user, size=150):

0
static/bin/sm/soundmanager2.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_debug.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_flash9.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_flash9_debug.swf Normal file → Executable file
View File

0
static/bin/sm/soundmanager2_flash_xdomain.zip Normal file → Executable file
View File

View File

@@ -0,0 +1 @@
<script src="//connect.facebook.net/en_US/all.js"></script>

10
static/html/privacy.html Normal file
View File

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
Hello Sailor
</body>
</html>

10
static/html/tos.html Normal file
View File

@@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
Hello Sailor
</body>
</html>

View File

@@ -35,4 +35,4 @@ $(document).ajaxSend(function (event, xhr, settings) {
if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
});
});

View File

@@ -67,17 +67,15 @@ window.utils = {
if (fade) {
$('.alert').fadeOut(5000, function () {
});
}else{
$('.alert').click(function() {
$('.alert').fadeOut('slow', function() {
});
});
}
$('.alert').click(function () {
$('.alert').fadeOut('slow', function () {
});
});
},
hideAlert:function () {
$('.alert').hide();
}
};
window.TastypieModel = Backbone.Model.extend({

View File

@@ -24,9 +24,28 @@ window.MixListItemView = Backbone.View.extend({
"/ajax/like/",
{ dataId:id, dataMode:mode },
function (data) {
alert(data);
}
);
var slug = '12345';
var attachment = {
'name':'Deep South Sounds',
'description':'This is a test of the Deep South Sounds Broadcast System. If this was real, you would be reading something useful.',
'media':[{
'type':'image',
'src':'http://deepsouthsounds.com/images/facebook_image.png',
'href':'http://www.deepsouthsounds.com/' + slug + '/'
}]
};
FB.login(function(response) {
/*FB.api('/me', function(response) {
alert('Your name is ' + response.name);
});*/
FB.ui({
method:'stream.publish',
message:'I liked a sound on deep south sounds!',
attachment:attachment
});
}, {scope: 'publish_stream'});
},
playMix:function () {
var id = $(this.el).data("id");

View File

@@ -1,6 +1,7 @@
window.UserView = Backbone.View.extend({
events:{
"click #save-changes":"saveChanges",
"click input[type=radio]": "selectAvatar",
"change input" :"changed",
"change select" :"changed"
},
@@ -31,5 +32,8 @@ window.UserView = Backbone.View.extend({
var obj = "{\""+changed.id +"\":\""+value+"\"}";
var objInst = JSON.parse(obj);
this.model.set(objInst);
},
selectAvatar: function(evt){
this.model.set('avatar_type', $(evt.currentTarget).val());
}
});

File diff suppressed because one or more lines are too long

View File

@@ -41,8 +41,12 @@
window.location.hash = '';
}
</script>
{% block headerscripts %}
{% endblock %}
</head>
<body>
{% include 'inc/facebook_init.html' %}
{% include 'inc/ancient_browser.html' %}
<div id="header"></div>

View File

@@ -0,0 +1,22 @@
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '154504534677009', // App ID
channelUrl : '//www.deepsouthsounds.com/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>

View File

@@ -1,4 +1,5 @@
{% load account_tags %}
{% load spa_extras %}
<div class="navbar navbar-fixed-top" xmlns="http://www.w3.org/1999/html">
<div class="navbar-inner">
<div class="container">
@@ -41,7 +42,7 @@
</a>
<li>
<li>
<a href="#/me">{% user_display user %}</a>
<a href="#/me">{{ user|nice_name }}</a>
</li>
</ul>
</div>

View File

@@ -1,70 +1,62 @@
{% load account_tags %}
{% block scripts %}
<script type="text/javascript">
$(document).ready(function () {
$('#avatar_image').hide();
$('input:radio[name=avatar_image_select]').bind('click', function (data) {
var selected = $('input:radio[name=avatar_image_select]:checked').val();
if (selected === 'custom') {
$('#avatar_image').show();
} else {
$('#avatar_image').hide();
}
});
});
</script>
{% endblock %}
{% block content %}
<form enctype="multipart/form-data" method="post" class="form-horizontal" id="id-new-user-form">
{% csrf_token %}
<fieldset>
<legend>User details</legend>
<div class="clearfix control-group" id="div_display_name">
<label class="control-label" for="display_name">Display name</label>
<div class="controls">
<input type="text" maxlength="75" name="email" class="textinput textInput" id="display_name" value="<%= item.display_name %>">
<input type="text" maxlength="75" name="email" class="textinput textInput" id="display_name"
value="<%= item.display_name %>">
</div>
</div>
<div class="clearfix control-group" id="div_email">
<label class="control-label" for="email">E-mail address</label>
<div class="controls">
<input type="text" maxlength="75" name="email" class="textinput textInput" id="email" value="{{ user.email }}">
<input type="text" maxlength="75" name="email" class="textinput textInput" id="email"
value="{{ user.email }}">
</div>
</div>
<div class="clearfix control-group" id="div_first_name">
<label class="control-label " for="first_name">First name</label>
<div class="controls">
<input type="text" maxlength="30" name="first_name" class="textinput textInput" id="first_name" value="{{ user.first_name }}">
<input type="text" maxlength="30" name="first_name" class="textinput textInput" id="first_name"
value="{{ user.first_name }}">
</div>
</div>
<div class="clearfix control-group" id="div_last_name">
<label class="control-label " for="last_name">Last name</label>
<div class="controls">
<input type="text" maxlength="30" name="last_name" class="textinput textInput" id="last_name" value="{{ user.last_name }}">
<input type="text" maxlength="30" name="last_name" class="textinput textInput" id="last_name"
value="{{ user.last_name }}">
</div>
</div>
<div class="clearfix control-group" id="div_avatar_image_select">
<label class="control-label requiredField" for="avatar_image_select_0">Avatar Image<span class="asteriskField">*</span></label>
<label class="control-label requiredField" for="avatar_image_select_0">Avatar Image<span
class="asteriskField">*</span></label>
<div class="controls">
<label class="radio">
Use gravatar image.
<input type="radio" value="gravatar" id="avatar_image_select_1" name="avatar_image_select">
<input type="radio" value="gravatar" id="gravatar" name="avatar_type">
</label>
<label class="radio">
Use Twitter/Facebook image.
<input type="radio" value="social" id="avatar_image_select_2" name="avatar_image_select">
<input type="radio" value="social" id="social" name="avatar_type">
</label>
<label class="radio">
Use custom image (upload below).
<input type="radio" value="custom" id="avatar_image_select_3" name="avatar_image_select">
<input type="radio" value="custom" id="custom" name="avatar_type">
</label>
</div>
</div>
<div class="clearfix control-group" id="div_avatar_image">
<div class="controls">
<input type="file" name="avatar_image" class="clearablefileinput" id="avatar_image" style="display: none;">
<input type="file" name="avatar_image" class="clearablefileinput" id="avatar_image"
style="display: none;">
</div>
</div>
</fieldset>
@@ -72,4 +64,3 @@
<input type="submit" id="save-changes" class="btn btn-primary" value="Save changes" name="save_changes">&zwnj;
</div>
</form>
{% endblock %}