Skip to content

Commit

Permalink
Merge pull request #273 from newpanjing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
newpanjing authored Jun 22, 2020
2 parents e974523 + e3a9ad0 commit 39801dd
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 57 deletions.
2 changes: 1 addition & 1 deletion simpleui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def get_version():
return '4.0.2'
return '4.0.3'
18 changes: 15 additions & 3 deletions simpleui/static/admin/simpleui-x/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -572,7 +584,7 @@
},
report: function (url) {
if (!url) {
if ($("html").lang) {
if (document.querySelector('html').lang) {
url = 'https://simpleui.88cto.com';
} else {
url = 'https://github.com/newpanjing/simpleui/issues';
Expand Down
46 changes: 13 additions & 33 deletions simpleui/templates/admin/base.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
{% load i18n static simpletags %}
<!DOCTYPE html>
{% load i18n static simpletags %}
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE|default:" en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
<title>{% block title %}{% endblock %}</title>

{% if "SIMPLEUI_STATIC_OFFLINE"|get_config %}
<link rel="stylesheet" href="{% static '/admin/simpleui-x/elementui/theme-chalk/index.css' %}">
<link rel="stylesheet" href="{% static '/admin/simpleui-x/fontawesome-free-5.8.1-web/css/all.min.css' %}">
{% else %}
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/5.8.1/css/all.min.css">
{% endif %}
{% include 'admin/includes/css-part.html' %}

<link rel="stylesheet" type="text/css" href="{% static " admin
/css/base.css" %}">
<link rel="stylesheet" href="{% static '/admin/simpleui-x/css/base.css' %}?_=2.7">
<link rel="stylesheet" href="{% static '/admin/simpleui-x/theme/simpleui.css' %}">


{% if "SIMPLEUI_STATIC_OFFLINE"|get_config %}
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/vue.min.js' %}"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/elementui/index.js' %}"></script>
{% else %}
{#
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
#}
<script src="https://unpkg.com/vue@2.6.0/dist/vue.min.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
{% endif %}
<link rel="stylesheet" type="text/css" href="{% static '/admin/css/base.css' %}?_=2.7">
<link rel="stylesheet" type="text/css" href="{% static '/admin/simpleui-x/css/base.css' %}?_=2.7">
<link rel="stylesheet" type="text/css" href="{% static '/admin/simpleui-x/theme/simpleui.css' %}">



{% include 'admin/includes/js-part.html' %}

<script type="text/javascript" src="{% static '/admin/simpleui-x/js/language.js' %}?_=2.1.2"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/locale/en-us.js' %}?_=2.1.2"></script>
Expand All @@ -46,17 +31,13 @@
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/cookie.js' %}"></script>
{% block extrastyle %}{% endblock %}
{% if LANGUAGE_BIDI %}
<link rel="stylesheet" type="text/css" href="
{% block stylesheet_rtl %}{% static " admin
/css/rtl.css" %}{% endblock %}?_=20180905"/>{% endif %}
<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}?_=20180905"/>{% endif %}
{% block extrahead %}{% endblock %}
{% block responsive %}
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="{% static " admin
/css/responsive.css" %}?_=20180905"/>
<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive.css" %}?_=20180905"/>
{% if LANGUAGE_BIDI %}
<link rel="stylesheet" type="text/css" href="{% static " admin
/css/responsive_rtl.css" %}?_=20180905"/>
<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive_rtl.css" %}?_=20180905"/>
{% endif %}
{% endblock %}
{% block blockbots %}
Expand All @@ -77,8 +58,7 @@

{% if "SIMPLEUI_DEFAULT_THEME"|get_config %}
<link v-else rel="stylesheet"
href="{% static 'admin/simpleui-x/theme/' %}{{ " SIMPLEUI_DEFAULT_THEME
"|get_config }}">
href="{% static 'admin/simpleui-x/theme/' %}{{ "SIMPLEUI_DEFAULT_THEME"|get_config }}">
{% endif %}
</div>
<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion simpleui/templates/admin/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
el: '.page-header',
methods: {
goBack: function () {
window.location.href = '{% get_model_url %}'
window.location.href = '{% get_previous_url %}'
}
}
})
Expand Down
8 changes: 4 additions & 4 deletions simpleui/templates/admin/includes/css-part.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% load static simpletags %}
{% if "SIMPLEUI_STATIC_OFFLINE"|get_config %}
<link rel="stylesheet" href="{% static '/admin/simpleui-x/elementui/theme-chalk/index.css' %}">
<link rel="stylesheet" href="{% static '/admin/simpleui-x/fontawesome-free-5.8.1-web/css/all.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/admin/simpleui-x/elementui/theme-chalk/index.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/admin/simpleui-x/fontawesome-free-5.8.1-web/css/all.min.css' %}">
{% else %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.0/css/all.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.0/css/all.min.css">
{% endif %}
4 changes: 0 additions & 4 deletions simpleui/templates/admin/includes/fieldset.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,8 @@
}
};

console.log("============================")



var image_document = document.getElementsByTagName("a");
console.log(image_document)
for (var i = 0; i < image_document.length; i++) {
let text_list = image_document[i].href.split('.')
console.log("text_list",text_list)
Expand Down
4 changes: 2 additions & 2 deletions simpleui/templates/admin/includes/js-part.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/vue.min.js' %}"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/elementui/index.js' %}"></script>
{% else %}
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js"></script>
{% endif %}
2 changes: 1 addition & 1 deletion simpleui/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
</el-container>
</el-container>

<ul v-if="popup.show" class="el-dropdown-menu el-popper"
<ul v-if="popup.show" class="el-dropdown-menu el-popper" ref="popupmenu"
:style="{position: 'absolute',top: popup.top+'px',left: popup.left+'px'}" x-placement="top-end">
<li v-for="(item,index) in popup.menus" tabindex="-1" class="el-dropdown-menu__item"
@click="item.handler(popup.tab,item)"><i :class="item.icon"></i><span
Expand Down
17 changes: 9 additions & 8 deletions simpleui/templates/admin/submit_line.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% load i18n admin_urls simpletags%}
<div class="submit-row">
{% if '_popup' not in request.GET %}
<el-button type="button" icon="el-icon-arrow-left" @click="prev()"
<el-button type="button" icon="el-icon-arrow-left" onclick="prev()"
style="float: left;margin-right: 10px;margin-bottom: 10px;">
<span v-text="getLanuage('Go back')"></span>
</el-button>
{% endif %}
{% if show_delete_link %}
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
<el-button icon="el-icon-delete" type="danger" @click="del('{% add_preserved_filters delete_url %}')"
<el-button icon="el-icon-delete" type="danger" onclick="del('{% add_preserved_filters delete_url %}')"
style="float: left">{% trans "Delete" %}</el-button>
{% endif %}
{% if show_save_as_new %}
Expand All @@ -31,20 +31,21 @@
</div>
<script type="text/javascript">
var submitrows=document.getElementsByClassName('submit-row');
function del(url){
window.location.href = url;
}
function prev() {
window.location.href='{% get_model_url %}'
}

for(var i=0;i<submitrows.length;i++){
new Vue({
el: submitrows[i],
data: {},
methods: {
del: function (url) {
window.location.href = url;
},
formSubmit: function (name, v, e) {
$("#actionName").attr('name', name).val(v);
$("form").submit();
},
prev: function () {
window.location.href='{% get_model_url %}'
}
}
})
Expand Down
4 changes: 4 additions & 0 deletions simpleui/templatetags/simpletags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 39801dd

Please sign in to comment.