Compare commits

..

No commits in common. "7c1cd322ed8e8e55ca8a1e9ad9ea25d9945dc184" and "c549745ef6e91ced130c6982c9514e4acbe73bee" have entirely different histories.

13 changed files with 26 additions and 89 deletions

View File

@ -1,13 +1,6 @@
Changelog
=========
0.7
---
* Enhance sidebar menu
* Use all css files on login template
* Make user admin section optional
* Show role description in user edit form
0.6
---

View File

@ -7,3 +7,12 @@ site.register_role('staff', _('Users with access to gas control panel.'))
site.register_role('admins', _('Users with access to everithing inside control panel.'))
site.register_urls('', 'gas.gas.core.urls')
site.register_urls('users', 'gas.gas.users.urls')
site.register_menu(
name='users',
label=_("Users"),
icon="",
url="gas:user_list",
roles=('admins',),
)

View File

@ -7,7 +7,7 @@ from django.views.generic import TemplateView
from gas.views import GASMixin
class GASLoginView(GASMixin, LoginView):
class GASLoginView(LoginView):
template_name = "gas/login.html"
def get_success_url(self):

View File

@ -1,13 +0,0 @@
from django.utils.translation import gettext_lazy as _
from gas.sites import site
site.register_urls('users', 'gas.gas.users.urls')
site.register_menu(
name='users',
label=_("Users"),
icon="",
url="gas:user_list",
roles=('admins',),
)

View File

@ -82,7 +82,7 @@ msgstr "Crear"
#: gas/users/views.py:55
msgid "Update user"
msgstr "Actualizar usuario"
msgstr "Actulizar usuario"
#: gas/users/views.py:56
msgid "User updated"

View File

@ -77,8 +77,8 @@ class GASSite(object):
@property
def role_choices(self):
return [
(role, f"{role}: {description}")
for role, description in self._registry['roles'].items()
(role, role)
for role in self._registry['roles']
]
def get_role_description(self, role):

View File

@ -7,11 +7,6 @@
--info: #99f;
}
#logo {
width: 100px;
height: auto;
}
table {
border-collapse: collapse;
border: 1px solid gray;
@ -79,6 +74,11 @@ a, a:visited {
content: '';
}
#logo {
width: 100px;
height: auto;
}
#content {
flex: 4;
}
@ -97,18 +97,6 @@ a, a:visited {
background-color: #fafafa;
}
#sidebar ul ul {
display: none;
}
#sidebar ul li.dropdown {
cursor: pointer;
}
#sidebar ul li.dropdown.open > ul {
display:block;
}
ul.actions {
list-style-type: none;
padding: 0;

View File

@ -1,8 +1,4 @@
var GAS = {
config: {
'menuItemSelector': '.dropdown',
'openedMenuItemClass': 'open',
},
init: function() {
$(document).ready(function(){
$('.select2').select2({
@ -14,10 +10,6 @@ var GAS = {
let $message = $(this).parents('.message');
$message.remove();
});
GAS.toggle(
GAS.config.menuItemSelector,
GAS.config.openedMenuItemClass,
);
});
var csrftoken = GAS.getCookie('csrftoken');
@ -75,19 +67,6 @@ var GAS = {
}
}
return cookieValue;
},
toggle: function(selector, cssclass) {
const items = document.querySelectorAll(selector);
for (const item of items) {
item.addEventListener('click', function(ev) {
if (item.classList.contains(cssclass)) {
item.classList.remove(cssclass);
} else {
item.classList.add(cssclass);
}
});
}
}
}

View File

@ -80,11 +80,7 @@
<ul class="actions">
{% for target_url, icon, label in actions %}
{% if icon %}
{% if icon|slice:":2" == "fa" %}
<li><a href="{{ target_url }}"><i class="fas {{ icon }}" title="{{ label }}"></i></a></li>
{% else %}
<li><a href="{{ target_url }}" class="{{ icon }}">{{ label }}</a></li>
{% endif %}
{% else %}
<li><a href="{{ target_url }}">{{ label }}</a></li>
{% endif %}

View File

@ -4,9 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>{{ gas_title }} {% trans "Login" %}</title>
{% for cssfile in css %}
<link href="{% static cssfile %}" rel="stylesheet" type="text/css" />
{% endfor %}
<link href="{% static "gas/css/gas.css" %}" rel="stylesheet" type="text/css" />
</head>
<body id="login">
<form action="." method="POST">{% csrf_token %}

View File

@ -1,23 +1,18 @@
{% load i18n %}
{% load gas_tags %}
{% if not is_submenu %}
<li class="nav-item">
<a class="nav-link" href="{% url "gas:index" %}">{% trans "Home" %}</a>
</li>
{% endif %}
{% for entry in menu %}
{% with children=entry|get_children:user_roles %}
<li class="nav-item{% if children %} dropdown{% endif %}{% if entry.icon %} icon-{{ entry.icon }}{% endif %}">
<li>
{% if entry.url %}
<a href="{% url entry.url %}">{{ entry.label }}</a>
{% else %}
{{ entry.label }}
{% endif %}
{% with children=entry|get_children:user_roles %}
{% if children %}
<ul>
{% include "gas/tags/navigation.html" with menu=children is_submenu=True %}
{% include "gas/tags/navigation.html" with menu=children %}
</ul>
{% endif %}
</li>
{% endwith %}
</li>
{% endfor %}

View File

@ -56,14 +56,6 @@ Create a submodule `gas.config` in your django app.
Edit this `config.py` file to register your code into `gas`. For examples look
at `gas.gas.config` and `gas.gas.users` modules.
Gas comes with a basic user management. To enable this section, import
`gas.gas.users_config` from any `gas.config` of your installed apps.
To enable the urls but keep the section out of the menu, just add this to
your `gas.config`:
site.register_urls('users', 'gas.gas.users.urls')
Licenses
--------

View File

@ -1,6 +1,6 @@
[metadata]
name = django-gas
version = 0.7
version = 0.6
description = An alternative to django admin
long_description = file: readme.md, changelog.md
long_description_content_type = text/markdown