diff --git a/compile_server/app/management/commands/fill_books.py b/compile_server/app/management/commands/fill_books.py index a8a30a1..a63c01d 100644 --- a/compile_server/app/management/commands/fill_books.py +++ b/compile_server/app/management/commands/fill_books.py @@ -33,7 +33,7 @@ class Command(BaseCommand): return # Look for 'chapters.yaml' - chapters_yaml = os.path.join(d, 'chapters.yaml') + chapters_yaml = os.path.join(d, 'info.yaml') if not os.path.isfile(chapters_yaml): print 'There is no "chapters.yaml" in {}'.format(d) return @@ -55,5 +55,6 @@ class Command(BaseCommand): b = Book(description=metadata['description'], directory=d, subpath=os.path.basename(os.path.normpath(d)), - title=metadata['title']) + title=metadata['title'], + author=metadata['author']) b.save() diff --git a/compile_server/app/migrations/0004_book_author.py b/compile_server/app/migrations/0004_book_author.py new file mode 100644 index 0000000..34d7a09 --- /dev/null +++ b/compile_server/app/migrations/0004_book_author.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2018-02-20 17:13 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0003_book'), + ] + + operations = [ + migrations.AddField( + model_name='book', + name='author', + field=models.TextField(default=''), + preserve_default=False, + ), + ] diff --git a/compile_server/app/models.py b/compile_server/app/models.py index eee203b..899e258 100644 --- a/compile_server/app/models.py +++ b/compile_server/app/models.py @@ -65,4 +65,7 @@ class Book(models.Model): description = models.TextField() # the title of the book - title = models.TextField() \ No newline at end of file + title = models.TextField() + + # the author of the book + author = models.TextField() \ No newline at end of file diff --git a/compile_server/app/static/book_base.css b/compile_server/app/static/book_base.css index 3dc3345..174de6c 100755 --- a/compile_server/app/static/book_base.css +++ b/compile_server/app/static/book_base.css @@ -11,7 +11,7 @@ body { p { font-family: 'Poppins', sans-serif; - font-size: 1.1em; + font-size: 0.9em; font-weight: 300; line-height: 1.7em; color: #999; @@ -56,7 +56,7 @@ a, a:hover, a:focus { #sidebar { min-width: 250px; max-width: 250px; - background: #7386D5; + background: #333333; color: #fff; transition: all 0.3s; } @@ -67,7 +67,6 @@ a, a:hover, a:focus { #sidebar .sidebar-header { padding: 20px; - background: #6d7fcc; } #sidebar ul.components { @@ -82,7 +81,7 @@ a, a:hover, a:focus { #sidebar ul li a { padding: 10px; - font-size: 1.1em; + font-size: 0.9em; display: block; } #sidebar ul li a:hover { @@ -92,7 +91,7 @@ a, a:hover, a:focus { #sidebar ul li.active > a, a[aria-expanded="true"] { color: #fff; - background: #6d7fcc; + background: #777777; } @@ -112,7 +111,7 @@ a[aria-expanded="true"]::before { content: '\e260'; } - +/* ul ul a { font-size: 0.9em !important; padding-left: 30px !important; @@ -140,13 +139,14 @@ a.article, a.article:hover { background: #6d7fcc !important; color: #fff !important; } - +*/ /* --------------------------------------------------- CONTENT STYLE ----------------------------------------------------- */ -#content { +#reader_content { + margin: 20px; padding: 20px; min-height: 100vh; transition: all 0.3s; diff --git a/compile_server/app/static/navbar-fixed-left.min.css b/compile_server/app/static/navbar-fixed-left.min.css deleted file mode 100644 index 94a8227..0000000 --- a/compile_server/app/static/navbar-fixed-left.min.css +++ /dev/null @@ -1 +0,0 @@ -@media (min-width:768px){.container{width:503px}}@media (min-width:992px){.container{width:723px}}@media (min-width:1200px){.container{width:923px}}@media (min-width:1432px){.container{width:1170px}}body{padding-top:70px;min-height:200vh}.navbar-fixed-left,.navbar-fixed-right{position:fixed;top:0;width:100%;z-index:1030}@media (min-width:768px) and (min-width:768px){.navbar-fixed-left,.navbar-fixed-right{width:232px;height:100vh;border-radius:0}.navbar-fixed-left .container,.navbar-fixed-right .container{padding-right:0;padding-left:0;width:auto}.navbar-fixed-left .navbar-header,.navbar-fixed-right .navbar-header{padding-left:15px;padding-right:15px}.navbar-fixed-left .navbar-collapse,.navbar-fixed-right .navbar-collapse{padding-right:0;padding-left:0;max-height:none}.navbar-fixed-left .navbar-collapse .navbar-nav,.navbar-fixed-right .navbar-collapse .navbar-nav{float:none!important}.navbar-fixed-left .navbar-collapse .navbar-nav>li,.navbar-fixed-right .navbar-collapse .navbar-nav>li{width:100%}.navbar-fixed-left .navbar-collapse .navbar-nav>li.dropdown .dropdown-menu,.navbar-fixed-right .navbar-collapse .navbar-nav>li.dropdown .dropdown-menu{top:0}.navbar-fixed-left .navbar-collapse .navbar-nav.navbar-right,.navbar-fixed-right .navbar-collapse .navbar-nav.navbar-right{margin-right:0}}@media (min-width:768px){body{padding-top:0;padding-left:232px}.navbar-fixed-left{right:auto!important;left:0!important;border-width:0 1px 0 0!important}.navbar-fixed-left .dropdown .dropdown-menu{left:100%;right:auto;border-radius:0 3px 3px 0}.navbar-fixed-left .dropdown .dropdown-toggle .caret{border-top:4px solid transparent;border-left:4px solid;border-bottom:4px solid transparent;border-right:none}} \ No newline at end of file diff --git a/compile_server/app/static/sidebar.css b/compile_server/app/static/sidebar.css new file mode 100644 index 0000000..d323133 --- /dev/null +++ b/compile_server/app/static/sidebar.css @@ -0,0 +1,110 @@ +@media (min-width:768px) { + .container { + width: 503px + } +} + +@media (min-width:992px) { + .container { + width: 723px + } +} + +@media (min-width:1200px) { + .container { + width: 923px + } +} + +@media (min-width:1432px) { + .container { + width: 1170px + } +} + +body { + padding-top: 70px; + min-height: 200vh +} + +.navbar-fixed-left, +.navbar-fixed-right { + position: fixed; + top: 0; + width: 100%; + z-index: 1030; +} + +#toc { + height: 100vh; + overflow: hidden; +} + +#toc:hover, #toc:active, #toc:focus { + overflow: auto; +} + +@media (min-width:768px) and (min-width:768px) { + .navbar-fixed-left, + .navbar-fixed-right { + width: 232px; + height: 100vh; + border-radius: 0 + } + .navbar-fixed-left .container, + .navbar-fixed-right .container { + padding-right: 0; + padding-left: 0; + width: auto + } + .navbar-fixed-left .navbar-header, + .navbar-fixed-right .navbar-header { + padding-left: 15px; + padding-right: 15px + } + .navbar-fixed-left .navbar-collapse, + .navbar-fixed-right .navbar-collapse { + padding-right: 0; + padding-left: 0; + max-height: none + } + .navbar-fixed-left .navbar-collapse .navbar-nav, + .navbar-fixed-right .navbar-collapse .navbar-nav { + float: none!important + } + .navbar-fixed-left .navbar-collapse .navbar-nav>li, + .navbar-fixed-right .navbar-collapse .navbar-nav>li { + width: 100% + } + .navbar-fixed-left .navbar-collapse .navbar-nav>li.dropdown .dropdown-menu, + .navbar-fixed-right .navbar-collapse .navbar-nav>li.dropdown .dropdown-menu { + top: 0 + } + .navbar-fixed-left .navbar-collapse .navbar-nav.navbar-right, + .navbar-fixed-right .navbar-collapse .navbar-nav.navbar-right { + margin-right: 0 + } +} + +@media (min-width:768px) { + body { + padding-top: 0; + padding-left: 232px + } + .navbar-fixed-left { + right: auto!important; + left: 0!important; + border-width: 0 1px 0 0!important + } + .navbar-fixed-left .dropdown .dropdown-menu { + left: 100%; + right: auto; + border-radius: 0 3px 3px 0 + } + .navbar-fixed-left .dropdown .dropdown-toggle .caret { + border-top: 4px solid transparent; + border-left: 4px solid; + border-bottom: 4px solid transparent; + border-right: none + } +} \ No newline at end of file diff --git a/compile_server/app/static/sidebar.js b/compile_server/app/static/sidebar.js index d5e21b0..de0890c 100644 --- a/compile_server/app/static/sidebar.js +++ b/compile_server/app/static/sidebar.js @@ -1,40 +1,13 @@ -$( document ).ready(function() { - $( '.sidebar-link' ).click(function(event) { - var linkid = event.target.id; - var page_number = linkid.substr(12) - var divsearch = "#page_anchor_" + page_number; +$(document).ready( function() { - if($( divsearch ).length) { - $( 'html, body' ).animate({ - scrollTop: $( divsearch ).offset().top - }, 500); - } - else { - infinite_scroll(divsearch); - } + $( ".toc_link" ).click( function() { + + var lid = $( this ).attr( 'id' ); + var hid = "#header" + lid.substr(5); + + $( 'html, body' ).animate( { + scrollTop: $( hid ).offset().top + }, 800); }); - function infinite_scroll(search_elem) { - $('html, body').animate({ - scrollTop: $( document ).height() - }, 500, function() { - if(!$( search_elem ).length) { - infinite_scroll(search_elem); - } - }); - - } - - - var infinite = new Waypoint.Infinite({ - element: $( '.infinite-container' )[0], - onBeforePageLoad: function () { - $( '.loading' ).show(); - }, - onAfterPageLoad: function ($items) { - $( '.loading' ).hide(); - } - }); -}); - - +}); \ No newline at end of file diff --git a/compile_server/app/templates/book_base.html b/compile_server/app/templates/book_base.html index 9dc5088..0ac58c6 100644 --- a/compile_server/app/templates/book_base.html +++ b/compile_server/app/templates/book_base.html @@ -4,15 +4,11 @@ - Ada for the C Programmer + Book Reader - - - - - + @@ -23,6 +19,7 @@ + diff --git a/compile_server/app/templates/book_list.html b/compile_server/app/templates/book_list.html index 328b7d3..da89799 100644 --- a/compile_server/app/templates/book_list.html +++ b/compile_server/app/templates/book_list.html @@ -22,6 +22,7 @@ {{ b.title }} {{ b.description }} + {{ b.author }} {% endfor %} @@ -33,7 +34,7 @@ - +