distribute theme for "portail agent" (#7294)

This commit is contained in:
Frédéric Péters 2015-05-20 11:27:26 +02:00
parent 099a07a98b
commit 036c349e75
9 changed files with 212 additions and 0 deletions

View File

@ -4,6 +4,7 @@ recursive-include combo/locale *.po *.mo
# static
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 *.css *.js *.gif *.png *.jpg *.jpeg *.html
# templates
recursive-include combo/apps/wcs/templates *.html

View File

@ -0,0 +1,5 @@
div.welcome {
border: 1px solid #e4e4e4;
background: #fcfcfc;
padding: 1ex;
}

View File

@ -0,0 +1,86 @@
GADJO_DEFAULT_SIDEPAGE_STATUS = 'expanded';
$(function() {
var all_done = false;
function check_all_done() {
var local_done = true;
$(COMBO_KNOWN_SERVICES).each(function(index, service) {
if (service.data === undefined) {
local_done = false;
}
});
all_done = local_done;
if (all_done) {
window.sessionStorage.hobo_environment = JSON.stringify(COMBO_KNOWN_SERVICES);
window.sessionStorage.hobo_environment_timestamp = Date.now();
create_menu_items();
}
}
function create_menu_items() {
$('#sidepage-menu').remove();
var menu_links = $('<ul id="sidepage-menu">');
var more_entries = Array();
$(COMBO_KNOWN_SERVICES).each(function(index, service) {
if (service.data === undefined || service.data.length == 0) {
return;
}
if (service.service_id == 'wcs' && service.uniq === false) {
/* as wcs comes with many menu entries, if it's not the only instance
* in the environment, we only insert all the items if it's the
* currently active site.
*/
var that_hostname = $('<a>').attr('href', service.backoffice_menu_url)[0].hostname;
var this_hostname = window.location.hostname;
if (that_hostname != this_hostname) {
more_entries.push({
title: service.title,
url: service.data[0].url});
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);
if (element.icon !== undefined) {
$(li).find('a').addClass('icon-' + element.icon);
}
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');
}
if (window.sessionStorage.hobo_environment &&
parseInt(window.sessionStorage.hobo_environment_timestamp) > Date.now()-600000) {
COMBO_KNOWN_SERVICES = JSON.parse(window.sessionStorage.hobo_environment);
create_menu_items();
} else {
$(COMBO_KNOWN_SERVICES).each(function(index, element) {
if (element.backoffice_menu_url === null) {
element.data = Array();
check_all_done();
return;
}
$.ajax({url: element.backoffice_menu_url,
xhrFields: { withCredentials: true },
async: true,
dataType: 'jsonp',
crossDomain: true,
success: function(data) { element.data = data; check_all_done(); },
error: function(error) { console.log('bouh', error); element.data = Array(); check_all_done(); }
}
);
});
}
var sidepage_button = $('#sidepage #applabel');
sidepage_button.text('Publik ▼');
});

View File

@ -0,0 +1,38 @@
{% extends "gadjo/base.html" %}
{% load staticfiles i18n %}
{% block css %}
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/combo.manager.css"/>
{% endblock %}
{% block page-title %}Combo{% endblock %}
{% block site-title %}Combo{% endblock %}
{% block footer %}Combo — Copyright © Entr'ouvert{% endblock %}
{% block homepage-url %}
{% url 'combo-manager-homepage' as default_homepage_url %}
{% firstof manager_homepage_url default_homepage_url %}
{% endblock %}
{% block homepage-title %}
{% trans 'Management' as default_homepage_title %}
{% firstof manager_homepage_title default_homepage_url %}
{% endblock %}
{% block more-user-links %}
{{ block.super }}
{% if homepage_url %}
<a href="{% url 'combo-manager-homepage' %}">{% trans 'Portal Management' %}</a>
{% endif %}
{% endblock %}
{% block logout-url %}{% url 'auth_logout' %}{% endblock %}
{% block extrascripts %}
<script src="/__services.js"></script>
<script src="{% static "js/publik.js" %}"></script>
<script src="{% static "ckeditor/ckeditor/ckeditor.js" %}"></script>
<script type="text/javascript" src="{% static "ckeditor/ckeditor-init.js" %}"></script>
<script src="{% static "js/combo.manager.js" %}"></script>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% load combo %}
{% if menuitems %}
<ul>
{% for menuitem in menuitems %}
<li class="menu-{{ menuitem.page.slug }} {% if menuitem.selected %}selected{% endif %}"><a
href="{{ menuitem.page.get_online_url }}">{{ menuitem.page.title }}</a>
{% if depth > 1 %}
{% show_menu current_page=menuitem.page level=-1 depth=depth reduce_depth=True %}
{% endif %}
</li>
</li>
{% endfor %}
</ul>
{% endif %}

View File

@ -0,0 +1,38 @@
{% 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="/__services.js"></script>
<script src="{% static "js/publik.js" %}"></script>
{% endblock %}
{% block page-title %}{{ page.title }}{% endblock %}
{% block site-title %}Publik{% endblock %}
{% block footer %}Combo — Copyright © Entr'ouvert{% endblock %}
{% block logout-url %}{% url 'auth_logout' %}{% endblock %}
{% block content %}
{% block combo-content %}
{% placeholder "content" %}
{% endblock %}
{% endblock %}
{% block more-user-links %}
<span id="breadcrumb">
{% block breadcrumb %}
{% if manager_homepage_url %}
{% trans "Homepage" as default_manager_homepage_title %}
<a class="icon-home-space" href="{{ manager_homepage_url }}">
{% firstof manager_homepage_title default_manager_homepage_title %}
</a>
<a href="{% url 'homepage' %}">{% trans 'Home' %}</a>
{% else %}
<a href="" class="icon-home-space">{% trans 'Home' %}</a>
{% endif %}
{% endblock %}
</span>
{% endblock %}

View File

@ -0,0 +1,13 @@
{% extends "combo/page_template.html" %}
{% load combo %}
{% block combo-content %}
<div id="main-content">
{% placeholder "content" %}
</div>
<div id="sidebar">
<h2>Sidebar</h2>
{% show_menu 1 %}
{% placeholder "sidebar" %}
</div>
{% endblock %}

View File

@ -0,0 +1,8 @@
{% load combo %}
{% for cell in cells %}
<div class="cell {{ cell.css_class_name }} {% if cell.slug %}{{cell.slug}}{% endif %}"
{% if cell.ajax_refresh %}
data-ajax-cell-url="{% url 'combo-public-ajax-page-cell' page_pk=page.id cell_reference=cell.get_reference %}"
data-ajax-cell-refresh="{{ cell.ajax_refresh }}"
{% endif %}><div>{% render_cell cell %}</div></div>
{% endfor %}

View File

@ -39,6 +39,14 @@ def get_version():
return version
return '0'
def data_tree(destdir, sourcedir):
extensions = ['.css', '.png', '.jpeg', '.jpg', '.gif', '.xml', '.html', '.js']
r = []
for root, dirs, files in os.walk(sourcedir):
l = [os.path.join(root, x) for x in files if os.path.splitext(x)[1] in extensions]
r.append((root.replace(sourcedir, destdir, 1), l))
return r
class compile_translations(Command):
description = 'compile message catalogs to MO files via django compilemessages'
user_options = []
@ -82,6 +90,7 @@ setup(
packages=find_packages(),
include_package_data=True,
scripts=('manage.py',),
data_files=data_tree('share/combo/themes/', 'data/themes/'),
url='https://dev.entrouvert.org/projects/combo/',
classifiers=[
'Development Status :: 2 - Pre-Alpha',