Compare commits
No commits in common. "7c1cd322ed8e8e55ca8a1e9ad9ea25d9945dc184" and "c549745ef6e91ced130c6982c9514e4acbe73bee" have entirely different histories.
7c1cd322ed
...
c549745ef6
|
@ -1,13 +1,6 @@
|
||||||
Changelog
|
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
|
0.6
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -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_role('admins', _('Users with access to everithing inside control panel.'))
|
||||||
|
|
||||||
site.register_urls('', 'gas.gas.core.urls')
|
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',),
|
||||||
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django.views.generic import TemplateView
|
||||||
from gas.views import GASMixin
|
from gas.views import GASMixin
|
||||||
|
|
||||||
|
|
||||||
class GASLoginView(GASMixin, LoginView):
|
class GASLoginView(LoginView):
|
||||||
template_name = "gas/login.html"
|
template_name = "gas/login.html"
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
|
|
|
@ -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',),
|
|
||||||
)
|
|
|
@ -82,7 +82,7 @@ msgstr "Crear"
|
||||||
|
|
||||||
#: gas/users/views.py:55
|
#: gas/users/views.py:55
|
||||||
msgid "Update user"
|
msgid "Update user"
|
||||||
msgstr "Actualizar usuario"
|
msgstr "Actulizar usuario"
|
||||||
|
|
||||||
#: gas/users/views.py:56
|
#: gas/users/views.py:56
|
||||||
msgid "User updated"
|
msgid "User updated"
|
||||||
|
|
|
@ -77,8 +77,8 @@ class GASSite(object):
|
||||||
@property
|
@property
|
||||||
def role_choices(self):
|
def role_choices(self):
|
||||||
return [
|
return [
|
||||||
(role, f"{role}: {description}")
|
(role, role)
|
||||||
for role, description in self._registry['roles'].items()
|
for role in self._registry['roles']
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_role_description(self, role):
|
def get_role_description(self, role):
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
--info: #99f;
|
--info: #99f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#logo {
|
|
||||||
width: 100px;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
|
@ -79,6 +74,11 @@ a, a:visited {
|
||||||
content: '';
|
content: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#logo {
|
||||||
|
width: 100px;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
flex: 4;
|
flex: 4;
|
||||||
}
|
}
|
||||||
|
@ -97,18 +97,6 @@ a, a:visited {
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar ul ul {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar ul li.dropdown {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar ul li.dropdown.open > ul {
|
|
||||||
display:block;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.actions {
|
ul.actions {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
var GAS = {
|
var GAS = {
|
||||||
config: {
|
|
||||||
'menuItemSelector': '.dropdown',
|
|
||||||
'openedMenuItemClass': 'open',
|
|
||||||
},
|
|
||||||
init: function() {
|
init: function() {
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('.select2').select2({
|
$('.select2').select2({
|
||||||
|
@ -14,10 +10,6 @@ var GAS = {
|
||||||
let $message = $(this).parents('.message');
|
let $message = $(this).parents('.message');
|
||||||
$message.remove();
|
$message.remove();
|
||||||
});
|
});
|
||||||
GAS.toggle(
|
|
||||||
GAS.config.menuItemSelector,
|
|
||||||
GAS.config.openedMenuItemClass,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var csrftoken = GAS.getCookie('csrftoken');
|
var csrftoken = GAS.getCookie('csrftoken');
|
||||||
|
@ -75,19 +67,6 @@ var GAS = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cookieValue;
|
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,11 +80,7 @@
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
{% for target_url, icon, label in actions %}
|
{% for target_url, icon, label in actions %}
|
||||||
{% if icon %}
|
{% if icon %}
|
||||||
{% if icon|slice:":2" == "fa" %}
|
<li><a href="{{ target_url }}"><i class="fas {{ icon }}" title="{{ label }}"></i></a></li>
|
||||||
<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 %}
|
{% else %}
|
||||||
<li><a href="{{ target_url }}">{{ label }}</a></li>
|
<li><a href="{{ target_url }}">{{ label }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>{{ gas_title }} {% trans "Login" %}</title>
|
<title>{{ gas_title }} {% trans "Login" %}</title>
|
||||||
{% for cssfile in css %}
|
<link href="{% static "gas/css/gas.css" %}" rel="stylesheet" type="text/css" />
|
||||||
<link href="{% static cssfile %}" rel="stylesheet" type="text/css" />
|
|
||||||
{% endfor %}
|
|
||||||
</head>
|
</head>
|
||||||
<body id="login">
|
<body id="login">
|
||||||
<form action="." method="POST">{% csrf_token %}
|
<form action="." method="POST">{% csrf_token %}
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
{% load i18n %}
|
|
||||||
{% load gas_tags %}
|
{% 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 %}
|
{% for entry in menu %}
|
||||||
{% with children=entry|get_children:user_roles %}
|
<li>
|
||||||
<li class="nav-item{% if children %} dropdown{% endif %}{% if entry.icon %} icon-{{ entry.icon }}{% endif %}">
|
|
||||||
{% if entry.url %}
|
{% if entry.url %}
|
||||||
<a href="{% url entry.url %}">{{ entry.label }}</a>
|
<a href="{% url entry.url %}">{{ entry.label }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ entry.label }}
|
{{ entry.label }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% with children=entry|get_children:user_roles %}
|
||||||
{% if children %}
|
{% if children %}
|
||||||
<ul>
|
<ul>
|
||||||
{% include "gas/tags/navigation.html" with menu=children is_submenu=True %}
|
{% include "gas/tags/navigation.html" with menu=children %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
</li>
|
</li>
|
||||||
{% endwith %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -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
|
Edit this `config.py` file to register your code into `gas`. For examples look
|
||||||
at `gas.gas.config` and `gas.gas.users` modules.
|
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
|
Licenses
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = django-gas
|
name = django-gas
|
||||||
version = 0.7
|
version = 0.6
|
||||||
description = An alternative to django admin
|
description = An alternative to django admin
|
||||||
long_description = file: readme.md, changelog.md
|
long_description = file: readme.md, changelog.md
|
||||||
long_description_content_type = text/markdown
|
long_description_content_type = text/markdown
|
||||||
|
|
Loading…
Reference in New Issue