--- /dev/null
+jQuery.copy=function(data){return jQuery.fn.copy.call({},data);};jQuery.fn.copy=function(delimiter){var me=this,flashcopier=(function(fid){return document.getElementById(fid)||(function(){var divnode=document.createElement('div');divnode.id=fid;document.body.appendChild(divnode);return divnode;})();})('_flash_copier'),data=jQuery.map(me,function(bit){return typeof bit==='object'? bit.value||bit.innerHTML.replace(/<.+>/g,''):'';}).join(delimiter||'').replace(/^\s+|\s+$/g,'')||delimiter,divinfo='<embed src="jquery.copy.swf"FlashVars="clipboard='+encodeURIComponent(data)+'"width="0"height="0"'+'type="application/x-shockwave-flash"></embed>';flashcopier.innerHTML=divinfo;return this;};
{% load i18n %}
+<p>
+{% blocktrans %}
+Would you like to copy the permanent link to your clipboard?
+{% endblocktrans %}
+</p>
+
+<p>
{% spaceless %}
<table>
<tr>
<td><label for="permanent_link_url">{% trans "Permanent link" %}:</label></td>
- <td><input id="permanent_link_url" readonly="readonly" type="text" value="{{ url }}" /></td>
+ <td><input id="permanent_link_url" name="permanent_link_url" readonly="readonly" type="text" value="{{ url }}" /></td>
</tr>
</table>
{% endspaceless %}
+</p>
<script type="text/javascript">
$(document).ready(function() {
from django.shortcuts import get_object_or_404, render_to_response
from django.utils.translation import ungettext, ugettext as _
from django.template import RequestContext
+from django.template.loader import render_to_string
from forum.models import *
from forum.models.node import NodeMetaClass
from forum.actions import *
# Getting the current object URL -- the Application URL + the object relative URL
url = '%s%s' % (settings.APP_BASE_URL, answer.get_absolute_url())
- # Display the template
- return render_to_response('node/permanent_link.html', { 'url' : url, })
+ if not request.POST:
+ # Display the template
+ return render_to_response('node/permanent_link.html', { 'url' : url, })
+
+ return {
+ 'commands' : {
+ 'copy_url' : [request.POST['permanent_link_url'],],
+ },
+ 'message' : _("The permanent URL to the answer has been copied to your clipboard."),
+ }
@decorate.withfn(command)
def award_points(request, user_id, answer_id):