diff options
author | Trupti Rajesh Kini | 2016-05-17 11:20:30 +0530 |
---|---|---|
committer | Trupti Rajesh Kini | 2016-05-17 11:20:30 +0530 |
commit | ca3b877ea02a41af6e42d576fbb53ff852a458d7 (patch) | |
tree | 687ee577dc96585d2e287b2c09f1b82298c887af | |
parent | 0fa2e3abe3ce91c11e8603f79f6897c2dbe5b033 (diff) | |
parent | 9d4a8bf905c1af386c14ed027f8e61697f740d2a (diff) | |
download | Python-TBC-Interface-ca3b877ea02a41af6e42d576fbb53ff852a458d7.tar.gz Python-TBC-Interface-ca3b877ea02a41af6e42d576fbb53ff852a458d7.tar.bz2 Python-TBC-Interface-ca3b877ea02a41af6e42d576fbb53ff852a458d7.zip |
Merge pull request #29 from FOSSEE/modified-funcnames-frontpg
modified-funcnames-frontpg
58 files changed, 751 insertions, 160 deletions
diff --git a/PythonTBC/settings.py b/PythonTBC/settings.py index 4d99488..28eda1d 100644 --- a/PythonTBC/settings.py +++ b/PythonTBC/settings.py @@ -141,6 +141,8 @@ INSTALLED_APPS = ( 'south', 'commentingapp', 'tbc_error_page', + 'taggit', + 'taggit_templatetags2', ) diff --git a/base.html b/base.html new file mode 100755 index 0000000..e47cbf6 --- /dev/null +++ b/base.html @@ -0,0 +1,428 @@ +{% load static %} +{% load taggit_templatetags2_tags %} +<!DOCTYPE html> +<html lang="en"> + <head> + <title> + {% block title %} + Python Textbook Companion Project | FOSSEE, IIT Bombay + {% endblock %} + </title> + {% block meta %} + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content=""> + {% endblock %} + + <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}" type="text/css" /> + <link rel ="stylesheet" href="{% static 'css/responsive.css' %}" type="text/css"/> +<style> +.showonhover .hovertext { display: none;} +.showonhover:hover .hovertext {display: inline;} +a.viewdescription {color:#999;} +a.viewdescription:hover {background-color:#999; color: White;} +.hovertext {position:absolute;z-index:1000;border:1px solid #ffd971;background-color:#fffdce;padding:11px;width:250px;font-size: 0.75em;} +</style> +<style> + .module-list { + float: left; + height: 220px; + margin-top: 20px; + margin-bottom: 20px; + margin-left: 50px; + padding: 10px; + padding-bottom: 25px; + position: relative; + width: 300px; + background: #2c3e50; + } + .module-list img { + height: 220px; + } + .module-list img:hover{ + height: 220px; + border-radius: 15px; + } + + .module-list a{ + color: #ffffff; + } + .navbar .container { + max-width: 1100px; + } + #content-wrap{ + max-width: 1100px; + margin: 0 auto; + } + input[type="text"] { + width: 100%; + } + input[type="password"] { + width: 100%; + } + .gsc-search-button, + .gsc-clear-button { + position: relative; + top: -2px; + } + .badge-custom { + padding: 1.5px 7px 1.5px; + font-size: 12.025px; + font-weight: bold; + white-space: nowrap; + color: #ffffff; + background-color: #f89406; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; + border-radius: 15px; + } + + .tooltip-inner { + background-color: #1ABC9C; + width: 150px; + } + + .tooltip.bottom .tooltip-arrow { + border-bottom: 5px solid #1ABC9C; + } + </style> +<style> + +span.question { + cursor: pointer; + display: inline-block; + width: 20px; + height: 20px; + background-color: #89A4CC; + line-height: 16px; + color: White; + font-size: 13px; + font-weight: bold; + border-radius: 8px; + text-align: center; + position: relative; +} +span.question:hover { background-color: #3D6199; } + + </style> + {% block css %} + <style type="text/css"> + body { + padding-top: 60px; + padding-bottom: 40px; + } + </style> + {% endblock %} + </head> + +<body> +<div class="navbar navbar navbar-fixed-top"> + <div class="navbar-inner"> + <div class="container"> + <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="brand" href="/">Python Textbook Companion <sup><span style="font-size:12px; color: white;">beta</span></sup></a> + <div class="nav-collapse collapse"> + + <ul class="nav pull-right"> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="{% url 'tbc:AboutPytbc' %}">TBC Coding Guidelines</a></li> + <li><a href="http://fossee.in" target="_blank">FOSSEE</a></li> + <li><a href="http://python.fossee.in" target="_blank">Python Team</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Textbooks<b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="{% url 'tbc:CompletedBooks' %}">Completed Books</a></li> + <li><a href="{% url 'tbc:BooksUnderProgress' %}">Books Under Progress</a></li> + </ul> + </li> + <li><a href="{% url 'tbc:InternshipForms' %}">Internship Forms</a></li> + + {% if user %} + {% if proposal_position %} + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.first_name }}<span class="badge-custom" rel="tooltip" title="Pending Proposal Position: {{ proposal_position }}" data-placement="bottom" style="margin-left:5px; margin-right:5px; display: inline-block">{{ proposal_position }}</span> + <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="{% url 'tbc:SubmitBook' %}">Submit Book (OLD)</a></li> + <li><a href="{% url 'tbc:ListAICTE' %}">Submit Proposal</a></li> + <li><a href="{% url 'tbc:SubmitSample' %}">Submit Sample Notebook</a></li> + <li><a href="{% url 'tbc:ConfirmBookDetails' %}">Submit Codes</a></li> + <li><a href="{% url 'tbc:GetCertificate' %}">Get Certificate</a></li> + <li><a href="{% url 'tbc:UpdateProfile' %}">Update Profile</a></li> + <li><a href="{% url 'tbc:UpdatePassword' %}">Update Password</a></li> + <li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li> + </ul> + </li> + {% else %} + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.first_name }}<b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="{% url 'tbc:SubmitBook' %}">Submit Book (OLD)</a></li> + <li><a href="{% url 'tbc:ListAICTE' %}">Submit Proposal</a></li> + <li><a href="{% url 'tbc:SubmitSample' %}">Submit Sample Notebook</a></li> + <li><a href="{% url 'tbc:ConfirmBookDetails' %}">Submit Codes</a></li> + <li><a href="{% url 'tbc:GetCertificate' %}">Get Certificate</a></li> + <li><a href="{% url 'tbc:UpdateProfile' %}">Update Profile</a></li> + <li><a href="{% url 'tbc:UpdatePassword' %}">Update Password</a></li> + <li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li> + </ul> + </li> + {% endif %} + {% endif %} + + {% if reviewer %} + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ reviewer.first_name }} {{ reviewer.last_name }} <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="{% url 'tbc:BookReview' %}">Review Books</a></li> + <li><a href="{% url 'tbc:ReviewProposals' %}">Review Proposals</a></li> + <li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li> + </ul> + </li> + {% endif %} + + {% if anonymous %} + <li><a href="{% url 'tbc:UserLogin' %}">Login</a></li> + <li><a href="{% url 'tbc:UserRegister' %}">Sign Up</a></li> + {% endif %} + + </ul> <!--/.nav --> + </div><!--/.nav-collapse --> + </div> + </div> + </div> + <div class="container"> + {% block content %} + {% if up %} + <center> + <div class="alert" style="width:500px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Book has been uploaded successfully !</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if login %} + <center> + <div class="alert" style="width:150px;height:23px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Login Successful !</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if logout %} + <center> + <div class="alert" style="width:300px;height:23px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>You have logged out successfully !</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if update_book %} + <center> + <div class="alert" style="width:300px;height:23px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Book has been updated successfully !</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if not_found %} + <center> + <div class="alert" style="width:650px;height:23px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>It seems that currently there is no book that you can update ! Please submit one.</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if proposal_submitted %} + <center> + <div class="alert" style="width:650px;height:40px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Thank you for showing interest in contributing to Python TBC. <br>We have received your proposal. Please be patient we will get back to you within few days.</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if proposal_pending %} + <center> + <div class="alert" style="width:650px;height:40px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>You either have a proposal pending or you are already working on a book. You cannot submit a proposal at this moment.</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if book_pending %} + <center> + <div class="alert" style="width:650px;height:40px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>You either have a proposal pending or you are already working on a book. You cannot submit a proposal at this moment.</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if no_book_alloted %} + <center> + <div class="alert" style="width:400px;height:25px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>There is no book alloted to you. You cannot submit codes.</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if sample_notebook %} + <center> + <div class="alert" style="width:550px;height:40px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Sample notebook has been submitted successfully. Please be patient while the reviewer reviews your codes & get backs to you.</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if cannot_submit_sample %} + <center> + <div class="alert" style="width:400px;height:25px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>You have not been permitted to send sample notebook.</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + {% if bookupdate %} + <center> + <div class="alert" style="width:400px;height:25px;"> + <a class="close" data-dismiss="alert" href="#">×</a> + <p>Thank You ! Codes have been updated successfully !</p> + </div> + </center> + <div class="clearfix"></div> + {% endif %} + +<div class="row-fluid"> + <h3 style='float: left;margin-left: 50px; display: inline-block;'>Editors' Picks</h3> +<div style="float:right; margin-right: 50px; width: 400px;"><gcse:search></gcse:search> + </div> +<td> + + <span class="showonhover"> + <span class="question">?</span> + <span class="hovertext"> + Minimum or NO trivial examples<br> + Maximum usage of scientific libraries + </span> + </span> +</td> + {% get_taglist as tags for 'tbc.book' %} + <div style="clear:both;"></div> + {% for item in items %} + {% if item.book.tags.all %} +<div class ="module-list"> + <a href="{% url 'tbc:BookDetails' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> + <center><a href="{% url 'tbc:BookDetails' item.book.id %}">{{ item.book.title }}</a></center> + </div> + {% endif %} + {% endfor %} + + +</div> + + + + <div class="row-fluid"> + <h3 style='float: left;margin-left: 50px; display: inline-block;'>Recent Submissions</h3> + <div style="float:right; margin-right: 50px; width: 400px;"> + <script> + (function() { + var cx = '001620609421546248003:nyipppxclkw'; + var gcse = document.createElement('script'); + gcse.type = 'text/javascript'; + gcse.async = true; + gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + + '//www.google.com/cse/cse.js?cx=' + cx; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(gcse, s); + })(); + </script> + + </div> + <div style="clear:both;"></div> + {% for item in items|slice:":3" %} + <div class ="module-list"> + <a href="{% url 'tbc:BookDetails' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> + <center><a href="{% url 'tbc:BookDetails' item.book.id %}">{{ item.book.title }}</a></center> + </div> + {% endfor %} + </div> + <br> + <center> + <a class="btn btn-primary" href="{% url 'tbc:BrowseBooks' %}">Browse All Books</a> + </center> + <br> + <!-- + <input type=text> <input type=submit value=Search> + --> + + + {% endblock %} + <hr> + + <footer> + <center><p>© FOSSEE - IIT Bombay 2014</p></center> + <center><img src="{% static 'images/fossee.png' %}" width=100 height=70><br><br> + <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</center> + </footer> + + </div> <!-- /container --> + + <script src="{% static 'js/jquery.js' %}"></script> + <script src="{% static 'js/bootstrap.min.js' %}"></script> + {% block script %} + {% endblock %} + + <!-- google analytics --> + <script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', 'UA-10406287-2', 'fossee.in'); + ga('send', 'pageview'); + </script> + <!-- / google analytics --> + <!-- Piwik --> +<script type="text/javascript"> + var _paq = _paq || []; + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://analytics.spoken-tutorial.org/"; + _paq.push(['setTrackerUrl', u+'piwik.php']); + _paq.push(['setSiteId', 15]); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; + g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); + })(); +</script> +<script type="text/javascript"> + $(document).ready(function(){ + $("[rel=tooltip]").tooltip(); + }); +</script> +<noscript><p><img src="http://analytics.spoken-tutorial.org/piwik.php?idsite=15" style="border:0;" alt="" /></p></noscript> +<!-- End Piwik Code --> + +</body> +</html> diff --git a/requirements.txt b/requirements.txt index 6e46e4a..ac72f30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,5 @@ requests==2.6.0 urllib3==1.10.2 wsgiref==0.1.2 scrapy==1.0.3 +django-taggit +django-taggit-templatetags2 diff --git a/tbc/certificate/tbc_certificate.tex b/tbc/certificate/tbc_certificate.tex new file mode 100644 index 0000000..06def58 --- /dev/null +++ b/tbc/certificate/tbc_certificate.tex @@ -0,0 +1,6 @@ +Certificate template for Python Textbook Companion +Write your own template and use $variable name to substitute that variable +with the data you want. +Example use in the template and then using Template class of the string +module you can substitute the with a name you want. +Note: The template should result in a tex file. diff --git a/tbc/forms.py b/tbc/forms.py index 327c32a..f1a1328 100644 --- a/tbc/forms.py +++ b/tbc/forms.py @@ -62,7 +62,7 @@ class BookForm(forms.ModelForm): self.fields['no_chapters'].label = "Number of Chapters" class Meta: model = Book - exclude = ('contributor', 'approved', 'reviewer') + exclude = ('contributor', 'approved', 'reviewer', 'tags') widgets = { 'title':forms.TextInput(attrs={'placeholder':'Title of the Book'}), 'author':forms.TextInput(attrs={'placeholder':'Author of the Book'}), diff --git a/tbc/models.py b/tbc/models.py index 4032125..44571ba 100644 --- a/tbc/models.py +++ b/tbc/models.py @@ -3,7 +3,7 @@ from django.contrib.auth.models import User from PythonTBC import settings from django.contrib.admin.models import LogEntry from local import sitemap_path - +from taggit.managers import TaggableManager CATEGORY = (("fluid mechanics", "Fluid Mechanics"), ("control systems", "Control Theory & Control Systems"), @@ -104,6 +104,7 @@ class Book(models.Model): contributor = models.ForeignKey(Profile) reviewer = models.ForeignKey(Reviewer) approved = models.BooleanField(default=False) + tags = TaggableManager() def __unicode__(self): name = self.title or 'Book' return '%s'%(name) diff --git a/tbc/static/css/base.css b/tbc/static/css/base.css index c3d835e..c3d835e 100755..100644 --- a/tbc/static/css/base.css +++ b/tbc/static/css/base.css diff --git a/tbc/static/css/responsive.css b/tbc/static/css/responsive.css index c0bba15..c0bba15 100755..100644 --- a/tbc/static/css/responsive.css +++ b/tbc/static/css/responsive.css diff --git a/tbc/static/js/.jshintrc b/tbc/static/js/.jshintrc index e072269..e072269 100755..100644 --- a/tbc/static/js/.jshintrc +++ b/tbc/static/js/.jshintrc diff --git a/tbc/static/js/bootstrap-affix.js b/tbc/static/js/bootstrap-affix.js index c1059a8..c1059a8 100755..100644 --- a/tbc/static/js/bootstrap-affix.js +++ b/tbc/static/js/bootstrap-affix.js diff --git a/tbc/static/js/bootstrap-alert.js b/tbc/static/js/bootstrap-alert.js index 9577e62..9577e62 100755..100644 --- a/tbc/static/js/bootstrap-alert.js +++ b/tbc/static/js/bootstrap-alert.js diff --git a/tbc/static/js/bootstrap-button.js b/tbc/static/js/bootstrap-button.js index 4b2a90a..4b2a90a 100755..100644 --- a/tbc/static/js/bootstrap-button.js +++ b/tbc/static/js/bootstrap-button.js diff --git a/tbc/static/js/bootstrap-carousel.js b/tbc/static/js/bootstrap-carousel.js index c1e8ade..c1e8ade 100755..100644 --- a/tbc/static/js/bootstrap-carousel.js +++ b/tbc/static/js/bootstrap-carousel.js diff --git a/tbc/static/js/bootstrap-collapse.js b/tbc/static/js/bootstrap-collapse.js index ae3e4c6..ae3e4c6 100755..100644 --- a/tbc/static/js/bootstrap-collapse.js +++ b/tbc/static/js/bootstrap-collapse.js diff --git a/tbc/static/js/bootstrap-dropdown.js b/tbc/static/js/bootstrap-dropdown.js index d04da5d..d04da5d 100755..100644 --- a/tbc/static/js/bootstrap-dropdown.js +++ b/tbc/static/js/bootstrap-dropdown.js diff --git a/tbc/static/js/bootstrap-modal.js b/tbc/static/js/bootstrap-modal.js index fb0b0db..fb0b0db 100755..100644 --- a/tbc/static/js/bootstrap-modal.js +++ b/tbc/static/js/bootstrap-modal.js diff --git a/tbc/static/js/bootstrap-popover.js b/tbc/static/js/bootstrap-popover.js index 2b323b4..2b323b4 100755..100644 --- a/tbc/static/js/bootstrap-popover.js +++ b/tbc/static/js/bootstrap-popover.js diff --git a/tbc/static/js/bootstrap-scrollspy.js b/tbc/static/js/bootstrap-scrollspy.js index 3ce5461..3ce5461 100755..100644 --- a/tbc/static/js/bootstrap-scrollspy.js +++ b/tbc/static/js/bootstrap-scrollspy.js diff --git a/tbc/static/js/bootstrap-tab.js b/tbc/static/js/bootstrap-tab.js index 3a132c0..3a132c0 100755..100644 --- a/tbc/static/js/bootstrap-tab.js +++ b/tbc/static/js/bootstrap-tab.js diff --git a/tbc/static/js/bootstrap-tooltip.js b/tbc/static/js/bootstrap-tooltip.js index acd6096..acd6096 100755..100644 --- a/tbc/static/js/bootstrap-tooltip.js +++ b/tbc/static/js/bootstrap-tooltip.js diff --git a/tbc/static/js/bootstrap-transition.js b/tbc/static/js/bootstrap-transition.js index c4fd401..c4fd401 100755..100644 --- a/tbc/static/js/bootstrap-transition.js +++ b/tbc/static/js/bootstrap-transition.js diff --git a/tbc/static/js/bootstrap-typeahead.js b/tbc/static/js/bootstrap-typeahead.js index 9cc84d8..9cc84d8 100755..100644 --- a/tbc/static/js/bootstrap-typeahead.js +++ b/tbc/static/js/bootstrap-typeahead.js diff --git a/tbc/static/js/jquery.js b/tbc/static/js/jquery.js index 006e953..006e953 100755..100644 --- a/tbc/static/js/jquery.js +++ b/tbc/static/js/jquery.js diff --git a/tbc/static/js/tests/index.html b/tbc/static/js/tests/index.html index 976ca16..976ca16 100755..100644 --- a/tbc/static/js/tests/index.html +++ b/tbc/static/js/tests/index.html diff --git a/tbc/static/js/tests/phantom.js b/tbc/static/js/tests/phantom.js index 4105bf5..4105bf5 100755..100644 --- a/tbc/static/js/tests/phantom.js +++ b/tbc/static/js/tests/phantom.js diff --git a/tbc/static/js/tests/server.js b/tbc/static/js/tests/server.js index 7c8445f..7c8445f 100755..100644 --- a/tbc/static/js/tests/server.js +++ b/tbc/static/js/tests/server.js diff --git a/tbc/static/js/tests/unit/bootstrap-affix.js b/tbc/static/js/tests/unit/bootstrap-affix.js index c978878..c978878 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-affix.js +++ b/tbc/static/js/tests/unit/bootstrap-affix.js diff --git a/tbc/static/js/tests/unit/bootstrap-alert.js b/tbc/static/js/tests/unit/bootstrap-alert.js index 9a6b514..9a6b514 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-alert.js +++ b/tbc/static/js/tests/unit/bootstrap-alert.js diff --git a/tbc/static/js/tests/unit/bootstrap-button.js b/tbc/static/js/tests/unit/bootstrap-button.js index e23ff9e..e23ff9e 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-button.js +++ b/tbc/static/js/tests/unit/bootstrap-button.js diff --git a/tbc/static/js/tests/unit/bootstrap-carousel.js b/tbc/static/js/tests/unit/bootstrap-carousel.js index 80b6e13..80b6e13 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-carousel.js +++ b/tbc/static/js/tests/unit/bootstrap-carousel.js diff --git a/tbc/static/js/tests/unit/bootstrap-collapse.js b/tbc/static/js/tests/unit/bootstrap-collapse.js index 4c5916e..4c5916e 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-collapse.js +++ b/tbc/static/js/tests/unit/bootstrap-collapse.js diff --git a/tbc/static/js/tests/unit/bootstrap-dropdown.js b/tbc/static/js/tests/unit/bootstrap-dropdown.js index 2f0d2d2..2f0d2d2 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-dropdown.js +++ b/tbc/static/js/tests/unit/bootstrap-dropdown.js diff --git a/tbc/static/js/tests/unit/bootstrap-modal.js b/tbc/static/js/tests/unit/bootstrap-modal.js index b0096f8..b0096f8 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-modal.js +++ b/tbc/static/js/tests/unit/bootstrap-modal.js diff --git a/tbc/static/js/tests/unit/bootstrap-phantom.js b/tbc/static/js/tests/unit/bootstrap-phantom.js index a04aeaa..a04aeaa 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-phantom.js +++ b/tbc/static/js/tests/unit/bootstrap-phantom.js diff --git a/tbc/static/js/tests/unit/bootstrap-popover.js b/tbc/static/js/tests/unit/bootstrap-popover.js index 20234e1..20234e1 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-popover.js +++ b/tbc/static/js/tests/unit/bootstrap-popover.js diff --git a/tbc/static/js/tests/unit/bootstrap-scrollspy.js b/tbc/static/js/tests/unit/bootstrap-scrollspy.js index 32bfa71..32bfa71 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-scrollspy.js +++ b/tbc/static/js/tests/unit/bootstrap-scrollspy.js diff --git a/tbc/static/js/tests/unit/bootstrap-tab.js b/tbc/static/js/tests/unit/bootstrap-tab.js index ba5910d..ba5910d 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-tab.js +++ b/tbc/static/js/tests/unit/bootstrap-tab.js diff --git a/tbc/static/js/tests/unit/bootstrap-tooltip.js b/tbc/static/js/tests/unit/bootstrap-tooltip.js index 5b37b4e..5b37b4e 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-tooltip.js +++ b/tbc/static/js/tests/unit/bootstrap-tooltip.js diff --git a/tbc/static/js/tests/unit/bootstrap-transition.js b/tbc/static/js/tests/unit/bootstrap-transition.js index 086773f..086773f 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-transition.js +++ b/tbc/static/js/tests/unit/bootstrap-transition.js diff --git a/tbc/static/js/tests/unit/bootstrap-typeahead.js b/tbc/static/js/tests/unit/bootstrap-typeahead.js index 0aa2d61..0aa2d61 100755..100644 --- a/tbc/static/js/tests/unit/bootstrap-typeahead.js +++ b/tbc/static/js/tests/unit/bootstrap-typeahead.js diff --git a/tbc/static/js/tests/vendor/jquery.js b/tbc/static/js/tests/vendor/jquery.js index 006e953..006e953 100755..100644 --- a/tbc/static/js/tests/vendor/jquery.js +++ b/tbc/static/js/tests/vendor/jquery.js diff --git a/tbc/static/js/tests/vendor/qunit.css b/tbc/static/js/tests/vendor/qunit.css index b3e3d00..b3e3d00 100755..100644 --- a/tbc/static/js/tests/vendor/qunit.css +++ b/tbc/static/js/tests/vendor/qunit.css diff --git a/tbc/static/js/tests/vendor/qunit.js b/tbc/static/js/tests/vendor/qunit.js index 46c95b2..46c95b2 100755..100644 --- a/tbc/static/js/tests/vendor/qunit.js +++ b/tbc/static/js/tests/vendor/qunit.js diff --git a/tbc/static/templates/editors-picks.html b/tbc/static/templates/editors-picks.html new file mode 100644 index 0000000..1406cf2 --- /dev/null +++ b/tbc/static/templates/editors-picks.html @@ -0,0 +1,26 @@ +<h4>Editors' Picks</h4> +<p> + <ul> + <p> + <li> + + <b> </b>Books with minimum or NO trivial examples + + </li> +<li> + + <b> </b>Books with maximum usage of scientific libraries like Sympy + + </li> +<li> + + <b> </b>Books with maximum usage of scientific libraries like Sympy + + </li> +<li> + + <b> </b>Books with maximum functions and classes + + </li> + </p> + diff --git a/tbc/templates/base.html b/tbc/templates/base.html index 40812eb..645ceed 100755..100644 --- a/tbc/templates/base.html +++ b/tbc/templates/base.html @@ -1,4 +1,5 @@ {% load static %} +{% load taggit_templatetags2_tags %} <!DOCTYPE html> <html lang="en"> <head> @@ -16,7 +17,14 @@ <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}" type="text/css" /> <link rel ="stylesheet" href="{% static 'css/responsive.css' %}" type="text/css"/> - <style> +<style> +.showonhover .hovertext { display: none;} +.showonhover:hover .hovertext {display: inline;} +a.viewdescription {color:#999;} +a.viewdescription:hover {background-color:#999; color: White;} +.hovertext {position:absolute;z-index:1000;border:1px solid #ffd971;background-color:#fffdce;padding:11px;width:250px;font-size: 0.75em;} +</style> +<style> .module-list { float: left; height: 220px; @@ -56,7 +64,7 @@ .gsc-search-button, .gsc-clear-button { position: relative; - top: -2px; + top: 2px; } .badge-custom { padding: 1.5px 7px 1.5px; @@ -79,14 +87,32 @@ border-bottom: 5px solid #1ABC9C; } </style> +<style> + + span.question { + cursor: pointer; + display: inline-block; + width: 20px; + height: 20px; + background-color: #89A4CC; + line-height: 16px; + color: White; + font-size: 13px; + font-weight: bold; + border-radius: 8px; + text-align: center; + position: relative; + } + span.question:hover { background-color: #3D6199; } - {% block css %} - <style type="text/css"> - body { - padding-top: 60px; - padding-bottom: 40px; - } - </style> + </style> + {% block css %} + <style type="text/css"> + body { + padding-top: 60px; + padding-bottom: 40px; + } +</style> {% endblock %} </head> @@ -106,7 +132,7 @@ <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">About<b class="caret"></b></a> <ul class="dropdown-menu"> - <li><a href="{% url 'tbc:AboutPytbc' %}">TBC Coding Guidelines</a></li> + <li><a href="http://fossee.in" target="_blank">FOSSEE</a></li> <li><a href="http://python.fossee.in" target="_blank">Python Team</a></li> </ul> @@ -114,11 +140,11 @@ <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Textbooks<b class="caret"></b></a> <ul class="dropdown-menu"> - <li><a href="{% url 'tbc:CompletedBooks' %}">Completed Books</a></li> - <li><a href="{% url 'tbc:BooksUnderProgress' %}">Books Under Progress</a></li> + <li><a href="{% url 'tbc:completed_books' %}">Completed Books</a></li> + <li><a href="{% url 'tbc:books_under_progress' %}">Books Under Progress</a></li> </ul> </li> - <li><a href="{% url 'tbc:InternshipForms' %}">Internship Forms</a></li> + <li><a href="{% url 'tbc:internship_forms' %}">Internship Forms</a></li> {% if user %} {% if proposal_position %} @@ -126,28 +152,28 @@ <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.first_name }}<span class="badge-custom" rel="tooltip" title="Pending Proposal Position: {{ proposal_position }}" data-placement="bottom" style="margin-left:5px; margin-right:5px; display: inline-block">{{ proposal_position }}</span> <b class="caret"></b></a> <ul class="dropdown-menu"> - <li><a href="{% url 'tbc:SubmitBook' %}">Submit Book (OLD)</a></li> - <li><a href="{% url 'tbc:ListAICTE' %}">Submit Proposal</a></li> - <li><a href="{% url 'tbc:SubmitSample' %}">Submit Sample Notebook</a></li> - <li><a href="{% url 'tbc:ConfirmBookDetails' %}">Submit Codes</a></li> - <li><a href="{% url 'tbc:GetCertificate' %}">Get Certificate</a></li> - <li><a href="{% url 'tbc:UpdateProfile' %}">Update Profile</a></li> - <li><a href="{% url 'tbc:UpdatePassword' %}">Update Password</a></li> - <li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li> + <li><a href="{% url 'tbc:submit_book' %}">Submit Book (OLD)</a></li> + <li><a href="{% url 'tbc:list_aicte' %}">Submit Proposal</a></li> + <li><a href="{% url 'tbc:submit_sample' %}">Submit Sample Notebook</a></li> + <li><a href="{% url 'tbc:confirm_book_details' %}">Submit Codes</a></li> + <li><a href="{% url 'tbc:get_certificate' %}">Get Certificate</a></li> + <li><a href="{% url 'tbc:update_profile' %}">Update Profile</a></li> + <li><a href="{% url 'tbc:update_password' %}">Update Password</a></li> + <li><a href="{% url 'tbc:user_logout' %}">Logout</a></li> </ul> </li> {% else %} <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ user.first_name }}<b class="caret"></b></a> <ul class="dropdown-menu"> - <li><a href="{% url 'tbc:SubmitBook' %}">Submit Book (OLD)</a></li> - <li><a href="{% url 'tbc:ListAICTE' %}">Submit Proposal</a></li> - <li><a href="{% url 'tbc:SubmitSample' %}">Submit Sample Notebook</a></li> - <li><a href="{% url 'tbc:ConfirmBookDetails' %}">Submit Codes</a></li> - <li><a href="{% url 'tbc:GetCertificate' %}">Get Certificate</a></li> - <li><a href="{% url 'tbc:UpdateProfile' %}">Update Profile</a></li> - <li><a href="{% url 'tbc:UpdatePassword' %}">Update Password</a></li> - <li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li> + <li><a href="{% url 'tbc:submit_book' %}">Submit Book (OLD)</a></li> + <li><a href="{% url 'tbc:list_aicte' %}">Submit Proposal</a></li> + <li><a href="{% url 'tbc:submit_sample' %}">Submit Sample Notebook</a></li> + <li><a href="{% url 'tbc:confirm_book_details' %}">Submit Codes</a></li> + <li><a href="{% url 'tbc:get_certificate' %}">Get Certificate</a></li> + <li><a href="{% url 'tbc:update_profile' %}">Update Profile</a></li> + <li><a href="{% url 'tbc:update_password' %}">Update Password</a></li> + <li><a href="{% url 'tbc:user_logout' %}">Logout</a></li> </ul> </li> {% endif %} @@ -157,18 +183,17 @@ <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ reviewer.first_name }} {{ reviewer.last_name }} <b class="caret"></b></a> <ul class="dropdown-menu"> - <li><a href="{% url 'tbc:BookReview' %}">Review Books</a></li> - <li><a href="{% url 'tbc:ReviewProposals' %}">Review Proposals</a></li> + <li><a href="{% url 'tbc:book_review' %}">Review Books</a></li> + <li><a href="{% url 'tbc:review_proposals' %}">Review Proposals</a></li> <li><a href="{% url 'tbc:admin_tools' %}">Admin Tools </a></li> - <li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li> - + <li><a href="{% url 'tbc:user_logout' %}">Logout</a></li> </ul> </li> {% endif %} {% if anonymous %} - <li><a href="{% url 'tbc:UserLogin' %}">Login</a></li> - <li><a href="{% url 'tbc:UserRegister' %}">Sign Up</a></li> + <li><a href="{% url 'tbc:user_login' %}">Login</a></li> + <li><a href="{% url 'tbc:user_register' %}">Sign Up</a></li> {% endif %} </ul> <!--/.nav --> @@ -286,6 +311,101 @@ </center> <div class="clearfix"></div> {% endif %} +<div style="float:right; margin-right: 50px; width: 400px;"><gcse:search></gcse:search> + </div> + <script src="http://code.jquery.com/jquery-1.4.min.js" type="text/javascript"></script> + <script type="text/javascript"> + $(document).ready(function(){ + + $("#objective").click(function(){ + $('#details').load('{% static "templates/objectives.html" %}'); + }); + + + $("#who").click(function(){ + $('#details').load('{% static "templates/who.html" %}'); + }); + + $("#how").click(function(){ + $('#details').load('{% static "templates/how.html" %}'); + }); + + $("#guidelines").click(function(){ + $('#details').load('{% static "templates/guidelines.html" %}'); + }); + + $("#goodies").click(function(){ + $('#details').load('{% static "templates/goodie.html" %}'); + }); + + $("#disclaimer").click(function(){ + $('#details').load('{% static "templates/disclaimer.html" %}'); + }); + + $("#faqs").click(function(){ + $('#details').load('{% static "templates/faq.html" %}'); + }); + + $("#contact").click(function(){ + $('#details').load('{% static "templates/contactus.html" %}'); + }); + }); + </script> + + + <div class="well span3" style="width:18%;margin-left:5px;margin-top:60px;"> + <div class="nav nav-list"> + <ul> + <li><a id="objective" href="#"><strong>Objective</strong></a></li> + <li><a id="who" href="#"><strong>Who can contribute ?</strong></a></li> + <li><a id="how" href="#"><strong>How to contribute ?</strong></a></li> + <li><a id="guidelines" href="#"><strong>Guidelines for Coding</strong></a></li> + <li><a id="goodies" href="#"><strong>Goodies</strong></a></li> + <li><a id="disclaimer" href="#"><strong>Disclaimer</strong></a></li> + <li><a id="faqs" href="#"><strong>FAQs</strong></a></li> + <li><a id="contact" href="#"><strong>Contact</strong></a></li> + </ul> + </div> + </div> + <div class="well span9" id="details" style="float:right;width:74%;margin-left:5px;min-height:150px;"> + <p>The Textbook Companion activity aims to create a repository of reference material for Python by coding solved examples of standard engineering textbooks using Python. This activity intends to,</p> + <ul> + <li>Make individuals learn Python through a practical approach</li> + <li>Provide a huge database of Companions as a learning resource</li> + <li>To make it easy for users of such textbooks to start using Python.</li> + <li>To improve the documentation available for Python</li> + </ul> + </div> +</div> + +<div class="row-fluid"> + <h3 style='float: left;margin-left: 50px; display: inline-block;'>Editors' Picks</h3> + +<td> + + <span class="showonhover"> + <span class="question">?</span> + <span class="hovertext"> + Books with maximum usage of scientific libraries + </span> + </span> +</td> + {% get_taglist as tags for 'tbc.book' %} + <div style="clear:both;"></div> + {% for item in items %} + {% if item.book.tags.all %} +<div class ="module-list"> + <a href="{% url 'tbc:book_details' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> + <center><a href="{% url 'tbc:book_details' item.book.id %}">{{ item.book.title }}</a></center> + </div> + {% endif %} + {% endfor %} + + +</div> + + + <div class="row-fluid"> <h3 style='float: left;margin-left: 50px; display: inline-block;'>Recent Submissions</h3> <div style="float:right; margin-right: 50px; width: 400px;"> @@ -301,24 +421,26 @@ s.parentNode.insertBefore(gcse, s); })(); </script> - <gcse:search></gcse:search> + </div> <div style="clear:both;"></div> - {% for item in items %} + {% for item in items|slice:":3" %} <div class ="module-list"> - <a href="{% url 'tbc:BookDetails' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> - <center><a href="{% url 'tbc:BookDetails' item.book.id %}">{{ item.book.title }}</a></center> + <a href="{% url 'tbc:book_details' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> + <center><a href="{% url 'tbc:book_details' item.book.id %}">{{ item.book.title }}</a></center> </div> {% endfor %} </div> <br> <center> - <a class="btn btn-primary" href="{% url 'tbc:BrowseBooks' %}">Browse All Books</a> + <a class="btn btn-primary" href="{% url 'tbc:browse_books' %}">Browse All Books</a> </center> <br> <!-- <input type=text> <input type=submit value=Search> --> + + {% endblock %} <hr> diff --git a/tbc/templates/tbc/aicte-books.html b/tbc/templates/tbc/aicte-books.html index a15d686..eb68e2b 100644 --- a/tbc/templates/tbc/aicte-books.html +++ b/tbc/templates/tbc/aicte-books.html @@ -16,7 +16,7 @@ function submitCategory() <hr> <div id="content-wrap"> <p>Below is the list of AICTE recommended books. You can propose a book just by clicking on the link. However, if you wish to submit your own preferences other than AICTE books, click the button given below.</p> - <a href="{% url 'tbc:SubmitProposal' %}" class="btn btn-primary">I don't want to propose AICTE book</a> + <a href="{% url 'tbc:submit_proposal' %}" class="btn btn-primary">I don't want to propose AICTE book</a> <hr> <center><h4>Select a Category</h4></center> <form name="aictebooks" action="/submit-aicte-proposal/" method=POST enctype="multipart/form-data"> @@ -52,7 +52,7 @@ function submitCategory() {{ forloop.counter }} </td> <td> - <a href="{% url 'tbc:SubmitAICTEProposal' book.id %}">{{ book.title }} by {{ book.author }}, {{ book.edition }} Edition</a> + <a href="{% url 'tbc:submit_aicte_proposal' book.id %}">{{ book.title }} by {{ book.author }}, {{ book.edition }} Edition</a> </td> </tr> {% endfor %} diff --git a/tbc/templates/tbc/book-details.html b/tbc/templates/tbc/book-details.html index b161c76..fc67847 100644 --- a/tbc/templates/tbc/book-details.html +++ b/tbc/templates/tbc/book-details.html @@ -20,7 +20,7 @@ function redirectToIpynb(notebook) {% for image in images %} <div class ="module-list"> {% if image.chapters_set.get.notebook %} - <a href="{% url 'tbc:ConvertNotebook' image.chapters_set.get.notebook %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ image.image }}"></a> + <a href="{% url 'tbc:convert_notebook' image.chapters_set.get.notebook %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ image.image }}"></a> {% else %} <img src="{% static 'Python-Textbook-Companions/' %}{{ image.image }}"> {% endif %} @@ -36,7 +36,7 @@ function redirectToIpynb(notebook) {% for chapter in chapters %} <tr> <td> - <a href="{% url 'tbc:ConvertNotebook' chapter.notebook %}">{{ chapter.name }}</a> + <a href="{% url 'tbc:convert_notebook' chapter.notebook %}">{{ chapter.name }}</a> </td> <td> <a href="{% static 'uploads/' %}{{ chapter.notebook }}">Download</a> @@ -45,7 +45,7 @@ function redirectToIpynb(notebook) {% endfor %} </table> <hr> -<a class="btn btn-primary btn-large" href="{% url 'tbc:GetZip' book.id %}" style="float:right; margin-top:20px;">Download Book as Zip</a> +<a class="btn btn-primary btn-large" href="{% url 'tbc:get_zip' book.id %}" style="float:right; margin-top:20px;">Download Book as Zip</a> <table> <tr> <td>Author: </td> @@ -57,7 +57,7 @@ function redirectToIpynb(notebook) </tr> <tr> <td>ISBN: </td> - <td><a href= http://www.isbnsearch.org/isbn/{{book.isbn}} target="_blank">{{book.isbn }}</a></td> + <td><a href= http://www.isbnsearch.org/isbn/{{ book.isbn }} target="_blank">{{ book.isbn }}</a></td> </tr> <tr> <td>Contributor: </td> @@ -77,8 +77,9 @@ function redirectToIpynb(notebook) </tr> <tr> <td>GitHub: </td> - <td><a href= 'https://github.com/FOSSEE/Python-Textbook-Companions/tree/master/{{book.title.split|join:"_"}}_by_{{book.author.split|join:"_"}}' target="_blank">{{book.title}}</a></td> + <td><a href= 'https://github.com/FOSSEE/Python-Textbook-Companions/tree/master/{{ book.title.split|join:"_" }}_by_{{ book.author.split|join:"_" }}' target="_blank">{{ book.title }}</a></td> </tr> + </table> </div> diff --git a/tbc/templates/tbc/book-review-details.html b/tbc/templates/tbc/book-review-details.html index 33401d5..26bf85f 100644 --- a/tbc/templates/tbc/book-review-details.html +++ b/tbc/templates/tbc/book-review-details.html @@ -6,7 +6,7 @@ {% for image in images %} <div class ="module-list"> {% if image.chapters_set.get.notebook %} - <a href="{% url 'tbc:ConvertNotebook' image.chapters_set.get.notebook %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ image.image }}"></a> + <a href="{% url 'tbc:convert_notebook' image.chapters_set.get.notebook %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ image.image }}"></a> {% else %} <img src="{% static 'Python-Textbook-Companions/' %}{{ image.image }}"> {% endif %} @@ -18,7 +18,7 @@ <table class="table table-bordered table-hover"> {% for chapter in chapters %} <tr> - <td><a href="{% url 'tbc:ConvertNotebook' chapter.notebook %}">{{ chapter.name }}</a></td> + <td><a href="{% url 'tbc:convert_notebook' chapter.notebook %}">{{ chapter.name }}</a></td> </tr> {% endfor %} </table> diff --git a/tbc/templates/tbc/book-review.html b/tbc/templates/tbc/book-review.html index 7bb88ff..f26c7ba 100644 --- a/tbc/templates/tbc/book-review.html +++ b/tbc/templates/tbc/book-review.html @@ -20,13 +20,13 @@ <center><h3>Books to be reviewed</h3></center> <ol> {% for book in books %} - <li><a href="{% url 'tbc:BookReview' book.id %}">{{ book.title }} {{ book.edition }} Edition</a> + <li><a href="{% url 'tbc:book_review' book.id %}">{{ book.title }} {{ book.edition }} Edition</a> {% endfor %} </ol> <center><h3>Reviewed Books</h3></center> <ol> {% for book in approved_books %} -<li><a href="{% url 'tbc:BookReview' book.id %}">{{ book.title }} {{ book.edition }} Edition</a></li> +<li><a href="{% url 'tbc:book_review' book.id %}">{{ book.title }} {{ book.edition }} Edition</a></li> {% endfor %} <ol> {% endblock %} diff --git a/tbc/templates/tbc/books_under_progress.html b/tbc/templates/tbc/books_under_progress.html index 494214b..90803ec 100644 --- a/tbc/templates/tbc/books_under_progress.html +++ b/tbc/templates/tbc/books_under_progress.html @@ -44,7 +44,7 @@ function submitCategory() {{ forloop.counter }} </td> <td> - <a href="{% url 'tbc:BookDetails' book.id %}">{{ book.title }} by {{ book.author }}</a> + <a href="{% url 'tbc:book_details' book.id %}">{{ book.title }} by {{ book.author }}</a> </td> </tr> {% endfor %} diff --git a/tbc/templates/tbc/browse-books.html b/tbc/templates/tbc/browse-books.html index 1c20ea5..31929b1 100644 --- a/tbc/templates/tbc/browse-books.html +++ b/tbc/templates/tbc/browse-books.html @@ -34,8 +34,8 @@ function submitCategory() <div class="row-fluid"> {% for item in items %} <div class ="module-list"> - <a href="{% url 'tbc:BookDetails' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> - <center><a href="{% url 'tbc:BookDetails' item.book.id %}">{{ item.book.title }}</a></center> + <a href="{% url 'tbc:book_details' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> + <center><a href="{% url 'tbc:book_details' item.book.id %}">{{ item.book.title }}</a></center> </div> {% endfor %} </div> diff --git a/tbc/templates/tbc/completed_books.html b/tbc/templates/tbc/completed_books.html index 11bdeb0..44acdc9 100644 --- a/tbc/templates/tbc/completed_books.html +++ b/tbc/templates/tbc/completed_books.html @@ -42,7 +42,7 @@ function submitCategory() {{ forloop.counter }} </td> <td> - <a href="{% url 'tbc:BookDetails' book.id %}">{{ book.title }} by {{ book.author }}</a> + <a href="{% url 'tbc:book_details' book.id %}">{{ book.title }} by {{ book.author }}</a> </td> </tr> {% endfor %} diff --git a/tbc/templates/tbc/get-certificate.html b/tbc/templates/tbc/get-certificate.html index 6b6b622..5273efa 100644 --- a/tbc/templates/tbc/get-certificate.html +++ b/tbc/templates/tbc/get-certificate.html @@ -16,7 +16,7 @@ {{ book.title }} by {{ book.author }}, {{ book.edition }} Edition </td> <td> - <a class="btn btn-primary" href="{% url 'tbc:GetCertificate' book.id %}">Get Certificate</a> + <a class="btn btn-primary" href="{% url 'tbc:get_certificate' book.id %}">Get Certificate</a> </td> </tr> {% endfor %} diff --git a/tbc/templates/tbc/link_image.html b/tbc/templates/tbc/link_image.html index 03cdcec..35d55d5 100644 --- a/tbc/templates/tbc/link_image.html +++ b/tbc/templates/tbc/link_image.html @@ -37,7 +37,7 @@ <b><u> Below are the links to the chapters:</u></b><br> {% for chapter in chapters %} - <a href="{% url 'tbc:ConvertNotebook' chapter.notebook %}" target="_blank">{{ chapter }}</a> + <a href="{% url 'tbc:convert_notebook' chapter.notebook %}" target="_blank">{{ chapter }}</a> <br> {% endfor %} </div> diff --git a/tbc/templates/tbc/login.html b/tbc/templates/tbc/login.html index fc71732..74c6405 100755..100644 --- a/tbc/templates/tbc/login.html +++ b/tbc/templates/tbc/login.html @@ -70,8 +70,8 @@ {% csrf_token %} {{ form.as_p }} <input class="btn btn-primary"type=submit value=Login> - <a href="{% url 'tbc:UserRegister' %}" class="btn btn-primary">Sign Up</a> - <a href="{% url 'tbc:ForgotPassword' %}" class="btn btn-primary">Forgot Password</a> + <a href="{% url 'tbc:user_register' %}" class="btn btn-primary">Sign Up</a> + <a href="{% url 'tbc:forgot_password' %}" class="btn btn-primary">Forgot Password</a> </form> </div> {% endblock %} diff --git a/tbc/templates/tbc/review-proposal.html b/tbc/templates/tbc/review-proposal.html index 2499b45..f8b67e0 100644 --- a/tbc/templates/tbc/review-proposal.html +++ b/tbc/templates/tbc/review-proposal.html @@ -25,13 +25,13 @@ ISBN: {{ textbook.isbn }}<br> Year of Pub.: {{ textbook.year_of_pub }}<br> Category: {{ textbook.category }}<br> - <a class="btn btn-primary btn-mini" href="{% url 'tbc:ReviewProposals' proposal.id textbook.id %}">Approve & Ask for Samples</a> + <a class="btn btn-primary btn-mini" href="{% url 'tbc:review_proposals' proposal.id textbook.id %}">Approve & Ask for Samples</a> </div> </div> </div> {% endfor %} <h5><b>Status:</b> You are yet to review this proposal</h5> - <a class="btn btn-primary" href="{% url 'tbc:RejectProposal' proposal.id %}">Reject</a> + <a class="btn btn-primary" href="{% url 'tbc:reject_proposal' proposal.id %}">Reject</a> </div> {% endfor %} </ol> @@ -71,8 +71,8 @@ {% ifequal proposal.proposal.status "sample resubmitted" %} {% if proposal.sample.sample_notebook %} <h5><a href="{% static 'Python-Textbook-Companions/' %}{{ proposal.sample.sample_notebook }}">sample notebook</a><br></h5> - <a class="btn btn-primary" href="{% url 'tbc:DisapproveProposal' proposal.proposal.id %}">Disapprove Samples</a> - <a class="btn btn-primary" href="{% url 'tbc:AllotBook' proposal.proposal.id %}">Alot Book</a> + <a class="btn btn-primary" href="{% url 'tbc:disapprove_proposal' proposal.proposal.id %}">Disapprove Samples</a> + <a class="btn btn-primary" href="{% url 'tbc:allot_book' proposal.proposal.id %}">Alot Book</a> <h5>This is resubmission of the sample notebook</h5> {% else %} <h5>Contributor has not re submitted sample notebook yet.</h5> @@ -81,8 +81,8 @@ {% ifequal proposal.proposal.status "sample submitted" %} {% if proposal.sample.sample_notebook %} <h5><a href="{% static 'Python-Textbook-Companions/' %}{{ proposal.sample.sample_notebook }}">sample notebook</a><br></h5> - <a class="btn btn-primary" href="{% url 'tbc:DisapproveProposal' proposal.proposal.id %}">Disapprove Samples</a> - <a class="btn btn-primary" href="{% url 'tbc:AllotBook' proposal.proposal.id %}">Alot Book</a> + <a class="btn btn-primary" href="{% url 'tbc:disapprove_proposal' proposal.proposal.id %}">Disapprove Samples</a> + <a class="btn btn-primary" href="{% url 'tbc:allot_book' proposal.proposal.id %}">Alot Book</a> {% else %} <h5>Contributor has not submitted sample notebook yet.</h5> {% endif %} diff --git a/tbc/urls.py b/tbc/urls.py index 6d3cc17..6c75ab3 100644 --- a/tbc/urls.py +++ b/tbc/urls.py @@ -2,54 +2,55 @@ from django.conf.urls import patterns, include, url urlpatterns = patterns('', - url(r'^$', 'tbc.views.Home', name='Home'), - url(r'^internship-forms/$', 'tbc.views.InternshipForms', name='InternshipForms'), - url(r'^about-pythontbc/$', 'tbc.views.AboutPytbc', name='AboutPytbc'), - url(r'^sample-notebook/$', 'tbc.views.SampleIpynb', name='SampleIpynb'), - url(r'^register/$', 'tbc.views.UserRegister', name='UserRegister'), - url(r'^login/$', 'tbc.views.UserLogin', name='UserLogin'), - url(r'^logout/$', 'tbc.views.UserLogout', name='UserLogout'), - url(r'^profile/$', 'tbc.views.UserProfile', name='UserProfile'), - url(r'^update-profile/$', 'tbc.views.UpdateProfile', name='UpdateProfile'), - url(r'^forgot-password/$', 'tbc.views.ForgotPassword', name='ForgotPassword'), - url(r'^update-password/$', 'tbc.views.UpdatePassword', name='UpdatePassword'), + url(r'^$', 'tbc.views.home', name='home'), + url(r'^internship-forms/$', 'tbc.views.internship_forms', name='internship_forms'), + url(r'^about-pythontbc/$', 'tbc.views.about_pytbc', name='about_pytbc'), + + url(r'^sample-notebook/$', 'tbc.views.sample_ipynb', name='sample_ipynb'), + url(r'^register/$', 'tbc.views.user_register', name='user_register'), + url(r'^login/$', 'tbc.views.user_login', name='user_login'), + url(r'^logout/$', 'tbc.views.user_logout', name='user_logout'), + url(r'^profile/$', 'tbc.views.user_profile', name='user_profile'), + url(r'^update-profile/$', 'tbc.views.update_profile', name='update_profile'), + url(r'^forgot-password/$', 'tbc.views.forgot_password', name='forgot_password'), + url(r'^update-password/$', 'tbc.views.update_password', name='update_password'), url(r'^admin-tools/$', 'tbc.views.admin_tools', name='admin_tools'), + + url(r'^submit-proposal/$', 'tbc.views.submit_proposal', name='submit_proposal'), + url(r'^submit-aicte-proposal/$', 'tbc.views.list_aicte', name='list_aicte'), + url(r'^submit-aicte-proposal/(?P<aicte_book_id>\d+)/$', 'tbc.views.submit_aicte_proposal', name='submit_aicte_proposal'), + url(r'^submit-book/$', 'tbc.views.submit_book', name='submit_book'), + url(r'^submit-sample/$', 'tbc.views.submit_sample', name='submit_sample'), + url(r'^submit-sample/(?P<proposal_id>\d+)$', 'tbc.views.submit_sample', name='submit_sample'), + url(r'^submit-sample/(?P<proposal_id>\d+)/(?P<old_notebook_id>\d+)$', 'tbc.views.submit_sample', name='submit_sample'), + url(r'^confirm-book-details/$', 'tbc.views.confirm_book_details', name='confirm_book_details'), + url(r'^submit-book-old/$', 'tbc.views.submit_book', name='submit_book'), + url(r'^submit-code/$', 'tbc.views.submit_code', name='submit_code'), + url(r'^submit-code-old/(?P<book_id>\d+)$', 'tbc.views.submit_code_old', name='submit_code_old'), + url(r'^update-content/(?P<book_id>\d+)$', 'tbc.views.update_content', name='update_content'), + url(r'^get-zip/(?P<book_id>\d+)$', 'tbc.views.get_zip', name='get_zip'), + url(r'^browse-books/$', 'tbc.views.browse_books', name='browse_books'), + url(r'^browse-books/(?P<category>.+)$', 'tbc.views.browse_books', name='browse_books'), + url(r'^convert-notebook/(?P<notebook_path>.+)$', 'tbc.views.convert_notebook', name='convert_notebook'), + url(r'^book-details/(?P<book_id>\d+)/$', 'tbc.views.book_details', name='book_details'), + url(r'^completed-books/$', 'tbc.views.completed_books', name='completed_books'), + url(r'^completed-books/(?P<category>.+)$', 'tbc.views.completed_books', name='completed_books'), + url(r'^books-under-progress/$', 'tbc.views.books_under_progress', name='books_under_progress'), + url(r'^redirect-ipynb/(?P<notebook_path>.+)$', 'tbc.views.redirect_to_ipynb', name='redirect_to_ipynb'), + url(r'^get-certificate/$', 'tbc.views.get_certificate', name='get_certificate'), + url(r'^get-certificate/(?P<book_id>\d+)/$', 'tbc.views.get_certificate', name='get_certificate'), - url(r'^submit-proposal/$', 'tbc.views.SubmitProposal', name='SubmitProposal'), - url(r'^submit-aicte-proposal/$', 'tbc.views.ListAICTE', name='ListAICTE'), - url(r'^submit-aicte-proposal/(?P<aicte_book_id>\d+)/$', 'tbc.views.SubmitAICTEProposal', name='SubmitAICTEProposal'), - url(r'^submit-book/$', 'tbc.views.SubmitBook', name='SubmitBook'), - url(r'^submit-sample/$', 'tbc.views.SubmitSample', name='SubmitSample'), - url(r'^submit-sample/(?P<proposal_id>\d+)$', 'tbc.views.SubmitSample', name='SubmitSample'), - url(r'^submit-sample/(?P<proposal_id>\d+)/(?P<old_notebook_id>\d+)$', 'tbc.views.SubmitSample', name='SubmitSample'), - url(r'^confirm-book-details/$', 'tbc.views.ConfirmBookDetails', name='ConfirmBookDetails'), - url(r'^submit-book-old/$', 'tbc.views.SubmitBook', name='SubmitBook'), - url(r'^submit-code/$', 'tbc.views.SubmitCode', name='SubmitCode'), - url(r'^submit-code-old/(?P<book_id>\d+)$', 'tbc.views.SubmitCodeOld', name='SubmitCodeOld'), - url(r'^update-content/(?P<book_id>\d+)$', 'tbc.views.UpdateContent', name='UpdateContent'), - url(r'^get-zip/(?P<book_id>\d+)$', 'tbc.views.GetZip', name='GetZip'), - url(r'^browse-books/$', 'tbc.views.BrowseBooks', name='BrowseBooks'), - url(r'^browse-books/(?P<category>.+)$', 'tbc.views.BrowseBooks', name='BrowseBooks'), - url(r'^convert-notebook/(?P<notebook_path>.+)$', 'tbc.views.ConvertNotebook', name='ConvertNotebook'), - url(r'^book-details/(?P<book_id>\d+)/$', 'tbc.views.BookDetails', name='BookDetails'), - 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'^get-certificate/$', 'tbc.views.GetCertificate', name='GetCertificate'), - url(r'^get-certificate/(?P<book_id>\d+)/$', 'tbc.views.GetCertificate', name='GetCertificate'), - - url(r'^book-review/$', 'tbc.views.BookReview', name='BookReview'), - url(r'^proposal-review/$', 'tbc.views.ReviewProposals', name='ReviewProposals'), - url(r'^proposal-review/(?P<proposal_id>\d+)/(?P<textbook_id>\d+)$', 'tbc.views.ReviewProposals', name='ReviewProposals'), - url(r'^disapprove-sample-notebook/(?P<proposal_id>\d+)$', 'tbc.views.DisapproveProposal', name='DisapproveProposal'), - url(r'^allot-book/(?P<proposal_id>\d+)$', 'tbc.views.AllotBook', name='AllotBook'), - url(r'^reject-proposal/(?P<proposal_id>\d+)$', 'tbc.views.RejectProposal', name='RejectProposal'), - url(r'^book-review/(?P<book_id>\d+)$', 'tbc.views.BookReview', name='BookReview'), - url(r'^approve-book/(?P<book_id>\d+)$', 'tbc.views.ApproveBook', name='ApproveBook'), - url(r'^notify-changes/(?P<book_id>\d+)$', 'tbc.views.NotifyChanges', name='NotifyChanges'), - url(r'^brokenbooks/$', 'tbc.views.get_broken_books', name='brokenbooks'), + url(r'^book-review/$', 'tbc.views.book_review', name='book_review'), + url(r'^proposal-review/$', 'tbc.views.review_proposals', name='review_proposals'), + url(r'^proposal-review/(?P<proposal_id>\d+)/(?P<textbook_id>\d+)$', 'tbc.views.review_proposals', name='review_proposals'), + url(r'^disapprove-sample-notebook/(?P<proposal_id>\d+)$', 'tbc.views.disapprove_proposal', name='disapprove_proposal'), + url(r'^allot-book/(?P<proposal_id>\d+)$', 'tbc.views.allot_book', name='allot_book'), + url(r'^reject-proposal/(?P<proposal_id>\d+)$', 'tbc.views.reject_proposal', name='reject_proposal'), + url(r'^book-review/(?P<book_id>\d+)$', 'tbc.views.book_review', name='book_review'), + url(r'^approve-book/(?P<book_id>\d+)$', 'tbc.views.approve_book', name='approve_book'), + url(r'^notify-changes/(?P<book_id>\d+)$', 'tbc.views.notify_changes', name='notify_changes'), + url(r'^brokenbooks/$', 'tbc.views.get_broken_books', name='broken_books'), url(r'^link-image/$', 'tbc.views.link_image', name='link_image'), # ajax urls diff --git a/tbc/views.py b/tbc/views.py index 7985128..4a469c5 100755..100644 --- a/tbc/views.py +++ b/tbc/views.py @@ -55,7 +55,7 @@ def is_reviewer(user): return True -def InternshipForms(request): +def internship_forms(request): context = {} images = [] if request.user.is_anonymous(): @@ -68,11 +68,11 @@ def InternshipForms(request): return render_to_response('tbc/internship-forms.html', context) -def SampleIpynb(request): +def sample_ipynb(request): return render_to_response('tbc/sample.html') -def AboutPytbc(request): +def about_pytbc(request): context = {} images = [] if request.user.is_anonymous(): @@ -85,7 +85,7 @@ def AboutPytbc(request): return render_to_response('tbc/about-pytbc.html', context) -def Home(request): +def home(request): context = {} images = [] if request.user.is_anonymous(): @@ -122,7 +122,7 @@ def Home(request): if 'bookupdate' in request.GET: context['bookupdate'] =True - books = Book.objects.filter(approved=True).order_by("-id")[0:6] + books = Book.objects.filter(approved=True).order_by("-id") for book in books: try: images.append(ScreenShots.objects.filter(book=book)[0]) @@ -152,11 +152,11 @@ def Home(request): return render_to_response('base.html', context) -def _checkProfile(user): +def _checkprofile(user): return Profile.objects.filter(user=user).exists() -def UserLogin(request): +def user_login(request): context = {} context.update(csrf(request)) if 'require_login' in request.GET: @@ -197,7 +197,7 @@ def UserLogin(request): return render_to_response('tbc/login.html', context) -def UserRegister(request): +def user_register(request): context = {} context.update(csrf(request)) if request.method == 'POST': @@ -224,7 +224,7 @@ def UserRegister(request): return render_to_response('tbc/register.html', context) -def UserProfile(request): +def user_profile(request): context = {} user = request.user if user.is_authenticated(): @@ -256,13 +256,13 @@ def UserProfile(request): return HttpResponseRedirect('/login/?require_login=True') -def UpdateProfile(request): +def update_profile(request): user = request.user context = {} context.update(csrf(request)) if user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') - if not _checkProfile(user): + if not _checkprofile(user): return HttpResponseRedirect("/profile/?update=profile") context['user'] = user user_profile = Profile.objects.get(user=user) @@ -290,7 +290,7 @@ def UpdateProfile(request): context['form'] = form return render_to_response('tbc/update-profile.html', context) -def UserLogout(request): +def user_logout(request): user = request.user if user.is_authenticated() and user.is_active: logout(request) @@ -298,7 +298,7 @@ def UserLogout(request): return redirect('/?logout=done') -def ForgotPassword(request): +def forgot_password(request): context = {} user_emails = [] context.update(csrf(request)) @@ -328,7 +328,7 @@ def ForgotPassword(request): return render_to_response("tbc/forgot-password.html", context) -def UpdatePassword(request): +def update_password(request): context = {} user = request.user context.update(csrf(request)) @@ -366,14 +366,14 @@ def UpdatePassword(request): return render_to_response("tbc/login.html", context) -def SubmitBook(request): +def submit_book(request): context = {} if request.user.is_anonymous(): return HttpResponseRedirect("/login/?require_login=true") else: curr_user = request.user if curr_user.is_authenticated(): - if not _checkProfile(curr_user): + if not _checkprofile(curr_user): return HttpResponseRedirect("/profile/?update=profile") user_profile = Profile.objects.get(user=curr_user) curr_proposals = Proposal.objects.filter(user=user_profile) @@ -414,9 +414,9 @@ def SubmitBook(request): -def SubmitCodeOld(request, book_id=None): +def submit_code_old(request, book_id=None): user = request.user - if not _checkProfile(user): + if not _checkprofile(user): return HttpResponseRedirect("/profile/?update=profile") curr_profile = Profile.objects.get(user=user) context = {} @@ -456,9 +456,9 @@ def SubmitCodeOld(request, book_id=None): return render_to_response('tbc/upload-content-old.html', context) -def SubmitProposal(request): +def submit_proposal(request): curr_user = request.user - if not _checkProfile(curr_user): + if not _checkprofile(curr_user): return HttpResponseRedirect("/profile/?update=profile") user_profile = Profile.objects.get(user=curr_user.id) context = {} @@ -537,12 +537,12 @@ Thank you for showing interest in contributing to Python Textbook Companion Acti return HttpResponseRedirect('/?proposal_pending=True') -def ListAICTE(request): +def list_aicte(request): if request.user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') else: curr_user = request.user - if not _checkProfile(curr_user): + if not _checkprofile(curr_user): return HttpResponseRedirect("/profile/?update=profile") user_profile = Profile.objects.get(user=curr_user.id) user_proposals = Proposal.objects.filter(user=user_profile) @@ -565,12 +565,12 @@ def ListAICTE(request): return render_to_response('tbc/aicte-books.html', context) -def SubmitAICTEProposal(request, aicte_book_id=None): +def submit_aicte_proposal(request, aicte_book_id=None): if request.user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') else: curr_user = request.user - if not _checkProfile(curr_user): + if not _checkprofile(curr_user): return HttpResponseRedirect("/profile/?update=profile") user_profile = Profile.objects.get(user=curr_user.id) context = {} @@ -637,7 +637,7 @@ def SubmitAICTEProposal(request, aicte_book_id=None): return HttpResponseRedirect('/?proposal_pending=True') -def ReviewProposals(request, proposal_id=None, textbook_id=None): +def review_proposals(request, proposal_id=None, textbook_id=None): context = {} user = request.user if is_reviewer(user): @@ -689,7 +689,7 @@ def ReviewProposals(request, proposal_id=None, textbook_id=None): return HttpResponse("not allowed") -def DisapproveProposal(request, proposal_id=None): +def disapprove_proposal(request, proposal_id=None): context = {} context.update(csrf(request)) proposal = Proposal.objects.get(id=proposal_id) @@ -709,7 +709,7 @@ def DisapproveProposal(request, proposal_id=None): return render_to_response('tbc/disapprove-sample.html', context) -def AllotBook(request, proposal_id=None): +def allot_book(request, proposal_id=None): context = {} proposal = Proposal.objects.get(id=proposal_id) proposal.status = "book alloted" @@ -721,7 +721,7 @@ def AllotBook(request, proposal_id=None): return HttpResponseRedirect("/book-review/?book_alloted=done") -def RejectProposal(request, proposal_id=None): +def reject_proposal(request, proposal_id=None): context = {} context.update(csrf(request)) proposal = Proposal.objects.get(id=proposal_id) @@ -746,13 +746,13 @@ def RejectProposal(request, proposal_id=None): return render_to_response('tbc/reject-proposal.html', context) -def SubmitSample(request, proposal_id=None, old_notebook_id=None): +def submit_sample(request, proposal_id=None, old_notebook_id=None): context = {} if request.user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') else: user = request.user - if not _checkProfile(user): + if not _checkprofile(user): return HttpResponseRedirect("/profile/?update=profile") context.update(csrf(request)) if request.method == "POST": @@ -793,13 +793,13 @@ def SubmitSample(request, proposal_id=None, old_notebook_id=None): return render_to_response('tbc/submit-sample.html', context) -def ConfirmBookDetails(request): +def confirm_book_details(request): context = {} if request.user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') else: current_user = request.user - if not _checkProfile(current_user): + if not _checkprofile(current_user): return HttpResponseRedirect("/profile/?update=profile") user_profile = Profile.objects.get(user=current_user) try: @@ -843,12 +843,14 @@ def ConfirmBookDetails(request): return render_to_response('tbc/confirm-details.html', context) -def SubmitCode(request): + + +def submit_code(request): if request.user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') else: user = request.user - if not _checkProfile(user): + if not _checkprofile(user): return HttpResponseRedirect("/profile/?update=profile") curr_profile = Profile.objects.get(user=user) context = {} @@ -943,7 +945,7 @@ def SubmitCode(request): return render_to_response('tbc/upload-content.html', context) -def UpdateContent(request, book_id=None): +def update_content(request, book_id=None): context = {} if request.user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') @@ -983,7 +985,7 @@ def UpdateContent(request, book_id=None): return render_to_response('tbc/update-content.html', context) -def generateZip(book_id): +def generate_zip(book_id): book = Book.objects.get(id=book_id) files_to_zip = [] file_path = os.path.abspath(os.path.dirname(__file__)) @@ -1003,7 +1005,7 @@ def generateZip(book_id): return s, zipfile_name -def GetZip(request, book_id=None): +def get_zip(request, book_id=None): user = request.user s, zipfile_name = generateZip(book_id) resp = HttpResponse(s.getvalue(), mimetype = "application/x-zip-compressed") @@ -1011,7 +1013,7 @@ def GetZip(request, book_id=None): return resp -def BookDetails(request, book_id=None): +def book_details(request, book_id=None): context = {} if request.user.is_anonymous(): context['anonymous'] = True @@ -1029,7 +1031,7 @@ def BookDetails(request, book_id=None): return render_to_response('tbc/book-details.html', context) -def BookReview(request, book_id=None): +def book_review(request, book_id=None): context = {} if is_reviewer(request.user): if book_id: @@ -1066,7 +1068,7 @@ def BookReview(request, book_id=None): return render_to_response('tbc/forbidden.html') -def ApproveBook(request, book_id=None): +def approve_book(request, book_id=None): context = {} user = request.user if is_reviewer(request.user): @@ -1120,7 +1122,7 @@ Congratulations !\nThe book - """+book.title+""" is now complete & published.\nP return render_to_response('tbc/forbidden.html') -def NotifyChanges(request, book_id=None): +def notify_changes(request, book_id=None): context = {} if is_reviewer(request.user): book = Book.objects.get(id=book_id) @@ -1156,7 +1158,7 @@ def NotifyChanges(request, book_id=None): return render_to_response('tbc/forbidden.html') -def BrowseBooks(request): +def browse_books(request): context = {} category = None images = [] @@ -1189,10 +1191,10 @@ def BrowseBooks(request): return render_to_response('tbc/browse-books.html', context) -def ConvertNotebook(request, notebook_path=None): + +def convert_notebook(request, notebook_path=None): """ Checks for the modified time of ipython notebooks and corresponding html page and replaces html page with new one if corresponding ipython notebook has been modified. """ - context = {} path = os.path.join(local.path, notebook_path.rsplit(".", 1)[0]) template_html = path+".html" @@ -1216,7 +1218,7 @@ def ConvertNotebook(request, notebook_path=None): return render_to_response(template_html, context) -def CompletedBooks(request): +def completed_books(request): context = {} context.update(csrf(request)) category = "All" @@ -1240,7 +1242,7 @@ def CompletedBooks(request): return render_to_response('tbc/completed_books.html', context) -def BooksUnderProgress(request): +def books_under_progress(request): context = {} context.update(csrf(request)) if request.user.is_anonymous(): @@ -1263,7 +1265,7 @@ def BooksUnderProgress(request): return render_to_response('tbc/books_under_progress.html', context) -def GetCertificate(request, book_id=None): +def get_certificate(request, book_id=None): if request.user.is_anonymous(): return HttpResponseRedirect('/login/?require_login=True') else: @@ -1340,7 +1342,7 @@ def _make_tbc_certificate(path): err = process.communicate()[1] return process.returncode, err -def RedirectToIpynb(request, notebook_path=None): +def redirect_to_ipynb(request, notebook_path=None): context = {} notebook = notebook_path.split("/") notebook[0] = "notebooks" |