Skip to content

Commit

Permalink
use all app declared homepage stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Archmonger committed Oct 3, 2022
1 parent a3d526d commit 9d5793a
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 20 deletions.
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Conreq Core

[![Discord](https://img.shields.io/discord/440067432552595457?style=flat-square&label=Discord&logo=discord)](https://discord.gg/gQhGZzEjmX)
[![GitHub Discussions](https://img.shields.io/badge/-View-purple?style=flat-square&label=GitHub%20Discussions&logo=github)](https://github.com/Archmonger/Conreq/discussions)
[![Reddit](https://img.shields.io/badge/-View-red?style=flat-square&label=Reddit&logo=reddit)](https://www.reddit.com/r/conreq)
[![Discord](https://img.shields.io/discord/440067432552595457?style=flat-square&label=Discord&logo=discord)](https://discord.gg/gQhGZzEjmX) [![GitHub Discussions](https://img.shields.io/badge/-View-purple?style=flat-square&label=GitHub%20Discussions&logo=github)](https://github.com/Archmonger/Conreq/discussions) [![Reddit](https://img.shields.io/badge/-View-red?style=flat-square&label=Reddit&logo=reddit)](https://www.reddit.com/r/conreq) [![Selfhosters Docker Pulls](https://img.shields.io/docker/pulls/roxedus/conreq?style=flat-square)](https://hub.docker.com/r/roxedus/conreq) [![Selfhosters Docker Stars](https://img.shields.io/docker/stars/roxedus/conreq?style=flat-square)](https://hub.docker.com/r/roxedus/conreq)

Conreq bundles together the best open source technologies to create a web development platform. Key features include a full-stack framework (ReactJS in Python), deployment ready web server, database ORM, and background task queue. Creations made by developers can be shared with others through our app store.

Expand Down Expand Up @@ -32,7 +30,7 @@ Or, check out the **[documentation](https://archmonger.github.io/Conreq/)** for
- [High Performance Caching](https://github.com/grantjenks/python-diskcache)
- [Automatic CSS/JS File Compression](https://github.com/django-compressor/django-compressor)
- [Automatic HTTP Compression](https://github.com/friedelwolff/django-compression-middleware)
- [Automatic Cache Busting](https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage)
- [Automatic Cache Busting](https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.ManifestStaticFilesStorage)
- [Automatic Code Performance Graphs](https://github.com/jazzband/django-silk)
- [Automatic API Docs Generation](https://github.com/tfranzel/drf-spectacular)
- [Automatic SQLite Database Optimization](https://www.sqlite.org/lang_vacuum.html)
Expand All @@ -58,10 +56,3 @@ Install through **[Unraid Community Applications](https://squidly271.github.io/f
See our docs for information on our **[environment variables](https://archmonger.github.io/Conreq/configure/env_vars/)**.

Since Conreq is pure python, it can be **[manually run](https://archmonger.github.io/Conreq/develop/run_conreq/)** on any operating system.

## Docker Stats

| Hotio Docker | Selfhosters Docker |
| ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [![Hotio Docker Pulls](https://img.shields.io/docker/pulls/hotio/conreq?style=flat-square)](https://hub.docker.com/r/hotio/conreq) | [![Selfhosters Docker Pulls](https://img.shields.io/docker/pulls/roxedus/conreq?style=flat-square)](https://hub.docker.com/r/roxedus/conreq) |
| [![Hotio Docker Stars](https://img.shields.io/docker/stars/hotio/conreq?style=flat-square)](https://hub.docker.com/r/hotio/conreq) | [![Selfhosters Docker Stars](https://img.shields.io/docker/stars/roxedus/conreq?style=flat-square)](https://hub.docker.com/r/roxedus/conreq) |
25 changes: 25 additions & 0 deletions conreq/_core/home/templates/conreq/home_head.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,38 @@
<link rel="stylesheet" href="{% static 'conreq/backdrop.css' %}">
<link rel="stylesheet" href="{% static 'conreq/scrollbar.css' %}">
<link rel="stylesheet" href="{% static 'conreq/buttons.css' %}">

{% for stylesheet in home_config.local_stylesheets %}
<link rel="stylesheet" href="{% static stylesheet.path %}">
{% endfor %}

{% endcompress %}

<!-- Local JS -->
{% compress js %}
<script src="{% static 'conreq/iframe_events.js' %}"></script>

{% for script in home_config.local_scripts %}
<script src="{% static script.path %}"></script>
{% endfor %}

{% endcompress %}

<!-- Remote CSS -->
{% for stylesheet in home_config.remote_stylesheets %}
<link rel="stylesheet" href="{{ stylesheet.path }}">
{% endfor %}

<!-- Remote JS -->
{% for script in home_config.remote_scripts %}
<script src="{{ script.path }}"></script>
{% endfor %}

<!-- App defined head content -->
{% for template in home_config.head_content %}
{% include template.path %}
{% endfor %}

<!-- User Configured Values -->
<script>
document.documentElement.style.setProperty("--accent-color", "{{ StylingSettings.accent_color }}");
Expand Down
4 changes: 3 additions & 1 deletion conreq/_core/home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
def home(request):
"""Renders the homepage."""
# Render the home page
return initialize(request) or login_required(render)(request, config.templates.home)
return initialize(request) or login_required(render)(
request, config.templates.home, {"home_config": config.homepage}
)
6 changes: 4 additions & 2 deletions conreq/app/register/homepage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Callable

from idom.core.component import Component

from conreq import config
from conreq.types import (
CSS,
Expand Down Expand Up @@ -27,12 +29,12 @@ def sidebar_tab(
# TODO: Implement auth level
# TODO: URL support (Requires IDOM to support URL routing)

def decorator(component):
def decorator(component: Component):
if group not in config.homepage.sidebar_tabs:
config.homepage.sidebar_tabs.append(group)

for nav_group in config.homepage.sidebar_tabs:
if group.name == nav_group:
if group == nav_group:
group.tabs.add(
SidebarTab(
name=name,
Expand Down
2 changes: 2 additions & 0 deletions conreq/templates/app/app_name/homepage.py-tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from conreq.app.register import homepage
from conreq.types import CSS, SCSS, HTMLTemplate, JavaScript, NavGroup
Empty file.
Empty file.
12 changes: 6 additions & 6 deletions conreq/types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any, Callable

from idom.core.component import Component
from idom.core.types import VdomDict
from sortedcontainers import SortedSet

Expand Down Expand Up @@ -31,12 +31,10 @@ class AuthLevel:

@dataclass
class Viewport:
component: Callable
component: Component
html_class: str = ""
padding: bool = True
page_title: str | None = None
expires: bool = True
timestamp: datetime = field(default_factory=datetime.now)
background: str | None = None # TODO: Implement this


Expand All @@ -54,7 +52,7 @@ def __eq__(self, __o: object) -> bool:
@dataclass(order=True)
class SubTab:
name: str
component: Callable
component: Component
html_class: str = ""
padding: bool = True
on_click: Callable | None = None
Expand All @@ -77,7 +75,7 @@ def __eq__(self, __o: object) -> bool:
@dataclass
class FileLink:
path: str
attributes: dict | None = None
attributes: dict[str, str | int] | None = None
local: bool = True


Expand All @@ -89,11 +87,13 @@ class JavaScript(FileLink):
...


@dataclass
class SCSS:
path: str
attributes: dict | None = None


@dataclass
class HTMLTemplate:
path: str

Expand Down

0 comments on commit 9d5793a

Please sign in to comment.