Skip to content

Commit

Permalink
Merge pull request #7 from nossas/feature/structure-plugins
Browse files Browse the repository at this point in the history
Melhorias no editor de páginas
  • Loading branch information
igr-santos authored Jun 27, 2023
2 parents 2415966 + 0556ba1 commit f9dbe8f
Show file tree
Hide file tree
Showing 229 changed files with 5,772 additions and 503 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ WORKDIR /app/tailwind

RUN npm i

RUN npx tailwindcss -i ./static/css/input.css -o ./static/dist/css/output.css
RUN npm run page:build

RUN npm run admin:build

# Use an official Python runtime based on Debian 10 "buster" as a parent image.
FROM python:slim-buster
Expand Down Expand Up @@ -51,7 +52,7 @@ WORKDIR /app
# Copy the source code of the project into the container.
COPY --from=node-builder /app ./

RUN python manage.py collectstatic --noinput --clear
RUN python manage.py collectstatic --noinput --clear -i tailwindcss

# Runtime command that executes when "docker run" is called.
CMD ["uwsgi", "--ini", "/app/deploy/wsgi.ini"]
43 changes: 11 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Executando o server de desenvolvimento:

Executando o build dos estilos CSS (necessário executar dentro da pasta **tailwind**):

`npx tailwindcss -i ./static/css/input.css -o ./static/dist/css/output.css --watch`
`npm run watch`


### Configurações
Expand All @@ -106,41 +106,20 @@ CMS_DATABASE_URL=
BONDE_DATABASE_URL=
```

<!-- Como publicar vários sites?
Como iniciar servidor de desenvolvimento:

1. Carregar a configuração do site no Django a partir do host
Importante entender que a marca e o dominio são algo extremamente forte.
Rede Nossas Cidades: nossas.org.br
Meu Rio: meurio.org.br
Minha Manaus: minhamanaus.org.br
Cada campanha seria acessada inicialmente através de subpaths.
Essa conta eu não pago: minhamanaus.org.br/essacontaeunaopago
Respeita Paquetá: meurio.org.br/respeitapaqueta
Amazônia contra COVID: nossas.org.br/amazoniacontracovid
2. Publicar em produção:
Exige a configuração dos Sites antecipadamente (Comando, configurar sites buscar sites do Bonde)
Base de dados compartilhada
```
python manage.py shell
from django.contrib.sites.models import Site
Dúvidas (É outra camada):
site = Site.objects.first()
Como manter no mesmo dominio 2 aplicações (Bonde e Novo CMS)
Caso seja negativa, como migrar campanhas já existentes no Bonde
site.domain = "127.0.0.1:8000"
subdominios continuam pro Bonde
enquanto o dominio principal, precisaria ser migrado pro CMS
ou
site.domain = "localhost:8000"
Remove ideia google autenticate
Criptografar com a mesma chave o password -->
site.save()
```
File renamed without changes.
6 changes: 6 additions & 0 deletions admin_styled/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class AdminStyledConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'admin_styled'
7 changes: 7 additions & 0 deletions admin_styled/static/admin_styled/css/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:root[data-color-scheme=light] {
--dca-primary: black;
}

.cms-pagetree-header-search .cms-pagetree-header-search-btn:hover {
background-color: var(--dca-primary) !important;
}
8 changes: 8 additions & 0 deletions admin_styled/static/admin_styled/tailwindcss/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import "tailwindcss/base";

@import "tailwindcss/components";
@import "./base.css";
@import "./app.css";
@import "./cms.css";

@import "tailwindcss/utilities";
82 changes: 82 additions & 0 deletions admin_styled/static/admin_styled/tailwindcss/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* Estilos para todos os componentes dentro de app-app-styled-admin */

.app-styled-admin #container {
@apply bg-white;
}

.app-styled-admin #header .toolbar-item-navigation li ul {
@apply bg-white;
}

.app-styled-admin .delete-confirm h3 {
@apply text-4xl font-bold font-sans;
}

.app-styled-admin .delete-confirm h3,
.app-styled-admin .delete-confirm p {
@apply text-neutral-900 my-4;
}

.app-styled-admin .delete-confirm-accordion {
@apply w-full overflow-hidden;
}
.app-styled-admin .delete-confirm-accordion-label {
@apply flex content-between items-center border-y-[1px] border-y-[#E0E0E0] border-solid p-4 font-bold cursor-pointer select-none text-neutral-900;
}

.app-styled-admin .delete-confirm-accordion-label svg {
@apply mr-2;
}
.app-styled-admin .delete-confirm-accordion-content {
@apply max-h-0 py-0 px-4 transition-all;
}

.app-styled-admin div.delete-confirm-accordion-content ul > li{
@apply border-0 !important;
}

.app-styled-admin .delete-confirm-accordion input {
@apply hidden;
}

.app-styled-admin input:checked + .delete-confirm-accordion-label svg {
@apply origin-center rotate-90;
}

.app-styled-admin input:checked ~ .delete-confirm-accordion-content {
@apply max-h-full;
}

.app-styled-admin .cms-pagetree.cms-pagetree-section {
@apply h-12;
}

.app-styled-admin .cms-pagetree a.addlink {
@apply mr-1;
}
.app-styled-admin ul.messagelist a,
.app-styled-admin ul.messagelist a:link {
@apply text-[#693];
}

.app-styled-admin ul.messagelist {
@apply right-0;
}

.app-styled-admin.login #header {
@apply pb-4 pt-6 !important;
}

.app-styled-admin .object-tools {
@apply bg-white;
}

.app-styled-admin .select-layout input:checked + div {
@apply text-black text-lg;
}

/* filerFile Modal */

span.filerFile.js-file-selector {
@apply flex justify-center;
}
7 changes: 7 additions & 0 deletions admin_styled/static/admin_styled/tailwindcss/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Estilos para todos os componentes dentro de app-styled-admin and cms-styled-admin */

.app-styled-admin a.header-logo,
.cms-styled-admin a.header-logo,
.cms-styled-admin .cms-reset a.header-logo:hover {
@apply flex items-center ml-6 mr-4;
}
9 changes: 9 additions & 0 deletions admin_styled/static/admin_styled/tailwindcss/cms.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Estilos para todos os componentes dentro de cms-styled-admin */

.cms-styled-admin .cms-toolbar-left {
@apply flex;
}

.cms-styled-admin div.cms .cms-modal-body {
@apply border-none top-12 !important;
}
105 changes: 105 additions & 0 deletions admin_styled/templates/admin/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{% load i18n static %}<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}" data-color-scheme="light">
<head>
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static "admin/css/base.css" %}{% endblock %}">
{% if not is_popup and is_nav_sidebar_enabled %}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/nav_sidebar.css" %}">
<script src="{% static 'admin/js/nav_sidebar.js' %}" defer></script>
{% endif %}
{% block extrastyle %}{% endblock %}
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}">{% endif %}
{% block extrahead %}{% endblock %}
{% block responsive %}
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive.css" %}">
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive_rtl.css" %}">{% endif %}
{% endblock %}
<link rel="stylesheet" type="text/css" href="{% static 'admin_styled/css/theme.css' %}" />
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE">{% endblock %}
</head>
{% load i18n %}

<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}"
data-admin-utc-offset="{% now "Z" %}">

<!-- Container -->
<div id="container">

{% if not is_popup %}
<!-- Header -->
<div id="header">
<div id="branding">
{% block branding %}{% endblock %}
</div>
{% block usertools %}
{% if has_permission %}
<div id="user-tools">
{% block welcome-msg %}
{% translate 'Welcome,' %}
<strong>{% firstof user.get_short_name user.get_username %}</strong>.
{% endblock %}
{% block userlinks %}
{% if site_url %}
<a href="{{ site_url }}">{% translate 'View site' %}</a> /
{% endif %}
{% if user.is_active and user.is_staff %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> /
{% endif %}
{% endif %}
{% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">{% translate 'Change password' %}</a> /
{% endif %}
<a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>
{% endblock %}
</div>
{% endif %}
{% endblock %}
{% block nav-global %}{% endblock %}
</div>
<!-- END Header -->
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
{% if title %} &rsaquo; {{ title }}{% endif %}
</div>
{% endblock %}
{% endif %}

<div class="main shifted" id="main">
{% if not is_popup and is_nav_sidebar_enabled %}
{% block nav-sidebar %}
{% include "admin/nav_sidebar.html" %}
{% endblock %}
{% endif %}
<div class="content">
{% block messages %}
{% if messages %}
<ul class="messagelist">{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message|capfirst }}</li>
{% endfor %}</ul>
{% endif %}
{% endblock messages %}
<!-- Content -->
<div id="content" class="{% block coltype %}colM{% endblock %}">
{% block pretitle %}{% endblock %}
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
{% block content_subtitle %}{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}{% endblock %}
{% block content %}
{% block object-tools %}{% endblock %}
{{ content }}
{% endblock %}
{% block sidebar %}{% endblock %}
<br class="clear">
</div>
<!-- END Content -->
{% block footer %}<div id="footer"></div>{% endblock %}
</div>
</div>
</div>
<!-- END Container -->
</body>
</html>
30 changes: 30 additions & 0 deletions admin_styled/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends "admin/base.html" %}
{% load i18n static admin_style_tags %}

{% block extrastyle %}
{{ block.super }}
{% include 'admin/inc/extrastyle.html' %}
{% endblock %}

{% block extrahead %}
{{ block.super }}
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="{% static 'djangocms_admin_style/css/djangocms-admin.css' %}" />
<!-- apply admin_styled inside admin app -->
<link rel="stylesheet" type="text/css" href="{% static 'dist/admin_styled/css/admin.css' %}" />
{% if request.user.is_superuser %}{% render_update_notification %}{% endif %}
<script src="{% static 'djangocms_admin_style/js/dist/bundle.adminstyle.min.js' %}"></script>
{% include 'admin/inc/extrahead.html' %}
{% endblock %}

{% block title %}{% include 'admin/inc/title.html' %}{% endblock %}

{% block bodyclass %}{{ block.super }} djangocms-admin-style app-styled-admin{% endblock %}

{% block branding %}
{% include 'admin_styled/items/branding.html' %}
{% endblock %}

{% block userlinks %}{% include 'admin/inc/userlinks.html' %}{{ block.super }}{% endblock %}

{% block nav-global %}{% endblock %}
8 changes: 8 additions & 0 deletions admin_styled/templates/admin/change_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_urls static admin_modify %}

{% block pretitle %}{% endblock %}
{% block content_title %}{% endblock %}
{% block content_subtitle %}{% endblock %}

{% block breadcrumbs %}{% endblock %}
Loading

0 comments on commit f9dbe8f

Please sign in to comment.