summaryrefslogtreecommitdiff
path: root/tbc
diff options
context:
space:
mode:
authorJayaram R Pai2014-07-08 00:11:57 +0530
committerJayaram R Pai2014-07-08 00:11:57 +0530
commitca738ba0953ab950a16c9b89085c9aab5473e7a5 (patch)
tree137df08e50a1913f14bd6986d9622cb25c53a977 /tbc
parent5fa6de089dce1c45a095c286dbd890fea30e9c94 (diff)
parent37f924bc3f6526f9e229e5b237e7490b7339926a (diff)
downloadPython-TBC-Interface-ca738ba0953ab950a16c9b89085c9aab5473e7a5.tar.gz
Python-TBC-Interface-ca738ba0953ab950a16c9b89085c9aab5473e7a5.tar.bz2
Python-TBC-Interface-ca738ba0953ab950a16c9b89085c9aab5473e7a5.zip
Merge branch 'master' of https://github.com/FOSSEE/Python-TBC-Interface
Diffstat (limited to 'tbc')
-rw-r--r--tbc/templates/tbc/book-details.html16
-rw-r--r--tbc/urls.py1
-rwxr-xr-xtbc/views.py9
3 files changed, 26 insertions, 0 deletions
diff --git a/tbc/templates/tbc/book-details.html b/tbc/templates/tbc/book-details.html
index baaeaeb..3099063 100644
--- a/tbc/templates/tbc/book-details.html
+++ b/tbc/templates/tbc/book-details.html
@@ -1,6 +1,19 @@
{% extends 'base.html' %}
{% load static %}
+{% block script %}
+<script>
+function redirectToIpynb(notebook)
+{
+ alert(notebook);
+ notebook = notebook.split("/")
+ alert("http://ipynb.fossee.in/notebooks/"+notebook[1]+"/"+notebook[2]);
+ url = "http://ipynb.fossee.in/notebooks/"+notebook[1]+"/"+notebook[2]
+ window.location.replace(url)
+}
+</script>
+{% endblock %}
+
{% block content %}
<center><h3>{{ book.title }}</h3></center>
<div class="row-fluid">
@@ -24,6 +37,9 @@
<td>
<a href="{% static 'uploads/' %}{{ chapter.notebook }}">Download</a>
</td>
+ <td>
+ <a href="{% url 'tbc:RedirectToIpynb' chapter.notebook %}">Edit examples of this chapter</a>
+ </td>
</tr>
{% endfor %}
</table>
diff --git a/tbc/urls.py b/tbc/urls.py
index c3ca12f..bb71951 100644
--- a/tbc/urls.py
+++ b/tbc/urls.py
@@ -25,6 +25,7 @@ urlpatterns = patterns('',
url(r'^completed-books/$', 'tbc.views.CompletedBooks', name='CompletedBooks'),
url(r'^completed-books/(?P<category>.+)$', 'tbc.views.CompletedBooks', name='CompletedBooks'),
url(r'^books-under-progress/$', 'tbc.views.BooksUnderProgress', name='BooksUnderProgress'),
+ url(r'^redirect-ipynb/(?P<notebook_path>.+)$', 'tbc.views.RedirectToIpynb', name='RedirectToIpynb'),
url(r'^book-review/$', 'tbc.views.BookReview', name='BookReview'),
diff --git a/tbc/views.py b/tbc/views.py
index a232b36..bc3913b 100755
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -652,3 +652,12 @@ def BooksUnderProgress(request):
else:
context['user'] = request.user
return render_to_response('tbc/books_under_progress.html', context)
+
+
+def RedirectToIpynb(request, notebook_path=None):
+ context = {}
+ notebook = notebook_path.split("/")
+ notebook[0] = "notebooks"
+ notebook = "/".join(notebook)
+ redirect_url = "https://ipynb.fossee.in/"+notebook
+ return redirect(redirect_url)