Add sharing links directly on the Event page, get rid of a separate sharing page

This commit is contained in:
Michael Hall 2018-04-21 22:18:11 -04:00
parent 8bf0ae0a79
commit ca1fc90cbc
8 changed files with 168 additions and 188 deletions

View file

@ -41,3 +41,39 @@ form {
height: 16px;
}
.btn-googleplus {
color: #FFFFFF;
background-color: #DB4437;
border-color: #DB4437;
}
.btn-googleplus:hover:active {
color: #FFFFFF;
}
.btn-facebook {
color: #FFFFFF;
background-color: #3B5998;
border-color: #3B5998;
}
.btn-facebook:hover, .btn-facebook:active {
color: #FFFFFF;
}
.btn-twitter {
color: #FFFFFF;
background-color: #1DA1F2;
border-color: #1DA1F2;
}
.btn-twitter:hover, .btn-twitter:active {
color: #FFFFFF;
}
.btn-github {
color: #FFFFFF;
background-color: #24292e;
border-color: #24292e;
}
.btn-github:hover, .btn-github:active {
color: #FFFFFF;
}

View file

@ -30,6 +30,7 @@
<link href="{% static 'js/tether/css/tether.min.css' %}" rel="stylesheet">
<link href="{% static 'js/jquery-ui/jquery-ui.min.css' %}" rel="stylesheet">
<link href="{% static 'css/get_together.css' %}" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- style overrides -->
{%block styles %}{% endblock %}
<style>

View file

@ -1,88 +0,0 @@
{% extends "get_together/base.html" %}
{% load markup static %}
{% block add_to_totle %} | {{event.name}}{% endblock %}
{% block meta %}
<meta property="og:url" content="{{event.get_full_url}}" />
<meta property="og:type" content="website" />
<meta property="og:title" content="{{event.name}}" />
<meta property="og:description" content="{{event.summary|jsencode}}" />
{% if event.team.category %}
<meta property="og:image" content="{{event.team.category.img_url}}" />
{% else %}
<meta property="og:image" content="https://gettogether.community{% static 'img/team_placeholder.png' %}" />
{% endif %}
<link rel="canonical" href="{{event.get_full_url}}">
{% endblock %}
{% block content %}
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{settings.SOCIAL_AUTH_FACEBOOK_KEY}}',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.12'
});
};
(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 = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function shareFacebook() {
FB.ui({
display: 'popup',
method: 'share',
href: '{{event.get_full_url}}',
quote: 'I\'m having a Get Together!\n\n{{event.name|jsencode}}',
hashtag: '#gettogether',
summary: "Let's have a Get Together!"
}, function(response){});
}
</script>
{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<script>window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
</script>
{% endif %}
<h2>Announce your Get Together</h2>
<div class="layout">
<div class="row mt-3">
<div class="col">
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}<a href="#" onClick="shareFacebook()"; class="btn btn-primary">Facebook</a>{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<a class="btn btn-primary"
href="https://twitter.com/intent/tweet?text=I'm+having+a+get+together!%0D{{event.name|urlencode}}&original_referer={{event.get_full_url|urlencode}}&url={{event.get_full_url|urlencode}}&hashtags=gettogether"
data-size="large">
Twitter</a>
{% endif %}
</div>
<div class="col">
<a href="{{event.get_absolute_url}}" class="btn btn-secondary">Share later</a>
</div>
</div>
</div>
{% endblock %}

View file

@ -28,6 +28,56 @@
}
</style>
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{settings.SOCIAL_AUTH_FACEBOOK_KEY}}',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.12'
});
};
(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 = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function shareFacebook() {
FB.ui({
display: 'popup',
method: 'share',
href: '{{event.get_full_url}}',
quote: 'I\'m having a Get Together!\n\n{{event.name|jsencode}}',
hashtag: '#gettogether',
summary: "Let's have a Get Together!"
}, function(response){});
}
</script>
{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<script>window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
</script>
{% endif %}
{% endblock %}
{% block content %}
@ -35,15 +85,27 @@
<div class="row">
<div class="col-md-9">
<h2>{{ event.name }}
{% if can_edit_event %}
<a href="{% url 'edit-event' event.id %}" class="btn btn-secondary btn-sm">Edit Event</a>
{% endif %}
{% if not is_attending %}
<a href="{% url 'attend-event' event.id %}" class="btn btn-success btn-sm">Attend</a>
{% endif %}
<a href="{% url 'share-event' event.id %}" class="btn btn-primary btn-sm">Share</a>
</h2>
<p class="text-muted">Hosted by <a href="{% url "show-team" team.id %}">{{ team.name }}</a></p>
{% if can_edit_event %}
<div class="btn-group dropdown">
<button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="editMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Edit
</button>
<div class="dropdown-menu" aria-labelledby="editMenuButton">
<a href="{% url 'edit-event' event.id %}" class="dropdown-item">Event Details</a>
</div>
</div>
{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<a href="https://twitter.com/intent/tweet?text=I'm+having+a+get+together!%0D{{event.name|urlencode}}&original_referer={{event.get_full_url|urlencode}}&url={{event.get_full_url|urlencode}}&hashtags=gettogether" data-size="large" class="btn btn-twitter btn-sm"><i class="fa fa-twitter"></i> Tweet</a>
{% endif %}
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}
<a href="#" onClick="shareFacebook();" class="btn btn-facebook btn-sm"><i class="fa fa-facebook-official"></i> Share</a>
{% endif %}
{% if not is_attending %}
<a href="{% url 'attend-event' event.id %}" class="btn btn-success btn-sm"><i class="fa fa-check-square-o"></i> Attend</a>
{% endif %}
<hr/>
<p>{{ event.summary|markdown }}</p>
@ -83,6 +145,7 @@
<td width="120px"><b>Website:</b></td><td><a href="{{ event.web_url }}" target="_blank">{{ event.web_url }}</a></td>
</tr>
{% endif %}
</table>
<div class="container mt-3">

View file

@ -1,84 +0,0 @@
{% extends "get_together/base.html" %}
{% load markup static %}
{% block add_to_totle %} | {{event.name}}{% endblock %}
{% block meta %}
<meta property="og:url" content="{{event.get_full_url}}" />
<meta property="og:type" content="website" />
<meta property="og:title" content="{{event.name}}" />
<meta property="og:description" content="{{event.summary|jsencode}}" />
<meta property="og:image" content="{{event.category.img_url}}" />
<link rel="canonical" href="{{event.get_full_url}}">
{% endblock %}
{% block content %}
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{settings.SOCIAL_AUTH_FACEBOOK_KEY}}',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.12'
});
};
(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 = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function shareFacebook() {
FB.ui({
display: 'popup',
method: 'share',
href: '{{event.get_full_url}}',
quote: 'I\'m going to a Get Together!\n\n{{event.name|jsencode}}',
hashtag: '#gettogether',
summary: "Let's have a Get Together!"
}, function(response){});
}
</script>
{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<script>window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
</script>
{% endif %}
<h2>Announce your Get Together</h2>
<div class="layout">
<div class="row mt-3">
<div class="col">
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}<a href="#" onClick="shareFacebook()"; class="btn btn-primary">Facebook</a>{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<a class="btn btn-primary"
href="https://twitter.com/intent/tweet?text=I'm+going+to+a+get+together!%0D{{event.name|urlencode}}&original_referer={{event.get_full_url|urlencode}}&url={{event.get_full_url|urlencode}}&hashtags=gettogether"
data-size="large">
Twitter</a>
{% endif %}
</div>
<div class="col">
<a href="{{event.get_absolute_url}}" class="btn btn-secondary">Share later</a>
</div>
</div>
</div>
{% endblock %}

View file

@ -26,7 +26,56 @@
border-top: none;
}
</style>
{% endblock %}
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{settings.SOCIAL_AUTH_FACEBOOK_KEY}}',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.12'
});
};
(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 = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function shareFacebook() {
FB.ui({
display: 'popup',
method: 'share',
href: '{{common_event.get_full_url}}',
quote: 'I\'m having a Get Together!\n\n{{common_event.name|jsencode}}',
hashtag: '#gettogether',
summary: "Let's have a Get Together!"
}, function(response){});
}
</script>
{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<script>window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
</script>
{% endif %}{% endblock %}
{% block content %}
<div class="fluid-container">
@ -34,9 +83,14 @@
<div class="col-md-9">
<h2>{{ common_event.name }}
{% if can_edit_event %}
<a href="{% url 'edit-common-event' common_event.id %}" class="btn btn-secondary btn-sm">Edit Event</a>
<a href="{% url 'edit-common-event' common_event.id %}" class="btn btn-secondary btn-sm">Edit</a>
{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}
<a href="https://twitter.com/intent/tweet?text=I'm+having+a+get+together!%0D{{common_event.name|urlencode}}&original_referer={{common_event.get_full_url|urlencode}}&url={{common_event.get_full_url|urlencode}}&hashtags=gettogether" data-size="large" class="btn btn-twitter btn-sm"><i class="fa fa-twitter"></i> Tweet</a>
{% endif %}
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}
<a href="#" onClick="shareFacebook();" class="btn btn-facebook btn-sm"><i class="fa fa-facebook-official"></i> Share</a>
{% endif %}
<a href="{% url 'share-common-event' common_event.id %}" class="btn btn-primary btn-sm">Share</a>
</h2><p class="text-muted">Organized by <a href="{% url "show-org" common_event.organization.slug %}">{{ common_event.organization.name }}</a></p><hr/>
<p>{{ common_event.summary|markdown }}</p>

View file

@ -8,10 +8,10 @@
<a class="btn btn-primary" href="{% url 'social:begin' 'facebook' %}">Facebook</a><br/><br/>
<a class="btn btn-primary" href="{% url 'social:begin' 'twitter' %}">Twitter</a>&nbsp; &nbsp;
-->
{% if settings.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY %}<span><a class="btn btn-primary" href="{% url 'social:begin' 'google-oauth2' %}?{{ request.META.QUERY_STRING }}">Google</a></span>{% endif %}
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}<span><a class="btn btn-primary" href="{% url 'social:begin' 'facebook' %}?{{ request.META.QUERY_STRING }}">Faceboook</a></span>{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}<span><a class="btn btn-primary" href="{% url 'social:begin' 'twitter' %}?{{ request.META.QUERY_STRING }}">Twitter</a></span>{% endif %}
{% if settings.SOCIAL_AUTH_GITHUB_KEY %}<span><a class="btn btn-primary" href="{% url 'social:begin' 'github' %}?{{ request.META.QUERY_STRING }}">GitHub</a></span>{% endif %}
{% if settings.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY %}<span><a class="btn btn-googleplus" href="{% url 'social:begin' 'google-oauth2' %}?{{ request.META.QUERY_STRING }}"><i class="fa fa-google-plus-official"></i> Google</a></span>{% endif %}
{% if settings.SOCIAL_AUTH_FACEBOOK_KEY %}<span><a class="btn btn-facebook" href="{% url 'social:begin' 'facebook' %}?{{ request.META.QUERY_STRING }}"><i class="fa fa-facebook-official"></i> Faceboook</a></span>{% endif %}
{% if settings.SOCIAL_AUTH_TWITTER_KEY %}<span><a class="btn btn-twitter" href="{% url 'social:begin' 'twitter' %}?{{ request.META.QUERY_STRING }}"><i class="fa fa-twitter"></i> Twitter</a></span>{% endif %}
{% if settings.SOCIAL_AUTH_GITHUB_KEY %}<span><a class="btn btn-github" href="{% url 'social:begin' 'github' %}?{{ request.META.QUERY_STRING }}"><i class="fa fa-github"></i> GitHub</a></span>{% endif %}
{% if settings.DEBUG %}<span><a class="btn btn-secondary" href="{% url 'admin:login' %}?{{ request.META.QUERY_STRING }}">Local</a></span>{% endif %}
<br>
</center>

View file

@ -68,7 +68,6 @@ urlpatterns = [
path('events/<int:event_id>/+attend/', event_views.attend_event, name='attend-event'),
path('events/<int:event_id>/+delete/', views.delete_event, name='delete-event'),
path('events/<int:event_id>/+add_place/', views.add_place_to_event, name='add-place'),
path('events/<int:event_id>/+share/', views.share_event, name='share-event'),
path('events/<int:event_id>/+comment/', event_views.comment_event, name='comment-event'),
path('events/<int:event_id>/+photo/', views.add_event_photo, name='add-event-photo'),
path('events/<int:event_id>/<str:event_slug>/', views.show_event, name='show-event'),
@ -79,7 +78,6 @@ urlpatterns = [
path('org/<str:org_slug>/', views.show_org, name='show-org'),
path('org/<str:org_slug>/+create-event/', views.create_common_event, name='create-common-event'),
path('common/<int:event_id>/+share/', views.share_common_event, name='share-common-event'),
path('common/<int:event_id>/+create-event/', views.create_common_event_team_select, name='create-common-event-team-select'),
path('common/<int:event_id>/<str:event_slug>/', views.show_common_event, name='show-common-event'),