misc: stop shipping gadjo (portal agent) theme (#31859)

This commit is contained in:
Frédéric Péters 2019-03-29 17:36:35 +01:00
parent 2bd06c348b
commit 38d3a42711
12 changed files with 1 additions and 602 deletions

View File

@ -10,7 +10,6 @@ recursive-include combo/apps/maps/static *.css *.scss *.js
recursive-include combo/apps/pwa/static *.css *.scss *.js *.svg
recursive-include combo/manager/static *.css *.js *.ico *.gif *.png *.jpg
recursive-include combo/public/static *.css *.js *.ico *.gif *.png *.jpg
recursive-include data/themes *.scss *.css *.js *.gif *.png *.jpg *.jpeg *.html
# templates
recursive-include combo/data/templates *.html *.txt

View File

@ -1,254 +0,0 @@
$primary-color: #386ede;
$secondary-color: #00d6eb;
$cell-entry-color: #333;
$cell-entry-border-color: #ccc;
$cell-entry-hover-color: $cell-entry-color;
$cell-entry-hover-background: #eee;
$mobile-limit: 760px;
div#page-content.columns {
display: -ms-flexbox;
display: flex;
> div {
box-sizing: border-box;
width: 50%;
padding-right: 1rem;
@media screen and (max-width: $mobile-limit) {
width: auto;
padding: 0;
}
}
@media screen and (max-width: $mobile-limit) {
-ms-flex-direction: column;
flex-direction: column;
}
}
div.welcome {
border: 1px solid #e4e4e4;
background: #fcfcfc;
padding: 1ex;
}
div.textcell {
clear: both;
}
#content div.cell.gauge {
width: 270px;
max-width: 32%;
float: left;
}
div.cell {
margin-bottom: 2rem;
}
div.cell.gauge div.bo-block {
position: relative;
}
div.cell.gauge div.bo-block span.counter {
position: absolute;
top: 0.5ex;
right: 0.5ex;
font-size: 200%;
}
div.cell div.loading {
color: #444;
position: relative;
}
@-webkit-keyframes cell-loading-pulse {
to { width: 100%; }
}
@keyframes cell-loading-pulse {
to { width: 100%; }
}
div.ajax-loaded div.loading {
position: absolute;
width: 10%;
right: 0;
}
div.cell div.loading span {
position: relative;
z-index: 10;
padding: 0.5ex;
display: inline-block;
}
div.cell div.loading::after {
content: "";
position: absolute;
z-index: 0;
left: 0;
width: 0px;
background: #eee;
height: 100%;
-webkit-animation: cell-loading-pulse 2s linear infinite alternate;
animation: cell-loading-pulse 2s linear infinite alternate;
}
div.cell div.loading.error-loading {
background: #f44;
}
div.cell div.loading.error-loading::after {
content: none;
}
div.searchcell {
form {
display: flex;
input {
flex: 1 0 auto;
margin-right: 1rem;
}
}
div.links-list li {
&::before {
font-family: FontAwesome;
display: block;
position: absolute;
font-size: 1.5rem;
left: 0rem;
color: #555;
width: 3rem;
text-align: center;
padding-top: 1rem;
}
padding-left: 3rem;
&.hidden {
display: none;
}
}
div.combo-search-results-users div.links-list li::before {
content: "\f007"; // user
}
div[class*="combo-search-results-formdata"] div.links-list li::before {
content: "\f0f6"; // file-text-o
}
div.combo-search-results-tracking-code div.links-list li::before {
content: "\f02a"; // barcode
}
div div.links-list li.see-more::before {
content: "\f067"; // plus
}
div.combo-search-results.expanded div.links-list {
li.hidden {
display: block;
}
li.see-more {
&::before {
content: "\f068"; // minus
}
}
}
}
div.links-list {
ul {
padding: 0;
margin: 0;
list-style: none;
position: relative;
z-index: 0;
& > li {
color: $cell-entry-color;
border-bottom: 1px solid $cell-entry-border-color;
position: relative;
> h4 { // group titles
margin: 0;
font-size: 110%;
font-weight: normal;
color: $primary-color;
font-weight: bold;
padding: 1rem;
border-bottom: 1px solid $primary-color;
}
> a {
display: block;
padding: 1rem;
border: none;
&:not([href]) {
color: inherit;
}
}
&:hover {
color: $cell-entry-hover-color;
background-color: $cell-entry-hover-background;
}
div {
color: lighten($cell-entry-color, 20%);
}
a + div {
padding-left: 1rem;
margin-top: -0.9rem;
padding-bottom: 0.5rem;
}
}
}
}
div.backofficesubmissioncell div.links-list h4 {
background: url(/static/css/icons/categories.small.386ede.png) 5px center no-repeat;
padding-left: 35px;
}
/* support foldable cells */
div.cell {
&.foldable {
> div > h2:first-child {
&::after {
font-family: FontAwesome;
content: "\f106"; /* angle-up */
position: absolute;
right: 1em;
}
cursor: pointer;
}
}
&.foldable.folded {
> div > h2:first-child {
display: block;
&::after {
content: "\f107"; /* angle-down */
}
}
> div > * {
display: none;
}
}
}
div.profile {
span.value {
display: block;
margin-left: 1rem;
}
}
@media screen and (min-width: 1586px) {
div#page-content div.cubesbarchart {
width: 49.5%;
margin-right: 0.5%;
float: left;
height: 350px;
}
}
@media print {
div#page-content div.cubesbarchart {
float: none;
}
div.cubesbarchart:nth-child(2n) {
page-break-after: always;
}
}

View File

@ -1,37 +0,0 @@
$(function() {
$(document).on('publik:environment-loaded', function(event, services) {
/* empty all apps cells */
var service_ids = Array('authentic', 'wcs', 'combo', 'passerelle', 'hobo');
$(service_ids).each(function(index, service_id) {
$('#portal-agent-content div.services-' + service_id + ' ul.apps').empty();
});
$('#portal-agent-content div.services ul.apps').empty();
/* and fill them with current services */
$(services.services).each(function(index, element) {
var $content = $('#portal-agent-content div.services-' + element.service_id);
if ($content.length === 0) {
$content = $('#portal-agent-content div.services');
}
if ($content.find('ul.apps').length === 0) {
$('<ul class="apps">').appendTo($content);
}
var $apps = $content.find('ul.apps');
$(element.data).each(function(index, menuitem) {
var li = $('<li><a href="' + menuitem.url + '">' + menuitem.label + '</a></li>').appendTo($apps);
if (menuitem.icon !== undefined) {
$(li).addClass('icon-' + menuitem.icon);
} else if (menuitem.slug !== undefined) {
$(li).addClass('icon-' + menuitem.slug);
}
});
});
});
$(document).on('publik:menu-loaded', function(event, services) {
/* mark our location in publik menu */
$('#portal-agent-home').addClass('active');
});
$('div.searchcell').delegate('li.see-more a', 'click', function() {
$(this).parents('.combo-search-results').toggleClass('expanded');
return false;
});
});

View File

@ -1,180 +0,0 @@
GADJO_DEFAULT_SIDEPAGE_STATUS = 'expanded';
$(function() {
var all_done = false;
if (PUBLIK_ENVIRONMENT_LABEL) {
$('body').attr('data-environment-label', PUBLIK_ENVIRONMENT_LABEL);
}
if (PUBLIK_PORTAL_AGENT_EXTRA_CSS) {
$('<link rel="stylesheet" type="text/css" media="all" href="' +
PUBLIK_PORTAL_AGENT_EXTRA_CSS + '"/>').appendTo('head');
}
function update_publik_menu() {
window.sessionStorage.hobo_environment = JSON.stringify(COMBO_KNOWN_SERVICES);
window.sessionStorage.hobo_environment_timestamp = Date.now();
create_menu_items();
$(document).trigger('publik:environment-loaded', {services: COMBO_KNOWN_SERVICES});
}
function create_menu_items() {
$('#sidepage-menu').remove();
var menu_links = $('<ul id="sidepage-menu">');
if (PUBLIK_PORTAL_AGENT_URL && PUBLIK_PORTAL_AGENT_TITLE) {
var li = $('<li id="portal-agent-home"><a>' + PUBLIK_PORTAL_AGENT_TITLE + '</a></li>').appendTo(menu_links);
$(li).find('a').attr('href', PUBLIK_PORTAL_AGENT_URL).addClass('icon-home');
}
var more_entries = Array();
var service_order = Array('authentic', 'welco', 'wcs', 'bijoe', 'chrono', 'corbo', 'combo', 'passerelle', 'hobo');
COMBO_KNOWN_SERVICES.sort(function(a, b) {
a_service_order = service_order.indexOf(a.service_id);
b_service_order = service_order.indexOf(b.service_id);
if (a_service_order == b_service_order) {
return a.service_id.localeCompare(b.service_id);
}
if (a_service_order < 0) return 1;
if (b_service_order < 0) return -1;
return a_service_order - b_service_order;
});
$(COMBO_KNOWN_SERVICES).each(function(index, service) {
if (service.data === undefined || service.data.length == 0) {
return;
}
$(service.data).each(function(idx, element) {
var li = $('<li><a href="#">' + element.label + '</a></li>').appendTo(menu_links);
$(li).find('a').attr('href', element.url);
$(li).find('a').attr('title', element.label);
if (element.icon !== undefined) {
$(li).find('a').addClass('icon-' + element.icon);
} else if (element.slug !== undefined) {
$(li).find('a').addClass('icon-' + element.slug);
}
if (window.location.href.indexOf(element.url) == 0) {
$(li).addClass('active');
}
});
});
$(more_entries).each(function(index, entry) {
var li = $('<li><a href="#">' + entry.title + '</a></li>').appendTo(menu_links);
$(li).find('a').attr('href', entry.url);
});
menu_links.appendTo('#sidepage');
$(document).trigger('publik:menu-loaded');
}
if (window.sessionStorage.hobo_environment &&
parseInt(window.sessionStorage.hobo_environment_timestamp) > Date.now()-600000) {
COMBO_KNOWN_SERVICES = JSON.parse(window.sessionStorage.hobo_environment);
$(document).trigger('publik:environment-loaded', {services: COMBO_KNOWN_SERVICES});
create_menu_items();
} else {
var this_hostname = window.location.hostname;
var look_for_wcs = false;
var got_wcs = false;
var authentic_url = undefined;
$(COMBO_KNOWN_SERVICES).each(function(index, element) {
if (element.backoffice_menu_url === null) {
element.data = Array();
update_publik_menu();
return;
}
if (element.service_id === 'wcs' && element.uniq === false) {
/* as wcs comes with many menu entries, if it's not the only instance
* in the environment, we simply skip it if it's not the active site.
*/
var that_hostname = $('<a>').attr('href', element.backoffice_menu_url)[0].hostname;
if (that_hostname != this_hostname) {
look_for_wcs = true;
element.data = Array();
update_publik_menu();
return;
} else {
got_wcs = true;
}
}
if (element.service_id === 'authentic') {
authentic_url = element.url;
}
$.ajax({url: element.backoffice_menu_url,
xhrFields: { withCredentials: true },
async: true,
dataType: 'jsonp',
crossDomain: true,
success: function(data) { element.data = data; update_publik_menu(); },
error: function(error) { window.console && console.log('bouh', error); element.data = Array(); update_publik_menu(); }
}
);
});
if (! got_wcs && look_for_wcs && authentic_url) {
/* if there is several wcs instances, we ask authentic for details on the
* user, to get the services where the user has some roles
*/
$.ajax({url: authentic_url + 'api/user/',
xhrFields: { withCredentials: true },
async: true,
dataType: 'jsonp',
crossDomain: true,
success: function(data) {
var services_to_consider = Array();
/* iterate over all services, to get those to consider */
$(COMBO_KNOWN_SERVICES).each(function(index, element) {
if (element.service_id !== 'wcs') return;
$(data.services).each(function(auth_index, auth_element) {
if (auth_element.slug !== element.slug) return;
if (auth_element.roles.length == 0) return;
element.preferred = (data.ou__uuid == auth_element.ou__uuid);
services_to_consider.push(element);
});
});
if (services_to_consider.length > 1) {
/* if there are multiple wcs, reduce the list to those from
* the same organizational unit as the user
*/
services_to_consider = services_to_consider.filter(
function(element) { return element.preferred == true; }
);
}
if (services_to_consider.length == 1) {
/* only handle the case with a single service, for now */
var element = services_to_consider[0];
$.ajax({url: element.backoffice_menu_url,
xhrFields: { withCredentials: true },
async: true,
dataType: 'jsonp',
crossDomain: true,
success: function(data) { element.data = data; update_publik_menu(); },
error: function(error) {
window.console && console.log('bouh', error);
element.data = Array(); update_publik_menu();
}
});
}
},
error: function(error) { window.console && console.log('bouh', error); }
}
);
}
}
var sidepage_button = $('#sidepage #applabel');
sidepage_button.css('visibility', 'visible');
/* This won't work if portal agent is installed directly in a top domain
* name. Live with it. */
var cookie_domain = window.location.hostname.split('.').slice(1).join('.');
var date = new Date();
date.setTime(date.getTime() + (10 * 86400 * 1000)); /* a long week */
document.cookie = 'publik_portal_agent_url=' +
encodeURIComponent(PUBLIK_PORTAL_AGENT_URL) +
'; expires=' + date.toGMTString() +
'; domain=.' + cookie_domain + '; path=/';
document.cookie = 'publik_portal_agent_title=' +
encodeURIComponent(PUBLIK_PORTAL_AGENT_TITLE) +
'; expires=' + date.toGMTString() +
'; domain=.' + cookie_domain + '; path=/';
});

View File

@ -1 +0,0 @@
.

View File

@ -1,31 +0,0 @@
{% extends "gadjo/base.html" %}
{% load combo gadjo static i18n %}
{% block css %}
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/agent-portal.css"/>
{% endblock %}
{% block extrascripts %}
<script src="{% static "js/combo.public.js" %}"></script>
<script src="/__services.js"></script>
<script src="{% static "js/agent-portal.js" %}"></script>
<script src="{% static "js/publik.js" %}"></script>
{% endblock %}
{% block page-title %}{% firstof site_title "Publik" %} - {{ page.title }}{% endblock %}
{% block site-title %}{% firstof site_title "Publik" %}{% endblock %}
{% block footer %}Combo — Copyright © Entr'ouvert{% endblock %}
{% block logout-url %}{% url 'auth_logout' %}{% endblock %}
{% block bodyargs %}
data-api-root="{{ site_base }}/api/"
{% if check_badges %}data-check-badges="true"{% endif %}
{% endblock %}
{% block content %}
<div id="portal-agent-content">
{% block combo-content %}
{% trans "Content" as name %}
{% placeholder "content" name=name %}
{% endblock %}
</div>
{% endblock %}

View File

@ -1,15 +0,0 @@
{% extends "combo/page_template.html" %}
{% load combo i18n %}
{% block combo-content %}
<div id="page-content" class="columns">
<div id="left">
{% trans "Left column" as name %}
{% placeholder "content" name=name %}
</div>
<div id="right">
{% trans "Right column" as name %}
{% placeholder "right" name=name %}
</div>
</div>
{% endblock %}

View File

@ -1,22 +0,0 @@
{% extends "combo/page_template.html" %}
{% load combo i18n %}
{% block combo-content %}
<div id="page-content" class="columns">
<div id="left">
{% trans "Left column" as name %}
{% placeholder "content" name=name %}
</div>
<div id="right">
{% trans "Right column" as name %}
{% placeholder "right" name=name %}
</div>
</div>
{% endblock %}
{% block sidebar %}
<aside id="sidebar">
{% trans "Sidebar" as name %}
{% placeholder "sidebar" name=name %}
</aside>
{% endblock %}

View File

@ -1,16 +0,0 @@
{% extends "combo/page_template.html" %}
{% load combo i18n %}
{% block combo-content %}
<div id="page-content">
{% trans "Content" as name %}
{% placeholder "content" name=name %}
</div>
{% endblock %}
{% block sidebar %}
<aside id="sidebar">
{% trans "Sidebar" as name %}
{% placeholder "sidebar" name=name %}
</aside>
{% endblock %}

View File

@ -1,19 +0,0 @@
{% load i18n %}
{% if cell.has_multiple_search_services %}<p class="search-service-label">{{ search_service.label }}</p>{% endif %}
{% if results.data %}
<div class="links-list">
<ul>
{% for item in results.data %}
{% if forloop.counter == 6 %}<li class="see-more"><a href="#">voir tous les résultats</a></li>{% endif %}
<li {% if forloop.counter > 5 %}class="hidden"{% endif %}><a
{% if item.url %}href="{{ item.url }}"{% else %}class="nolink"{% endif %}>{{ item.text }}</a>
{% if item.description %}<div>{{ item.description|safe }}</div>{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% else %}
<div class="infonotice">
{% trans "…no result found." %}
</div>
{% endif %}

View File

@ -1,24 +0,0 @@
{% extends "gadjo/root.html" %}
{% load i18n static %}
{% block extrascripts %}
{{ block.super }}
<script src="/__services.js"></script>
<script src="{% static "js/publik.js" %}"></script>
{% endblock %}
{% block site-header %}
<h1 class="breadcrumbs">
{% block breadcrumb %}
{% endblock %}
</h1>
{% endblock %}
{% block more-user-links %}
{% endblock %}
{% block sidepage %}
<div id="sidepage">
<span id="applabel">Publik</span>
</div>
{% endblock %}

View File

@ -104,7 +104,7 @@ class compile_scss(Command):
if not sass_bin:
raise CompileError('A sass compiler is required but none was found. See sass-lang.com for choices.')
for path, dirnames, filenames in itertools.chain(os.walk('combo'), os.walk('data')):
for path, dirnames, filenames in os.walk('combo'):
for filename in filenames:
if not filename.endswith('.scss'):
continue
@ -134,7 +134,6 @@ setup(
packages=find_packages(exclude=['tests']),
include_package_data=True,
scripts=('manage.py',),
data_files=data_tree('share/publik/themes/', 'data/themes/'),
url='https://dev.entrouvert.org/projects/combo/',
classifiers=[
'Development Status :: 4 - Beta',