Projet

Général

Profil

0001-general-add-support-for-theme-specific-backoffice-ex.patch

Frédéric Péters, 04 décembre 2020 16:19

Télécharger (2,96 ko)

Voir les différences:

Subject: [PATCH] general: add support for theme specific backoffice extra css
 (#49139)

 create_themes_json.py            | 5 +++++
 get_themes.py                    | 2 ++
 static/portal-agent/js/publik.js | 5 -----
 templates/gadjo/base.html        | 3 +++
 4 files changed, 10 insertions(+), 5 deletions(-)
create_themes_json.py
28 28
        theme['variables']['no_extra_js'] = False
29 29
    else:
30 30
        theme['variables']['no_extra_js'] = True
31
    if (os.path.exists(os.path.join('static', dirname, 'backoffice.scss')) or
32
            os.path.exists(os.path.join('static', dirname, 'backoffice.css'))):
33
        theme['variables']['portal_agent_extra_css'] = '/static/%s/backoffice.css' % dirname
34
    else:
35
        theme['variables']['portal_agent_extra_css'] = None
31 36
    if 'included_js_libraries' not in theme['variables']:
32 37
        theme['variables']['included_js_libraries'] = ['jquery.js']
33 38
    if args.overlay:
get_themes.py
7 7
    if not os.path.exists(config):
8 8
        continue
9 9
    print('static/%s/style.css' % dirname)
10
    if os.path.exists(os.path.join('static', dirname, 'backoffice.scss')):
11
        print('static/%s/backoffice.css' % dirname)
static/portal-agent/js/publik.js
7 7
    $('body').attr('data-environment-label', PUBLIK_ENVIRONMENT_LABEL);
8 8
  }
9 9

  
10
  if (PUBLIK_PORTAL_AGENT_EXTRA_CSS) {
11
    $('<link rel="stylesheet" type="text/css" media="all" href="' +
12
                    PUBLIK_PORTAL_AGENT_EXTRA_CSS + '"/>').appendTo('head');
13
  }
14

  
15 10
  function update_publik_menu() {
16 11
    window.sessionStorage.hobo_environment = JSON.stringify(COMBO_KNOWN_SERVICES);
17 12
    window.sessionStorage.hobo_environment_timestamp = Date.now();
templates/gadjo/base.html
12 12

  
13 13
{% block extrascripts %}
14 14
<link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}includes/gadjo-extra.css">
15
{% if portal_agent_extra_css %}
16
<link rel="stylesheet" type="text/css" href="{{ portal_agent_extra_css }}">
17
{% endif %}
15 18
{% if manager_homepage_url %}
16 19
<script src="{{manager_homepage_url}}__services.js"></script>
17 20
<script src="{{manager_homepage_url}}static/portal-agent/js/publik.js?{% start_timestamp %}"></script>
18
-