From b9db782d51fc6d02b09b790ea33d8ccbe94c404b Mon Sep 17 00:00:00 2001 From: iryabykin Date: Sun, 24 May 2020 02:45:43 +0300 Subject: [PATCH 1/6] Navigation back from Detail to List with filters preserved moreover, now it is possible to get back from any related model Detail view inside the iframe --- simpleui/templates/admin/change_form.html | 2 +- simpleui/templatetags/simpletags.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/simpleui/templates/admin/change_form.html b/simpleui/templates/admin/change_form.html index 43b7e822..19ee5523 100644 --- a/simpleui/templates/admin/change_form.html +++ b/simpleui/templates/admin/change_form.html @@ -108,7 +108,7 @@ el: '.page-header', methods: { goBack: function () { - window.location.href = '{% get_model_url %}' + window.location.href = '{% get_previous_url %}' } } }) diff --git a/simpleui/templatetags/simpletags.py b/simpleui/templatetags/simpletags.py index 32bd39dc..709c3570 100644 --- a/simpleui/templatetags/simpletags.py +++ b/simpleui/templatetags/simpletags.py @@ -478,3 +478,7 @@ def get_boolean_choices(): ('True', _('Yes')), ('False', _('No')) ) + +@register.simple_tag(takes_context=True) +def get_previous_url(context): + return context.request.META.get('HTTP_REFERER') From ce3c912ad2bd3de96e570529e5091f829fcf4a1e Mon Sep 17 00:00:00 2001 From: panjing <599194993@qq.com> Date: Mon, 22 Jun 2020 14:36:29 +0800 Subject: [PATCH 2/6] Update THE CDN addresses of JS and CSS --- simpleui/templates/admin/base.html | 46 ++++++------------- .../templates/admin/includes/css-part.html | 8 ++-- .../templates/admin/includes/fieldset.html | 4 -- .../templates/admin/includes/js-part.html | 4 +- 4 files changed, 19 insertions(+), 43 deletions(-) diff --git a/simpleui/templates/admin/base.html b/simpleui/templates/admin/base.html index c6f8e210..6cfea7b1 100644 --- a/simpleui/templates/admin/base.html +++ b/simpleui/templates/admin/base.html @@ -1,34 +1,19 @@ -{% load i18n static simpletags %} +{% load i18n static simpletags %} {% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %} {% block title %}{% endblock %} - {% if "SIMPLEUI_STATIC_OFFLINE"|get_config %} - - - {% else %} - - - {% endif %} + {% include 'admin/includes/css-part.html' %} - - - - - - {% if "SIMPLEUI_STATIC_OFFLINE"|get_config %} - - - {% else %} - {# - - #} - - - {% endif %} + + + + + + + {% include 'admin/includes/js-part.html' %} @@ -46,17 +31,13 @@ {% block extrastyle %}{% endblock %} {% if LANGUAGE_BIDI %} - {% endif %} + {% endif %} {% block extrahead %}{% endblock %} {% block responsive %} - + {% if LANGUAGE_BIDI %} - + {% endif %} {% endblock %} {% block blockbots %} @@ -77,8 +58,7 @@ {% if "SIMPLEUI_DEFAULT_THEME"|get_config %} + href="{% static 'admin/simpleui-x/theme/' %}{{ "SIMPLEUI_DEFAULT_THEME"|get_config }}"> {% endif %} {% else %} - - + + {% endif %} \ No newline at end of file From 3247dc867879258e74e6e3f088df6aa274afaa71 Mon Sep 17 00:00:00 2001 From: panjing <599194993@qq.com> Date: Mon, 22 Jun 2020 15:05:04 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix=20#267=20=E6=A0=87=E7=AD=BE=E8=BF=87?= =?UTF-8?q?=E5=A4=9A=E6=97=B6=E4=BC=9A=EF=BC=8C=E5=8F=B3=E9=94=AE=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E9=80=89=E9=A1=B9=E8=8F=9C=E5=8D=95=E4=BC=9A?= =?UTF-8?q?=E5=8F=98=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simpleui/static/admin/simpleui-x/js/index.js | 16 ++++++++++++++-- simpleui/templates/admin/index.html | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/simpleui/static/admin/simpleui-x/js/index.js b/simpleui/static/admin/simpleui-x/js/index.js index bf4a6baa..f564550a 100644 --- a/simpleui/static/admin/simpleui-x/js/index.js +++ b/simpleui/static/admin/simpleui-x/js/index.js @@ -374,15 +374,27 @@ window.open(url); }, contextmenu: function (item, e) { + //右键菜单,如果x+菜单宽度超过屏幕宽度,就默认为屏幕宽度-10-菜单宽度 //home没有popup menu if (item.id == '0') { return; } this.popup.tab = item; - this.popup.left = e.clientX; - this.popup.top = e.clientY; this.popup.show = true; + this.$nextTick(function () { + let el = this.$refs.popupmenu; + el.style.width='150px'; + let x = e.clientX; + + let w= document.body.offsetWidth + if(x+150>w){ + x = w - 160; + } + + this.popup.left = x; + this.popup.top = e.clientY; + }); }, mainClick: function (e) { this.popup.show = false; diff --git a/simpleui/templates/admin/index.html b/simpleui/templates/admin/index.html index d2f9c939..7e382bce 100755 --- a/simpleui/templates/admin/index.html +++ b/simpleui/templates/admin/index.html @@ -263,7 +263,7 @@ -