Updated management skin
authorThierry Florac <thierry.florac@onf.fr>
Tue, 11 Oct 2016 17:17:18 +0200
changeset 22 7d7f092df887
parent 21 4d8d6d0caecb
child 23 4fcf2e732272
Updated management skin
src/pyams_zmi/admin.py
src/pyams_zmi/form.py
src/pyams_zmi/interfaces/__init__.py
src/pyams_zmi/interfaces/templates/admin-layout.pt
src/pyams_zmi/templates/admin-index.pt
src/pyams_zmi/templates/admin.pt
--- a/src/pyams_zmi/admin.py	Mon Oct 10 15:27:43 2016 +0200
+++ b/src/pyams_zmi/admin.py	Tue Oct 11 17:17:18 2016 +0200
@@ -27,7 +27,7 @@
 from zope.interface import Interface
 
 
-@pagelet_config(name='admin.html', layer=IPyAMSLayer, context=Interface, permission=VIEW_SYSTEM_PERMISSION)
-@template_config(template='templates/admin.pt', layer=IAdminLayer)
+@pagelet_config(name='admin', context=Interface, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
+@template_config(template='templates/admin-index.pt', layer=IAdminLayer)
 class MainAdminPage(AdminView):
     """Main administration page"""
--- a/src/pyams_zmi/form.py	Mon Oct 10 15:27:43 2016 +0200
+++ b/src/pyams_zmi/form.py	Tue Oct 11 17:17:18 2016 +0200
@@ -23,37 +23,37 @@
 from pyams_zmi.view import AdminView
 
 
-class AdminAddForm(AdminView, AddForm):
+class AdminAddForm(AddForm, AdminView):
     """Admin add form"""
 
 
-class InnerAdminAddForm(AdminView, InnerAddForm):
+class InnerAdminAddForm(InnerAddForm, AdminView):
     """Inner admin add form"""
 
 
-class AdminDialogAddForm(AdminView, DialogAddForm):
+class AdminDialogAddForm(DialogAddForm, AdminView):
     """Admin dialog add form"""
 
 
-class AdminEditForm(AdminView, EditForm):
+class AdminEditForm(EditForm, AdminView):
     """Admin edit form"""
 
 
-class InnerAdminEditForm(AdminView, InnerEditForm):
+class InnerAdminEditForm(InnerEditForm, AdminView):
     """Inner admin edit form"""
 
 
-class AdminDialogEditForm(AdminView, DialogEditForm):
+class AdminDialogEditForm(DialogEditForm, AdminView):
     """Admin dialog edit form"""
 
 
-class AdminDisplayForm(AdminView, DisplayForm):
+class AdminDisplayForm(DisplayForm, AdminView):
     """Admin display form"""
 
 
-class InnerAdminDisplayForm(AdminView, InnerDisplayForm):
+class InnerAdminDisplayForm(InnerDisplayForm, AdminView):
     """Inner admin display form"""
 
 
-class AdminDialogDisplayForm(AdminView, DialogDisplayForm):
+class AdminDialogDisplayForm(DialogDisplayForm, AdminView):
     """Admin dialog display form"""
--- a/src/pyams_zmi/interfaces/__init__.py	Mon Oct 10 15:27:43 2016 +0200
+++ b/src/pyams_zmi/interfaces/__init__.py	Tue Oct 11 17:17:18 2016 +0200
@@ -16,10 +16,13 @@
 # import standard library
 
 # import interfaces
+from pyams_zmi.layer import IAdminLayer
 from pyramid.interfaces import IView
 
 # import packages
+from pyams_template.template import layout_config
 
 
+@layout_config(template='templates/admin-layout.pt', layer=IAdminLayer)
 class IAdminView(IView):
     """Marker interface for administration views"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_zmi/interfaces/templates/admin-layout.pt	Tue Oct 11 17:17:18 2016 +0200
@@ -0,0 +1,194 @@
+<!DOCTYPE html>
+<html lang="en" i18n:domain="pyams_skin"
+	  tal:define="config extension:back_configuration;
+				  static extension:static_configuration;
+				  anonymous request.principal.id == '__none__';"
+	  tal:attributes="lang request.locale_name">
+<head>
+	<tal:var replace="structure extension:metas" />
+
+	<title tal:attributes="data-ams-title-prefix config.get_title_prefix(request)"
+		   tal:content="config.title"></title>
+
+	<tal:if define="icon config.icon | nothing; url extension:absolute_url(icon);" condition="icon">
+		<!-- Favorite icon -->
+		<link rel="shortcut icon" tal:attributes="href url" type="image/x-icon">
+		<link rel="icon" tal:attributes="href url" type="image/x-icon">
+	</tal:if>
+
+	<tal:var replace="extension:resources" />
+
+</head>
+<body tal:attributes="class static.body_css_class">
+
+	<!-- Page header -->
+	<header id="header" tal:condition="static.include_header">
+
+		<!-- Logo -->
+		<div id="logo-group">
+			<span id="logo"
+				  tal:define="logo config.logo | nothing"
+				  tal:condition="logo">
+				<a href="/admin">
+					<img tal:attributes="src extension:absolute_url(logo, '++thumb++200x36.png');" />
+				</a>
+			</span>
+		</div>
+		<!-- end logo -->
+
+		<!-- projects drop-downs -->
+		<div id="top-links" tal:condition="static.include_top_links">
+			<tal:div replace="structure provider:pyams.toplinks" />
+		</div>
+		<!-- end projects drop-downs -->
+
+		<!-- pulled right: nav area -->
+		<div class="pull-right">
+
+			<!-- multiple langs dropdown -->
+			<ul class="header-dropdown-list hidden-xs" tal:condition="static.include_flags">
+				<li tal:content="structure provider:pyams.flags"></li>
+			</ul>
+			<!-- end multiple langs -->
+
+			<!-- collapse menu button -->
+			<div id="hide-menu" class="btn-header pull-right" tal:condition="static.include_menus">
+				<span>
+					<a href="#" title="Hide menu" class="hint" i18n:attributes="title"
+					   data-ams-hint-gravity="ne"><i class="fa fa-bars"></i></a>
+				</span>
+			</div>
+			<!-- end collapse menu -->
+
+			<!-- User avatar and user menus -->
+			<div id="user-menu" class="btn-header pull-right margin-left-10"
+				 tal:condition="not:anonymous">
+				<span class="btn btn-sm btn-success" data-toggle="dropdown">
+					<tal:var define="profile extension:public_profile(request)">
+						<tal:if condition="profile.avatar">
+							<img tal:define="src extension:absolute_url(profile.avatar)"
+								 tal:attributes="src string:${src}/++thumb++square:32x32.png" />
+						</tal:if>
+						<tal:if condition="not:profile.avatar">
+							<i class="fa fa-user img hint" data-ams-hint-gravity="ne"
+							   title="Update your profile to select an avatar..." i18n:attributes="title"></i>
+						</tal:if>
+						<i class="fa fa-caret-down pull-right padding-y-5"></i>
+					</tal:var>
+				</span>
+				<tal:var content="structure provider:pyams.user_menus" />
+			</div>
+			<!-- end user avatar -->
+
+			<tal:var define="shortcuts provider:pyams.shortcuts;
+							 display_shortcuts shortcuts and static.include_user_shortcuts"
+					 condition="display_shortcuts">
+				<!-- user shortcuts -->
+				<div class="btn-header pull-right" tal:condition="static.include_menus">
+					<span>
+						<a href="#" title="My shortcuts" id="show-shortcuts" class="hint" i18n:attributes="title"
+						   data-ams-hint-gravity="ne"><i class="fa fa-bookmark-o"></i></a>
+					</span>
+				</div>
+				<div id="shortcuts">
+					<tal:var content="structure shortcuts" />
+					<div tal:condition="static.version_location == 'shortcuts'" class="version">
+						<tal:var content="static.application_name" /> - version <tal:var content="static.version" />
+					</div>
+				</div>
+				<!-- end user shortcuts -->
+			</tal:var>
+
+			<tal:if condition="static.include_user_activity">
+				<tal:var define="activity provider:pyams.activity"
+						 condition="activity">
+					<!-- user notifications button -->
+					<div id="user-activity" class="btn-header pull-right" tal:condition="static.include_menus">
+						<span>
+							<a href="#" title="Notifications" class="activity-button hint" i18n:attributes="title"
+							   data-ams-hint-gravity="ne"><i class="fa fa-bell"></i></a>
+							<b class="badge bg-color-danger txt-color-white hidden">0</b>
+							<!-- AJAX-dropdown -->
+							<div class="ajax-dropdown"
+								 tal:content="structure activity">
+							</div>
+							<!-- end AJAX-dropdown -->
+						</span>
+					</div>
+					<!-- end user notifications -->
+				</tal:var>
+			</tal:if>
+
+			<tal:if condition="static.include_mobile_search">
+				<!-- search mobile button (this is hidden till mobile view port) -->
+				<tal:var content="structure provider:pyams.mobile_search" />
+				<!-- end search mobile button -->
+			</tal:if>
+
+			<tal:if condition="static.include_site_search">
+				<!-- site search field -->
+				<tal:var content="structure provider:pyams.site_search" />
+				<!-- end site search field -->
+			</tal:if>
+
+		</div>
+		<!-- end nav area -->
+
+	</header>
+	<!-- end page header -->
+
+	<!-- Menus panel -->
+	<aside id="left-panel">
+
+		<tal:if condition="static.include_menus">
+			<!-- AJAX progress gear -->
+			<div id="ajax-gear"><i class="fa fa-2x fa-spin fa-gear"></i></div>
+			<!-- Navigation menus -->
+			<nav tal:content="structure provider:pyams.menus"></nav>
+			<span class="minifyme" style=""> <i class="fa fa-arrow-circle-left hit"></i> </span>
+		</tal:if>
+
+		<div tal:condition="static.version_location == 'menus'" class="version">
+			<!-- Application version -->
+			<tal:var content="static.application_name" /> - version <tal:var content="static.version" />
+		</div>
+	</aside>
+	<!-- end menus panel -->
+
+	<!-- Main panel -->
+	<div id="main" role="main">
+
+		<!-- Ribbon -->
+		<div id="ribbon" tal:condition="static.include_ribbon">
+			<!-- Refresh button -->
+			<span class="ribbon-button-alignment">
+				<span id="refresh" class="btn btn-ribbon hint" data-ams-hint-gravity="w" data-ams-hint-html="true"
+					  title="&lt;span&gt;&lt;i class=&#39;text-warning fa fa-warning&#39;&gt;&lt;/i&gt; WARNING: this will reset all your widgets status!&lt;/span&gt;"
+					  tal:condition="static.include_reload_button" i18n:attributes="title">
+					<i class="fa fa-refresh"></i>
+				</span>
+			</span>
+			<!-- breadcrumb -->
+			<ol class="breadcrumb">
+				<tal:var content="structure provider:pyams.breadcrumbs" />
+			</ol>
+		</div>
+		<!-- end ribbon -->
+
+		<!-- Content -->
+		<div id="content" style="opacity: 1;">
+			<!--[if lt IE 9]>
+			<h1 i18n:translate="">Your browser is too old. Please install version 9 or higher of Internet Explorer.</h1>
+			<![endif]-->
+			<tal:var content="structure provider:pagelet" />
+		</div>
+		<!-- end content -->
+
+	</div>
+	<!-- end main panel -->
+
+	<!-- Javascript extensions -->
+	<tal:var content="structure provider:pyams.jsextensions" />
+	<!-- end javascript extensions -->
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_zmi/templates/admin-index.pt	Tue Oct 11 17:17:18 2016 +0200
@@ -0,0 +1,3 @@
+<div class="margin-20 padding-20 text-align-center">
+	<i class="fa fa-4x fa-cog fa-spin"></i>
+</div>
--- a/src/pyams_zmi/templates/admin.pt	Mon Oct 10 15:27:43 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<div class="margin-20 padding-20 text-align-center">
-	<i class="fa fa-4x fa-cog fa-spin"></i>
-</div>