diff --git a/importBooks.pstat b/importBooks.pstat new file mode 100644 index 0000000..e69de29 diff --git a/src/interface/migrations/0005_navigation.py b/src/interface/migrations/0005_navigation.py new file mode 100644 index 0000000..fcae6e3 --- /dev/null +++ b/src/interface/migrations/0005_navigation.py @@ -0,0 +1,35 @@ +# Generated by Django 3.0.4 on 2020-06-10 05:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("interface", "0004_collections"), + ] + + operations = [ + migrations.CreateModel( + name="Navigation", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=255)), + ("link", models.CharField(max_length=255, null=True)), + ("category", models.CharField(max_length=255, null=True)), + ("parent_id", models.IntegerField(null=True)), + ("alt", models.CharField(max_length=255, null=True)), + ("type", models.IntegerField(null=True)), + ("socket", models.CharField(max_length=255)), + ], + options={"db_table": "navigation",}, + ), + ] diff --git a/src/interface/models.py b/src/interface/models.py index 2f07909..a80dce3 100755 --- a/src/interface/models.py +++ b/src/interface/models.py @@ -62,3 +62,40 @@ class Collections(models.Model): except Exception as e: raise return results + + +class Navigation(models.Model): + """ + pyShelfs Navigation Database class + :param title: Link Text + :param link: Link link :) + :param category: Where in the nav tree do I belong + :param parent_id: This link is a sub link of link with id of me + :param alt: Alternate text of link + :param type: Web link, or Socket link which will be expected to act on \ + the link, and the action defined in socket + :param socket: if a Socket link define socket here + """ + + class Meta: + db_table = "navigation" + + def __str__(self): + return self.title + + title = models.CharField(max_length=255) + link = models.CharField(max_length=255, null=True) + category = models.CharField(max_length=255, null=True) + parent_id = models.IntegerField(null=True, editable=True) + alt = models.CharField(max_length=255, null=True) + type = models.IntegerField(null=True) + socket = models.CharField(max_length=255, null=False) + + def generic_search(self, query): + try: + results = Navigation.objects.annotate( + search=SearchVector("title", "parent_id", "category"), + ).filter(search=query) + except Exception as e: + raise + return results diff --git a/src/interface/static/css/main.css b/src/interface/static/css/main.css index c3f93d9..c1da0b0 100755 --- a/src/interface/static/css/main.css +++ b/src/interface/static/css/main.css @@ -1,19 +1,17 @@ body { margin: 0px; padding: 0px; - background-color: #DCDCDD; - color: #fff; + background-color: #FFF; + color: #000; overflow-x: hidden; } #app { display: grid; grid-template-areas: - "app_header" - "app_body" - "app_footer"; - grid-template-rows: 52px auto auto; - /* max-height: 100%; */ + "app_body"; + grid-template-rows: auto; + /*! max-height: 100%; */ } .clear { @@ -28,8 +26,7 @@ body { "title nav_left_top nav_center_top nav_right_top"; grid-template-columns: 225px auto auto; padding: 4px 0px 4px; - grid-auto-columns: auto; - background-color: #2b2b2b; + background-color: #2d2d2d; } .nav_left_top { @@ -55,15 +52,15 @@ body { .app_hdr { grid-area: title; - margin: 0px 0px 5px 0px; + margin: 0px 0px 0px 0px; font-family: 'Gruppo', cursive; - font-size: 36px; + font-size: 20px; text-align: start; - padding: 0px 0px 0px 5px; + padding: 0px 0px 0px 0px; } .shadow { - text-shadow: #4c5c68 -5px 3px 5px; + text-shadow: #fff -1px 0px 11px; } .app_subhdr { @@ -87,24 +84,24 @@ body { grid-area: app_body; grid-template-rows: auto; grid-template-areas: "nav_l shelf"; - grid-template-columns: 15vw 85vw; - background-color: dimgray; + grid-template-columns: 160px auto; + background-color: white; } .nav_l { display: grid; grid-area: nav_l; font-family: 'Gruppo', cursive; - font-size: 20px; - max-height: 500px; + font-size: 15px; + /*! max-height: 500px; */ overflow-y: scroll; - padding: 0px 10px; + /*! padding: 0px 10px; */ } .popover{ display: none; z-index: 100; - background-color: #000; + background-color: #cecece; /*min-width: 200px;*/ min-height: 30px; position: fixed; @@ -116,31 +113,33 @@ body { padding: 0px 10px; } .nav_l_hdr { - text-align: center; - padding: 5px; - background-color: #292f35; - border-bottom: 2px solid #000; + /*! text-align: center; */ + padding: 1px; + background-color: #9e9e9e; + border-bottom: 2px solid #dadada; + color: black; + font-weight: bold; } .nav_l_0 { - background-color: #2b2b2b; - padding: 5px; - text-align: center; - border-bottom: 1px solid #000; + background-color: #dadada; + /*! padding: 5px; */ + /*! text-align: center; */ + border-bottom: 1px solid #dadada; } .nav_l_1 { - padding: 5px; - text-align: center; - border-bottom: 1px solid #000; + /*! padding: 5px; */ + /*! text-align: center; */ + border-bottom: 1px solid #dadada; } .nav_link {} #vert-nav { list-style: None; padding: 0px; margin: 10px 0px; - border-left: 5px solid #292f35; - border-right: 5px solid #292f35; + /*! border-left: 5px solid #292f35; */ + /*! border-right: 5px solid #292f35; */ } .vert-nav-item {} @@ -224,11 +223,11 @@ body { background-color: darkgray; border-radius: 5px; border: 1px solid #999; - min-width: 110px; + /*! min-width: 110px; */ margin: 0px 5px 0px 0px; - padding-top: 2px; - padding-bottom: 2px; - max-height: 20px; + /*! padding-top: 2px; */ + /*! padding-bottom: 2px; */ + /*! max-height: 20px; */ } .nav_search { @@ -308,5 +307,13 @@ a.book_link { a.nav_link { text-decoration: none; - color: #fff; + color: #000; +} +.hidden{ + display: none; +} +.vert-nav{ + list-style: None; + padding: 0px; + margin: 0px 0px; } diff --git a/src/interface/static/js/pyshelf_ux.js b/src/interface/static/js/pyshelf_ux.js index 64374cf..8bad8e5 100755 --- a/src/interface/static/js/pyshelf_ux.js +++ b/src/interface/static/js/pyshelf_ux.js @@ -30,9 +30,9 @@ $(document).ready(function(){ $(this).removeAttr("disabled"); } }); - $('#app').css("height", max_height); - $('.nav_l').css("max-height", max_height); - $('div.shelf').css("max-height", max_height); +// $('#app').css("height", max_height); +// $('.nav_l').css("max-height", max_height); +// $('div.shelf').css("max-height", max_height); $('.nav_link').on('mouseover', function (e){ var popover_str = $(this).attr('alt'); x = $(this).offset().left @@ -51,4 +51,7 @@ $(document).ready(function(){ $('.popover').css('top', y); $('.popover').css('display','none'); }); + $('#btn_collections').on('click', function (e){ + $('.hidden.vert-nav.collections').toggle() + }); }) diff --git a/src/interface/templates/index.html b/src/interface/templates/index.html index 6990132..df05431 100755 --- a/src/interface/templates/index.html +++ b/src/interface/templates/index.html @@ -19,32 +19,50 @@
-
-
-

pyShelf {{Version}}

-
- - - -
@@ -59,18 +77,6 @@
- diff --git a/src/interface/templates/search.html b/src/interface/templates/search.html index 2ca7c70..821e7f7 100755 --- a/src/interface/templates/search.html +++ b/src/interface/templates/search.html @@ -16,48 +16,44 @@
-
-
-

pyShelf {{Version}}

-
-
-

"An elegant tool... for a more civilized age."

-
-
- - - - - Fork - -Issue - -
- - - - -
+
@@ -73,17 +69,6 @@
- diff --git a/src/interface/views.py b/src/interface/views.py index 590bb39..5c922e8 100755 --- a/src/interface/views.py +++ b/src/interface/views.py @@ -9,7 +9,7 @@ from django.http import JsonResponse from django.shortcuts import HttpResponse, render # render_to_response from django.utils.text import slugify -from .models import Books, Collections +from .models import Books, Collections, Navigation config = Config(Path("../")) @@ -26,7 +26,8 @@ def index(request): "Books": book_set(20, _set), "Set": str(_set), "Version": config.VERSION, - "LeftNav": menu("collections"), + "LeftNavCollections": menu("collections"), + "LeftNavMenu0": menu("nav_l_0"), }, ) @@ -190,7 +191,21 @@ def hr_name(book): return "{0}{1}".format(slugify(book.title), os.path.splitext(book.file_name)[1]) -def menu(which, _set=1): +def format_list(list_in): + formated_list, formated_list_key, x = [], [], 0 + for i in list_in: + if i.id not in formated_list_key: + if x % 2 == 0: + c = 0 + else: + c = 1 + if x <= 10: + x += 1 + else: + x = 0 + + +def menu(which, _set=1, parent=None): if which == "collections": collection_list = Collections.objects.all() collections, collection_key, x = [], [], 0 @@ -217,3 +232,7 @@ def menu(which, _set=1): ) collection_key.append(i.collection) return collections + elif which == "nav_lvl_0": + navigation_list = Navigation.objects.all() + breakpoint() + return navigation_list