Improvements on admin theming
This commit is contained in:
parent
b26982929d
commit
0f9e798dee
8
TODO.md
8
TODO.md
|
@ -2,7 +2,6 @@ TODO
|
|||
====
|
||||
|
||||
* scape strings before executing scripts in order to prevent exploits: django templates automatically scapes things. Most important is to ensuer that all escape ' to "
|
||||
* Optimize SSH: pool, `UseDNS no`
|
||||
* Don't store passwords and other service parameters that can be changed by the services i.e. mailman, vps etc. Find an execution mechanism that trigger `change_password()`
|
||||
|
||||
* abort transaction on orchestration when `state == TIMEOUT` ?
|
||||
|
@ -119,7 +118,6 @@ Remember that, as always with QuerySets, any subsequent chained methods which im
|
|||
|
||||
* delete main user -> delete account or prevent delete main user
|
||||
|
||||
* https://blog.flameeyes.eu/2011/01/mostly-unknown-openssh-tricks
|
||||
* Ansible orchestration *method* (methods.py)
|
||||
* pip upgrade or install
|
||||
* multiple domains creation; line separated domains
|
||||
|
@ -151,4 +149,8 @@ textwrap.dedent( \\)
|
|||
* accounts
|
||||
* short name / long name
|
||||
* contact inlines
|
||||
* autocreate stuff (email/<account>.orchestra.lan)
|
||||
* autocreate stuff (email/<account>.orchestra.lan/plans)
|
||||
* account username should be domain freiendly withot lines
|
||||
|
||||
|
||||
* parmiko write to a channel instead of transfering files? http://sysadmin.circularvale.com/programming/paramiko-channel-hangs/
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 168 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
@ -1,8 +1,11 @@
|
|||
from admin_tools.menu import items, Menu
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.text import capfirst
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from orchestra import get_version, settings
|
||||
from orchestra.core import services, accounts
|
||||
from orchestra.utils.apps import isinstalled
|
||||
|
||||
|
@ -103,17 +106,26 @@ def get_administration_items():
|
|||
return childrens
|
||||
|
||||
|
||||
|
||||
class OrchestraMenu(Menu):
|
||||
template = 'admin/orchestra/menu.html'
|
||||
|
||||
def init_with_context(self, context):
|
||||
self.children += [
|
||||
items.MenuItem(
|
||||
_('Dashboard'),
|
||||
reverse('admin:index')
|
||||
),
|
||||
items.Bookmarks(),
|
||||
self.children = [
|
||||
# items.MenuItem(
|
||||
# mark_safe('{site_name} <span style="{version_style}">v{version}</span>'.format(
|
||||
# site_name=force_text(settings.SITE_VERBOSE_NAME),
|
||||
# version_style="text-transform:none; float:none; font-size:smaller; background:none;",
|
||||
# version=get_version())),
|
||||
# reverse('admin:index')
|
||||
# ),
|
||||
# items.MenuItem(
|
||||
# _('Dashboard'),
|
||||
# reverse('admin:index')
|
||||
# ),
|
||||
# items.Bookmarks(),
|
||||
items.MenuItem(
|
||||
_("Services"),
|
||||
reverse('admin:index'),
|
||||
children=get_services()
|
||||
),
|
||||
items.MenuItem(
|
||||
|
@ -125,5 +137,5 @@ class OrchestraMenu(Menu):
|
|||
_("Administration"),
|
||||
children=get_administration_items()
|
||||
),
|
||||
items.MenuItem("API", api_link(context))
|
||||
items.MenuItem("API", api_link(context)),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* theming styles
|
||||
*
|
||||
*/
|
||||
**/
|
||||
|
||||
#header {
|
||||
background: url(../images/admin-tools.png) 0 0 repeat-x;
|
||||
|
|
|
@ -5,7 +5,7 @@ body {
|
|||
|
||||
#header #branding h1 {
|
||||
margin: 0;
|
||||
padding: 2px 10px;
|
||||
padding: 2px 15px;
|
||||
background: transparent url(/static/orchestra/images/orchestra-logo.png) 10px 2px no-repeat;
|
||||
text-indent: 0;
|
||||
height: 31px;
|
||||
|
@ -13,6 +13,7 @@ body {
|
|||
/* font-weight: bold;*/
|
||||
padding-left: 50px;
|
||||
line-height: 30px;
|
||||
border-right: 1px solid #ededed;
|
||||
}
|
||||
|
||||
#branding h1, #branding h1 a:link, #branding h1 a:visited {
|
||||
|
@ -35,3 +36,49 @@ body {
|
|||
color: #9B9B9B;
|
||||
}
|
||||
|
||||
|
||||
#header ul#navigation-menu li.first a {
|
||||
outline: none;
|
||||
background: none;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
#header-breadcrumb {
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
margin-top: 35px;
|
||||
height: 69px;
|
||||
position: absolute;
|
||||
background-attachment: scroll; background-clip: border-box;
|
||||
background-color: rgb(255, 255, 255);
|
||||
background-image: url(/static/admin/img/nav-bg-reverse.gif);
|
||||
background-origin: padding-box;
|
||||
background-position: 0px -8px;
|
||||
background-size: auto;
|
||||
border-bottom-color: rgb(237, 237, 237);
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-left-color: rgb(153, 153, 153);
|
||||
border-left-style: none;
|
||||
border-left-width: 0px;
|
||||
border-right-color: rgb(153, 153, 153);
|
||||
border-right-style: none;
|
||||
border-right-width: 0px;
|
||||
border-top-color: rgb(153, 153, 153);
|
||||
border-top-style: none;
|
||||
border-top-width: 0px;
|
||||
color: white;
|
||||
height: 13px;
|
||||
padding-bottom: 10px;
|
||||
padding-top: 10px;
|
||||
background-repeat: repeat-x;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
div.breadcrumbs {
|
||||
max-width: 1150px;
|
||||
margin: auto;
|
||||
}
|
||||
|
|
|
@ -41,43 +41,17 @@
|
|||
<div id="branding">
|
||||
{% block branding %}{% endblock %}
|
||||
</div>
|
||||
{% if user.is_active and user.is_staff %}
|
||||
<div id="user-tools">
|
||||
{% trans 'Welcome,' %}
|
||||
{% url 'admin:users_user_change' user.pk as user_change_url %}
|
||||
<a href="{{ user_change_url }}"><strong>{% filter force_escape %}{% firstof user.get_short_name user.username %}{% endfilter %}</strong></a>.
|
||||
{% block userlinks %}
|
||||
{% url 'django-admindocs-docroot' as docsroot %}
|
||||
{% if docsroot %}
|
||||
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
|
||||
{% endif %}
|
||||
{% url 'admin:password_change' as password_change_url %}
|
||||
{% if password_change_url %}
|
||||
<a href="{{ password_change_url }}">
|
||||
{% else %}
|
||||
<a href="{{ root_path }}password_change/">
|
||||
{% endif %}
|
||||
{% trans 'Change password' %}</a> /
|
||||
{% url 'admin:logout' as logout_url %}
|
||||
{% if logout_url %}
|
||||
<a href="{{ logout_url }}">
|
||||
{% else %}
|
||||
<a href="{{ root_path }}logout/">
|
||||
{% endif %}
|
||||
{% trans 'Log out' %}</a>
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block nav-global %}{% endblock %}
|
||||
</div></div>
|
||||
<!-- END Header -->
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a>{% if title %} › {{ title }}{% endif %}</div>{% endblock %}
|
||||
<div class="outer-breadcrumbs">{% block breadcrumbs %}<div class="breadcrumbs"><a href="{{ root_path }}">{% trans 'Home' %}</a>{% if title %} › {{ title }}{% endif %}</div>{% endblock %}</div>
|
||||
{% endif %}
|
||||
|
||||
{% block messages %}
|
||||
{% if messages %}
|
||||
<ul class="messagelist" >{% for message in messages %}
|
||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
||||
<div style="background: {% if message.tags == 'warning' %}#ffc{% else %}#dfd{% endif %} 5px .3em no-repeat;border-bottom: 1px solid #ddd;">
|
||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %} style="max-width:1130px;margin:auto;margin-bottom:-1px;">{{ message }}</li></div>
|
||||
{% endfor %}</ul>
|
||||
{% endif %}
|
||||
{% endblock messages %}
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block branding %}
|
||||
<a href="{% url 'admin:index' %}"><h1 id="site-name">{{ SITE_VERBOSE_NAME }} <span class="version">{% version %}</span></a>
|
||||
<!--<a href="{% url 'admin:index' %}"><h1 id="site-name">{{ SITE_VERBOSE_NAME }} <span class="version">{% version %}</span></a>-->
|
||||
{% endblock %}
|
||||
|
||||
{% block nav-global %}
|
||||
{% if user.is_active and user.is_staff %}
|
||||
{% if not is_popup %}
|
||||
|
|
|
@ -7,11 +7,8 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block title %}{{ SITE_VERBOSE_NAME }}{% endblock %}
|
||||
|
||||
{% block breadcrumb-stetic %}{% endblock %}
|
||||
{% block bodyclass %}dashboard{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}{% endblock %}
|
||||
{% block content_title %}{% endblock %}
|
||||
{% block content %}
|
||||
{% admin_tools_render_dashboard %}
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
|
||||
{% block breadcrumbs %}{% endblock %}
|
||||
|
||||
{% block branding %}
|
||||
<h1 id="site-name">{{ SITE_VERBOSE_NAME }} <span class="version">{% version %}</span>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
|
||||
<p class="errornote">
|
||||
|
@ -30,7 +34,6 @@
|
|||
</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<div id="content-main">
|
||||
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
|
||||
<div class="form-row">
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
{% load i18n admin_tools_menu_tags %}
|
||||
{% if menu.children %}
|
||||
<script type="text/javascript" src="{{ media_url }}/admin_tools/js/utils.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
// Load js files syncronously and conditionally
|
||||
var js_files = [
|
||||
{
|
||||
src : '{{ media_url }}/admin_tools/js/jquery/jquery.min.js',
|
||||
test: function() { return typeof(jQuery) == 'undefined'; }
|
||||
},
|
||||
{
|
||||
src : '{{ media_url }}/admin_tools/js/json.min.js',
|
||||
test: function() { return typeof(JSON.stringify) == 'undefined'; }
|
||||
},
|
||||
{
|
||||
src : '{{ media_url }}/admin_tools/js/menu.js',
|
||||
test: function() { return true; }
|
||||
}{% for js in menu.Media.js %},
|
||||
{
|
||||
src : '{{ media_url }}/{{ js }}',
|
||||
test: function() { return true; }
|
||||
}{% endfor %}
|
||||
];
|
||||
|
||||
loadScripts(js_files, function(){
|
||||
jQuery(function($) {
|
||||
{% if has_bookmark_item %}
|
||||
process_bookmarks(
|
||||
"{{ request.get_full_path }}",
|
||||
"{{ title }}",
|
||||
"{% trans 'Please enter a name for the bookmark' %}"
|
||||
);
|
||||
{% endif %}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
{% if has_bookmark_item %}
|
||||
|
||||
{% if bookmark %}
|
||||
{% include "admin_tools/menu/remove_bookmark_form.html" %}
|
||||
{% else %}
|
||||
{% include "admin_tools/menu/add_bookmark_form.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
<ul id="navigation-menu">
|
||||
<div style="max-width: 1170px; margin:auto;">
|
||||
<div id="branding"><a href="/admin/"></a><h1 id="site-name"><a href="/admin/">Pangea Hosting Management <span class="version">0.0.1a1</span></a></h1></div>
|
||||
{% for item in menu.children %}{% admin_tools_render_menu_item item forloop.counter %}{% endfor %}
|
||||
<span style="float:right;color:grey;padding:10px;font-size:11px;">{% trans 'Welcome' %},
|
||||
{% url 'admin:users_user_change' user.pk as user_change_url %}
|
||||
<a href="{{ user_change_url }}" style="color:#555;"><strong>{% filter force_escape %}{% firstof user.get_short_name user.username %}{% endfilter %}</strong></a>.
|
||||
<a href="{% url 'admin:password_change' %}" style="color:#555;">Change password</a> / <a href="{% url 'admin:logout' %}" style="color:#555;">Log out</a></span>
|
||||
</div>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue