summaryrefslogtreecommitdiff
path: root/tbc/templates
diff options
context:
space:
mode:
Diffstat (limited to 'tbc/templates')
-rwxr-xr-xtbc/templates/base.html57
-rw-r--r--tbc/templates/tbc/aicte-books.html25
-rw-r--r--tbc/templates/tbc/ajax-matching-books.html24
-rw-r--r--tbc/templates/tbc/book-review-details.html54
-rw-r--r--tbc/templates/tbc/book-review.html6
-rw-r--r--tbc/templates/tbc/confirm-aicte-details.html31
-rw-r--r--tbc/templates/tbc/confirm-details.html57
-rw-r--r--tbc/templates/tbc/disapprove-sample.html17
-rw-r--r--tbc/templates/tbc/reject-proposal.html17
-rw-r--r--tbc/templates/tbc/review-proposal.html98
-rw-r--r--tbc/templates/tbc/submit-proposal.html79
-rw-r--r--tbc/templates/tbc/submit-sample.html53
-rw-r--r--tbc/templates/tbc/update-book.html2
-rw-r--r--tbc/templates/tbc/update-code.html22
-rw-r--r--tbc/templates/tbc/upload-content.html10
15 files changed, 529 insertions, 23 deletions
diff --git a/tbc/templates/base.html b/tbc/templates/base.html
index e17d9bb..fbcfb05 100755
--- a/tbc/templates/base.html
+++ b/tbc/templates/base.html
@@ -69,8 +69,6 @@
</style>
{% endblock %}
- {% block script %}
- {% endblock %}
</head>
<body>
@@ -107,8 +105,9 @@
<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</a></li>
- <li><a href="{% url 'tbc:UpdateBook' %}">Update Submission</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:UpdatePassword' %}">Update Password</a></li>
<li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li>
</ul>
@@ -120,6 +119,7 @@
<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>
@@ -182,6 +182,52 @@
</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="#">&times;</a>
+ <p>Thank you for showing interest in contributing to Python TBC. <br>We have recevied 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="#">&times;</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="#">&times;</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="#">&times;</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="#">&times;</a>
+ <p>You have not been permitted to send sample notebook.</p>
+ </div>
+ </center>
+ <div class="clearfix"></div>
+ {% endif %}
+ <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>
@@ -199,7 +245,6 @@
<gcse:search></gcse:search>
</div>
<div style="clear:both;"></div>
- <div class="row-fluid">
{% for item in items %}
<div class ="module-list">
<a href="{% url 'tbc:BookDetails' item.book.id %}"><img src="{% static 'uploads/' %}{{ item.image.image }}"></a>
@@ -215,7 +260,7 @@
<!--
<input type=text> <input type=submit value=Search>
-->
- {% endblock %}
+ {% endblock %}
<hr>
<footer>
diff --git a/tbc/templates/tbc/aicte-books.html b/tbc/templates/tbc/aicte-books.html
new file mode 100644
index 0000000..4cc3d15
--- /dev/null
+++ b/tbc/templates/tbc/aicte-books.html
@@ -0,0 +1,25 @@
+{% extends 'base.html' %}
+{% load static %}
+{% block content %}
+ <center><h3>List of AICTE Books</h3></center>
+ <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>
+ <hr>
+ <table class="table table-bordered table-hover">
+ <th>SR #</th>
+ <th>Book (click on the link to propose the book)</th>
+ {% for book in aicte_books %}
+ <tr>
+ <td>
+ {{ forloop.counter }}
+ </td>
+ <td>
+ <a href="{% url 'tbc:SubmitAICTEProposal' book.id %}">{{ book.title }} by {{ book.author }}, {{ book.edition }} Edition</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+{% endblock %}
diff --git a/tbc/templates/tbc/ajax-matching-books.html b/tbc/templates/tbc/ajax-matching-books.html
new file mode 100644
index 0000000..c5fbfa8
--- /dev/null
+++ b/tbc/templates/tbc/ajax-matching-books.html
@@ -0,0 +1,24 @@
+<html>
+<body>
+<div>
+ <span id="flag">{% if flag %}match exists{% endif %}</span>
+ <div id="matches">
+ <center><h5>The books you have proposed may already be <b>under progress</b> or <b>completed</b> by some other contributor. Kindly verify and submit the proposal.</h5></center>
+ <hr>
+ {% for match in matches %}
+ {% if match %}
+ <b><h5>Potential matching books for your book preference {{ forloop.counter }}</h5></b>
+ {% else %}
+ <h5>No matching books found for book preference {{ forloop.counter }}</h5>
+ {% endif %}
+ <ul>
+ {% for book in match %}
+ <li>{{ book.title }} by {{ book.author }}</li>
+ {% endfor %}
+ </ul>
+ <hr>
+ {% endfor %}
+ </div>
+</div>
+</body>
+</html>
diff --git a/tbc/templates/tbc/book-review-details.html b/tbc/templates/tbc/book-review-details.html
index e55c23c..1aa888c 100644
--- a/tbc/templates/tbc/book-review-details.html
+++ b/tbc/templates/tbc/book-review-details.html
@@ -11,21 +11,30 @@
{% endfor %}
</div>
<hr>
-<ul>
-{% for chapter in chapters %}
- <li><a href="{% url 'tbc:ConvertNotebook' chapter.notebook %}">{{ chapter.name }}</a></li>
-{% endfor %}
-</ul>
+<table class="table table-bordered table-hover">
+ {% for chapter in chapters %}
+ <tr>
+ <td><a href="{% url 'tbc:ConvertNotebook' chapter.notebook %}">{{ chapter.name }}</a></td>
+ </tr>
+ {% endfor %}
+</table>
<hr>
-<form action="/approve-book/{{ book.id }}" method="POST">
-{% csrf_token %}
-<select name=approve_notify>
- <option value=none>Select an Action</option>
- <option value="approve">Approve</option>
- <option value="notify">Notify Changes</option>
-</select>
-<input type=submit value=GO>
-</form>
+{% if book.approved %}
+<h3>Book has been completed & approved</h3>
+{% else %}
+ <form action="/approve-book/{{ book.id }}" method="POST">
+ {% csrf_token %}
+ <select name=approve_notify>
+ <option value=none>Select an Action</option>
+ <option value="approve">Approve</option>
+ <option value="notify">Notify Changes</option>
+ </select>
+ <input type=submit value=GO>
+ </form>
+ {% ifequal proposal.status 'codes disapproved' %}
+ <p>The required corrections have already been notified to the user. Kindly check the Activity Log for more details</p>
+ {% endifequal %}
+{% endif %}
<table>
<tr><td>Author: &nbsp;&nbsp;<td>{{ book.author }}
<tr><td>Publisher: &nbsp;&nbsp;<td>{{ book.publisher_place }}
@@ -33,4 +42,21 @@
<tr><td>Contributor: &nbsp;&nbsp;<td>{{ book.contributor.user.first_name }} {{ book.contributor.user.last_name }}
<tr><td>Email: &nbsp;&nbsp;<td>{{ book.contributor.user.email }}<br>
</table>
+<hr>
+<table class="table table-bordered table-hover">
+ <tr>
+ <th>User</th>
+ <th>Time</th>
+ <th>Activity</th>
+ <th class="span6">Conversation</th>
+ </tr>
+{% for log in logs %}
+<tr>
+ <td> {{ log.user }} </td>
+ <td> {{ log.action_time }} </td>
+ <td> {{ log.change_message }} </td>
+ <td> {{ log.conversation|linebreaksbr }} </td>
+</tr>
+{% endfor %}
+<table>
{% endblock %}
diff --git a/tbc/templates/tbc/book-review.html b/tbc/templates/tbc/book-review.html
index d7270b4..7bb88ff 100644
--- a/tbc/templates/tbc/book-review.html
+++ b/tbc/templates/tbc/book-review.html
@@ -23,4 +23,10 @@
<li><a href="{% url 'tbc:BookReview' 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>
+{% endfor %}
+<ol>
{% endblock %}
diff --git a/tbc/templates/tbc/confirm-aicte-details.html b/tbc/templates/tbc/confirm-aicte-details.html
new file mode 100644
index 0000000..e8ab88b
--- /dev/null
+++ b/tbc/templates/tbc/confirm-aicte-details.html
@@ -0,0 +1,31 @@
+{% extends 'base.html' %}
+{% block content %}
+ <div id="content-wrap" style="max-width:600px;">
+ <center>
+ <h3>AICTE Book Details</h3>
+ <hr>
+ <p>
+ Kindly verify the book details. Also, fill in the missing details & submit the proposal.
+ </p>
+ <hr>
+ </center>
+ <form id="proposal-form" action="/submit-aicte-proposal/{{ aicte_book.id }}/" method=POST enctype="multipart/form-data">
+ {% csrf_token %}
+ {{ form.as_p }}
+ <hr>
+ <input id="proposal-form-submit" class="btn btn-primary" type=submit value=submit>
+ </form>
+ </div>
+{% endblock %}
+
+{% block script %}
+<script>
+$( document ).ready(function() {
+ title = document.getElementById('id_title').readOnly = true;
+ author = document.getElementById('id_author').readOnly = true;
+ publisher_place = document.getElementById('id_publisher_place').readOnly = true;
+ $('#id_no_chapters').hide();
+ $('label[for="id_no_chapters"]').hide();
+});
+</script>
+{% endblock %}
diff --git a/tbc/templates/tbc/confirm-details.html b/tbc/templates/tbc/confirm-details.html
new file mode 100644
index 0000000..96393ac
--- /dev/null
+++ b/tbc/templates/tbc/confirm-details.html
@@ -0,0 +1,57 @@
+{% extends 'base.html' %}
+{% block content %}
+<div id="content-wrap" style="max-width:600px;">
+ <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h3 id="myModalLabel">Verify Details</h3>
+ </div>
+ <div class="modal-body">
+ <p>You are submitting codes for the book <br> <b>{{ book.title }} by {{ book.author }}</b>.
+ <br>Kindly verify the book details &amp; <b>enter the number of chapters</b> you will submit the codes for.</p>
+ <p>Note: Consider only those chapters which have solved examples</p></p>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-primary" data-dismiss="modal">Ok</button>
+ </div>
+ </div>
+ <div id="chapterModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h3 id="myModalLabel">Invalid number of chapters</h3>
+ </div>
+ <div class="modal-body">
+ <p>No of chapters cannot be less than 0 or greater than 100</p>
+ <p>However, if the textbook has more than 100 chapters kindly contact the reviewer.</p>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-primary" data-dismiss="modal">Ok</button>
+ </div>
+ </div>
+ <form action="/confirm-book-details/" method=POST enctype="multipart/form-data">
+ {% csrf_token %}
+ {{ form.as_table }}
+ <br>
+ <input class="btn btn-primary" type=submit onclick="return validateChapters();" value="Update Details">
+ </form>
+</div>
+{% endblock %}
+
+{% block script %}
+ <script>
+ $(document).ready(function() {
+ $("#myModal").modal();
+ });
+
+ function validateChapters()
+ {
+ no_chapters = document.getElementById("id_no_chapters").value
+ if (no_chapters <= 0 || no_chapters > 100)
+ {
+ $("#chapterModal").modal();
+ return false;
+ }
+ return true;
+ }
+ </script>
+{% endblock %}
diff --git a/tbc/templates/tbc/disapprove-sample.html b/tbc/templates/tbc/disapprove-sample.html
new file mode 100644
index 0000000..2632edb
--- /dev/null
+++ b/tbc/templates/tbc/disapprove-sample.html
@@ -0,0 +1,17 @@
+{% extends 'base.html' %}
+{% load static %}
+{% block content %}
+<center><h3>Diapprove Sample Notebook</h3>
+<hr>
+<h4>Notifing Chages for book {{ proposal.accepted.title }} to {{ proposal.user.user.first_name }} {{ proposal.user.user.last_name }}</h4></center>
+<form action="/disapprove-sample-notebook/{{ proposal.id }}" method=POST enctype="multipart/form-data">
+{% csrf_token %}
+ <table>
+ <tr><td>To</td></tr>
+ <tr><td><input type="text" value="{{ proposal.user.user.email }}" readonly></td></tr>
+ <tr><td>Changes Required</td></tr>
+ <tr><td><textarea rows="15" cols="100" name="changes_required" style="width:100%;"></textarea></td></tr>
+ <tr><td><input class="btn btn-primary" type="submit" value="Send"></td></tr>
+ </table>
+</form>
+{% endblock %}
diff --git a/tbc/templates/tbc/reject-proposal.html b/tbc/templates/tbc/reject-proposal.html
new file mode 100644
index 0000000..11ce874
--- /dev/null
+++ b/tbc/templates/tbc/reject-proposal.html
@@ -0,0 +1,17 @@
+{% extends 'base.html' %}
+{% load static %}
+{% block content %}
+<center><h3>Proposal Rejection</h3>
+<hr>
+<h4>Rejecting proposal submitted by {{ proposal.user.user.first_name }} {{ proposal.user.user.last_name }}.</h4></center>
+<form action="/reject-proposal/{{ proposal.id }}" method=POST enctype="multipart/form-data">
+{% csrf_token %}
+ <table>
+ <tr><td>To</td></tr>
+ <tr><td><input type="text" value="{{ proposal.user.user.email }}" readonly></td></tr>
+ <tr><td>Reason/Remarks for rejection</td></tr>
+ <tr><td><textarea rows="15" cols="100" name="remarks" style="width:100%;"></textarea></td></tr>
+ <tr><td><input class="btn btn-primary" type="submit" value="Send"></td></tr>
+ </table>
+</form>
+{% endblock %}
diff --git a/tbc/templates/tbc/review-proposal.html b/tbc/templates/tbc/review-proposal.html
new file mode 100644
index 0000000..b660db8
--- /dev/null
+++ b/tbc/templates/tbc/review-proposal.html
@@ -0,0 +1,98 @@
+{% extends 'base.html' %}
+{% load static %}
+{% block content %}
+ <center><h2>New Proposals</h2></center>
+ <hr>
+ {% if no_new_proposal %}
+ <center><h4>There are no new proposals</h4></center>
+ {% endif %}
+ <ol>
+ {% for proposal in proposals %}
+ <li><h4>Proposal from {{ proposal.user.user.first_name }} {{ proposal.user.user.last_name }}</h4></li>
+ <div class="accordion" id="accordion1{{ forloop.parentloop.counter }}{{ forloop.counter }}">
+ {% for textbook in proposal.textbooks.all %}
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1{{ forloop.parentloop.counter }}{{ forloop.counter }}" href="#collapse1{{ forloop.parentloop.counter }}{{forloop.counter}}">
+ Book Preference {{ forloop.counter }} - {{ textbook.title }}
+ </a>
+ </div>
+ <div id="collapse1{{ forloop.parentloop.counter }}{{forloop.counter}}" class="accordion-body collapse">
+ <div class="accordion-inner">
+ Author: {{ textbook.author}}<br>
+ Edition: {{ textbook.edition }}<br>
+ Publisher: {{ textbook.publisher_place }}<br>
+ 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>
+ </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>
+ </div>
+ {% endfor %}
+ </ol>
+ <hr>
+ <center><h2>Proposals in Sample Notebook phase</h2></center>
+ <hr>
+ <ol>
+ {% for proposal in old_proposals %}
+ <h4><li>Proposal from {{ proposal.proposal.user.user.first_name }} {{ proposal.proposal.user.user.last_name }}</h4></li>
+ <div class="accordion" id="accordion2{{ forloop.counter }}">
+ {% for textbook in proposal.proposal.textbooks.all %}
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2{{ forloop.parentloop.counter }}{{ forloop.counter }}" href="#collapse2{{ forloop.parentloop.counter }}{{forloop.counter}}">
+ Book Preference {{ forloop.counter }} - {{ textbook.title }}
+ </a>
+ </div>
+ <div id="collapse2{{ forloop.parentloop.counter }}{{forloop.counter}}" class="accordion-body collapse">
+ <div class="accordion-inner">
+ Author: {{ textbook.author}}<br>
+ Edition: {{ textbook.edition }}<br>
+ Publisher: {{ textbook.publisher_place }}<br>
+ ISBN: {{ textbook.isbn }}<br>
+ Year of Pub.: {{ textbook.year_of_pub }}<br>
+ Category: {{ textbook.category }}<br>
+ </div>
+ </div>
+ </div>
+ {% endfor %}
+ <h5>
+
+ {% ifequal proposal.proposal.status "samples" %}
+ <b>Status:</b> Sample notebook phase
+ {% endifequal %}
+ </h5>
+ <h5><b>Book Accepted/Alloted:</b> {{ proposal.proposal.accepted.title }}</h5>
+ {% ifequal proposal.proposal.status "sample resubmitted" %}
+ {% if proposal.sample.sample_notebook %}
+ <h5><a href="{% static 'uploads/' %}{{ 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>
+ <h5>This is resubmission of the sample notebook</h5>
+ {% else %}
+ <h5>Contributor has not re submitted sample notebook yet.</h5>
+ {% endif %}
+ {% endifequal %}
+ {% ifequal proposal.proposal.status "sample submitted" %}
+ {% if proposal.sample.sample_notebook %}
+ <h5><a href="{% static 'uploads/' %}{{ 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>
+ {% else %}
+ <h5>Contributor has not submitted sample notebook yet.</h5>
+ {% endif %}
+ {% endifequal %}
+ {% ifequal proposal.proposal.status "sample disapproved" %}
+ <b>Status:</b> Samples have been disapproved. Contributor has not resubmitted sample notebook yet.
+ {% endifequal %}
+ </div>
+ {% endfor %}
+ </ol>
+{% endblock %}
+
+
diff --git a/tbc/templates/tbc/submit-proposal.html b/tbc/templates/tbc/submit-proposal.html
new file mode 100644
index 0000000..167fa5a
--- /dev/null
+++ b/tbc/templates/tbc/submit-proposal.html
@@ -0,0 +1,79 @@
+{% extends 'base.html' %}
+{% block content %}
+<div id="content-wrap" style="max-width:600px;">
+ <form id="proposal-form" action="/submit-proposal/" method=POST enctype="multipart/form-data">
+ {% csrf_token %}
+ {% for form in book_forms %}
+ <h4>Book Preference {{ forloop.counter }}</h4>
+ {{ form.errors }}
+ {{ form.as_p }}
+ {% endfor %}
+ <hr>
+ <input id="proposal-form-submit" class="btn btn-primary" type=submit value=submit>
+ </form>
+</div>
+
+
+<!-- Button to trigger modal -->
+<!-- Modal -->
+<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+ <h3 id="myModalLabel">Potential Matching Books</h3>
+ </div>
+ <div class="modal-body">
+ <p>One fine body…</p>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-primary" data-dismiss="modal">Go Back</button>
+ <button id="modal-submit-proposal" class="btn btn-danger">Submit Proposal</button>
+ </div>
+</div>
+{% endblock %}
+
+{% block script %}
+ <script>
+ $(document).ready(function() {
+ $("#proposal-form-submit").click(function(e) {
+ var i = 0;
+ var titles = [];
+ $titles = $("input[name='title']");
+ $titles = $("input[name='title']");
+ $titles.each(function(index, value) {
+ titles[i] = $(this).val();
+ ++i;
+ });
+ titles = JSON.stringify(titles);
+
+ $.ajax({
+ url: "/ajax/matching-books/",
+ type: "POST",
+ dataType: "html",
+ data: {
+ titles: titles
+ },
+ success: function(output) {
+ console.log(output);
+ var $output = $(output);
+ if($output.find("#flag").html() == "") {
+ $("#proposal-form").submit();
+ } else {
+ $(".modal-body").html($output.find("#matches").html());
+ $("#myModal").modal();
+ }
+ }
+ });
+ e.preventDefault();
+ });
+ $("#modal-submit-proposal").click(function(e){
+ $("#proposal-form").submit();
+ e.preventDefault();
+ });
+ });
+ $( document ).ready(function() {
+ $('input[id="id_no_chapters"]').hide();
+ $('label[for="id_no_chapters"]').hide();
+ });
+
+ </script>
+{% endblock %}
diff --git a/tbc/templates/tbc/submit-sample.html b/tbc/templates/tbc/submit-sample.html
new file mode 100644
index 0000000..322c339
--- /dev/null
+++ b/tbc/templates/tbc/submit-sample.html
@@ -0,0 +1,53 @@
+{% extends 'base.html' %}
+
+{% block script %}
+<script>
+function validate_content(ext, name)
+{
+ extension = document.getElementById(ext).value;
+ name = document.getElementById(name).value;
+ extension = extension.split(".");
+ if (extension == "" || name == "")
+ {
+ alert("Chapter name or file field is empty !");
+ return false;
+ }
+ if(extension.slice(Math.max(extension.length - 1, 1)) == "ipynb")
+ {
+ return true;
+ }
+ else
+ {
+ alert("Oops ! You can upload only Ipython Notebooks (.ipynb extension)");
+ return false;
+ }
+ return true;
+}
+</script>
+{% endblock %}
+
+{% block content %}
+<div id="content-wrap" style="max-width:600px;">
+ <h5>You are uploading sample notebook for the book <br>{{ proposal.accepted }} by {{ proposal.accepted.author }}</h5>
+ <p>Only .ipynb files are acceptable</p>
+ {% if has_old %}
+ <form action="/submit-sample/{{ proposal.id }}/{{ old_notebook.id }}" name="with-old" method=POST enctype="multipart/form-data" onSubmit="return validate_content('old_notebook', 'ch_name_old');">
+ {% csrf_token %}
+ <input type=text id=ch_name_old name=ch_name_old value="{{ old_notebook.name }}">
+ <input type=file id=old_notebook name=old_notebook>
+ <br>
+ <hr>
+ <center><input class="btn btn-primary" type=submit value=submit></center>
+ </form>
+ {% else %}
+ <form action="/submit-sample/{{ proposal.id }}" name="without-old" method=POST enctype="multipart/form-data" onSubmit="return validate_content('sample_notebook', 'ch_name');">
+ {% csrf_token %}
+ <input type=text id=ch_name name=ch_name placeholder="Name of the chapter you coded the solved example from">
+ <input type=file id=sample_notebook name=sample_notebook>
+ <br>
+ <hr>
+ <center><input class="btn btn-primary" type=submit value=submit></center>
+ </form>
+ {% endif %}
+</div>
+{% endblock %}
diff --git a/tbc/templates/tbc/update-book.html b/tbc/templates/tbc/update-book.html
index fb26a8b..c00d003 100644
--- a/tbc/templates/tbc/update-book.html
+++ b/tbc/templates/tbc/update-book.html
@@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% block content %}
<div id="content-wrap" style="max-width:600px;">
- <form action="/update-book/" method=POST enctype="multipart/form-data">
+ <form action="/confirm-book-deetails/" method=POST enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_table }}
<br>
diff --git a/tbc/templates/tbc/update-code.html b/tbc/templates/tbc/update-code.html
new file mode 100644
index 0000000..cce2038
--- /dev/null
+++ b/tbc/templates/tbc/update-code.html
@@ -0,0 +1,22 @@
+{% extends 'base.html' %}
+{% block content %}
+ <div id="content-wrap" style="max-width:600px;">
+ <p>You are updating codes for the book {{ book.title }} by {{ book.author }}</p>
+ <p>Upload the corrected IPython Notebooks & screen shots.</p>
+ <form action="/submit-code/" method=POST enctype="multipart/form-data">
+ {% csrf_token %}
+ {% for chapter in chapters %}
+ <input type=text name=chapter{{forloop.counter}} value="{{ chapter.name }}">
+ <input type=file name=notebook{{forloop.counter}}>
+ {% endfor %}
+ <br>
+ <hr>
+ <p>Upload 3 screenshots from any 3 random chapters and give proper captions</p>
+ {% for screenshot in screenshots %}
+ <input type=text name=caption{{forloop.counter}} value="{{ screenshot.caption }}">
+ <input type=file name=image{{forloop.counter}}>
+ {% endfor %}
+ <center><input type=submit value=submit></center>
+ </form>
+ </div>
+{% endblock %}
diff --git a/tbc/templates/tbc/upload-content.html b/tbc/templates/tbc/upload-content.html
index ddc0f72..2423bd4 100644
--- a/tbc/templates/tbc/upload-content.html
+++ b/tbc/templates/tbc/upload-content.html
@@ -44,10 +44,15 @@ function validate_content()
{% endblock %}
{% block content %}
+<center>
+ <h4>Submitting code for the book </h4>
+ <h4> {{ curr_book.title }} by {{ curr_book.author }}</h4>
+</center>
+<hr>
<div id="content-wrap" style="max-width:600px;">
<p>Upload chapters as individual IPython notebooks. Please do not use spaces to name your Ipython Notebook files. For ex.
use "chapter1.ipynb instead of chapter 1.ipynb"</p>
- <form action="/upload-content/{{ curr_book.id }}" method=POST enctype="multipart/form-data" onSubmit="return validate_content();">
+ <form action="/submit-code/" method=POST enctype="multipart/form-data">
{% csrf_token %}
{% for i in no_notebooks %}
<input type=text id=chapter{{i}} name=chapter{{i}} placeholder="Chapter {{ forloop.counter }} name">
@@ -60,7 +65,8 @@ function validate_content()
<input type=text id=caption{{i}} name=caption{{i}} placeholder="Caption {{ forloop.counter }}">
<input type=file id=image{{i}} name=image{{i}}>
{% endfor %}
- <center><input class="btn btn-primary" type=submit value=submit></center>
+ <br><br>
+ <center><input class="btn btn-primary" type=submit value=submit onClick="return validate_content();"></center>
</form>
</div>
{% endblock %}