Commit e85c216c authored by Michal Čihař's avatar Michal Čihař

Better links to share (to engage page)

parent 24d893df
{% load i18n %}
{% with object.get_share_url as share_url %}
<p>
<a href="http://www.facebook.com/sharer.php?u=http://{{ request.get_host }}{{ object.get_absolute_url }}" class="button">{% trans "Share on Facebook!" %}</a>
<a href="https://twitter.com/share?text={% blocktrans %}Translate {{ object }} using %23Weblate!{% endblocktrans %}" class="button">{% trans "Tweet this translation!" %}</a>
<a href="http://www.facebook.com/sharer.php?u={{ share_url }}" class="button">{% trans "Share on Facebook!" %}</a>
<a href="https://twitter.com/share?text={% blocktrans %}Translate {{ object }} using %23Weblate at {{ share_url }}!{% endblocktrans %}" class="button">{% trans "Tweet this translation!" %}</a>
</p>
{% endwith %}
<p>
{% blocktrans %}You can also promote this translation project using various <a href="{{ widgets_url }}">widgets</a>.{% endblocktrans %}
......
......@@ -31,6 +31,7 @@ from django.utils.formats import date_format
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.utils import timezone
from django.core.urlresolvers import reverse
from glob import glob
import os
import time
......@@ -301,6 +302,16 @@ class Project(models.Model):
'project': self.slug
})
def get_share_url(self):
'''
Returns absolute URL usable for sharing.
'''
site = Site.objects.get_current()
return 'http://%s%s' % (
site.domain,
reverse('engage', kwargs = {'project': self.slug}),
)
@models.permalink
def get_commit_url(self):
return ('weblate.trans.views.commit_project', (), {
......@@ -542,6 +553,16 @@ class SubProject(models.Model):
'subproject': self.slug
})
def get_share_url(self):
'''
Returns absolute URL usable for sharing.
'''
site = Site.objects.get_current()
return 'http://%s%s' % (
site.domain,
reverse('engage', kwargs = {'project': self.project.slug}),
)
@models.permalink
def get_commit_url(self):
return ('weblate.trans.views.commit_subproject', (), {
......@@ -1344,6 +1365,16 @@ class Translation(models.Model):
'lang': self.language.code
})
def get_share_url(self):
'''
Returns absolute URL usable for sharing.
'''
site = Site.objects.get_current()
return 'http://%s%s' % (
site.domain,
reverse('engage-lang', kwargs = {'project': self.subproject.project.slug, 'lang': self.language.code}),
)
@models.permalink
def get_commit_url(self):
return ('weblate.trans.views.commit_translation', (), {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment