Skip to content
Permalink
Browse files

Merge pull request #54 from newpanjing/dev

Dev
  • Loading branch information...
newpanjing committed May 23, 2019
2 parents 0e97fb2 + 26a8821 commit ea79d4c07a2705753fdb1d031ec86c5cbb70edd8
@@ -17,6 +17,7 @@ simpleui 快速上手指南
+ [自定义主题](#自定义主题)
+ [修改首页图标](#修改默认图标)
+ [修改默认首页](#修改默认首页)
+ [修复首页跳转地址](#修复首页跳转地址)
+ [修改LOGO](#修改LOGO)
+ [配置首页模块](#配置首页模块)
+ [服务器信息](#服务器信息)
@@ -178,6 +179,17 @@ simpleui内置了一个默认的首页,只是由简单的快捷导航与最近
三项配置都是选填,不填都会有默认值。 [图标列表](https://fontawesome.com/icons)

## 修复首页跳转地址
首页顶部首页图标默认跳转地址为/,即根目录。如果需要自定义,请在项目的settings.py中加入设置:

```python
# 设置simpleui 点击首页图标跳转的地址
SIMPLEUI_INDEX = 'https://www.88cto.com'
```

可以设置相对与绝对路径。该地址并无特殊之处,将会调用window.open直接打开该地址。


## 修改LOGO
+ 自定义SIMPLEUI的Logo
> SIMPLEUI_LOGO = 'https://avatars2.githubusercontent.com/u/13655483?s=60&v=4'
@@ -1,2 +1,2 @@
def get_version():
return '2.1'
return '2.1.1'
@@ -78,7 +78,7 @@
}
}, {
text: getLanuage('Close current'),
icon: 'el-icon-circle-close-outline',
icon: 'el-icon-circle-close',
handler: function (tab, item) {
app.handleTabsEdit(tab.id, 'remove');
}
@@ -354,8 +354,11 @@
});
}
,
goIndex: function () {
window.open('/');
goIndex: function (url) {
if (!url || url == 'None') {
url = '/';
}
window.open(url);
}
,
getLanuage: getLanuage,
@@ -17,6 +17,8 @@
<link rel="stylesheet" href="{% static '/admin/simpleui-x/css/base.css' %}?_=2.1">
<link rel="stylesheet" href="{% static '/admin/simpleui-x/theme/simpleui.css' %}">

{# <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>#}

<script type="text/javascript" src="{% static '/admin/simpleui-x/js/vue.min.js' %}"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/language.js' %}"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/locale/en-us.js' %}"></script>
@@ -61,7 +63,7 @@
{% verbatim dynamicCss %}
<style type="text/css" id="dynamicCss" v-if="fontSize!=0">
*{
font-size: {{ fontSize }}px;
font-size: {{ fontSize }}px!important;
}
</style>
{% endverbatim dynamicCss %}
@@ -36,11 +36,11 @@
</style>

{% verbatim dynamicCss %}
<style type="text/css" id="dynamicCss" v-if="fontSize!=0">
*{
font-size: {{ fontSize }}px;
}
</style>
<style type="text/css" id="dynamicCss" v-if="fontSize!=0">
* {
font-size: {{ fontSize }}px;
}
</style>
{% endverbatim dynamicCss %}
{% autoescape off %}
{% menus %}
@@ -52,21 +52,22 @@
<el-container :style="{height: height+'px'}">

<el-aside width="auto" class="menu">
<div class="logo-wrap" v-if="!fold">
<div class="float-wrap">
<div class="left">
{% if "SIMPLEUI_LOGO"|get_config %}
<img src="{{ "SIMPLEUI_LOGO"|get_config |safe }}">
{% else %}
<img src="{% static '/admin/simpleui-x/img/logo.png' %}">
{% endif %}
</div>
<div class="left">
<span>{{ site_header }}</span>
{% block logo %}
<div class="logo-wrap" v-if="!fold">
<div class="float-wrap">
<div class="left">
{% if "SIMPLEUI_LOGO"|get_config %}
<img src="{{ "SIMPLEUI_LOGO"|get_config |safe }}">
{% else %}
<img src="{% static '/admin/simpleui-x/img/logo.png' %}">
{% endif %}
</div>
<div class="left">
<span>{{ site_header }}</span>
</div>
</div>
</div>
</div>

{% endblock %}

<el-menu default-active="1" class="el-menu-vertical-demo" :default-active="menuActive" :collapse="fold">
<div v-for="(item,i) in menus" :key="item">
@@ -117,9 +118,10 @@
<el-button icon="fas fa-font" circle v-waves @click="fontClick()"></el-button>

<el-button
:icon="this.zoom?'fas fa-compress-arrows-alt':'fas fa-expand-arrows-alt'"
@click="goZoom()" circle></el-button>
<el-button icon="fas fa-home" @click="goIndex()" circle v-waves></el-button>
:icon="this.zoom?'fas fa-compress-arrows-alt':'fas fa-expand-arrows-alt'"
@click="goZoom()" circle></el-button>
<el-button icon="fas fa-home" @click="goIndex('{{ 'SIMPLEUI_INDEX'|get_config }}')" circle
v-waves></el-button>
{% verbatim mycode %}
<el-button @click="themeDialogVisible=true" v-waves>
<i class="fas fa-palette"></i>
@@ -140,7 +142,7 @@
@click.native="changePassword()">{{ language.change_password }}
</el-dropdown-item>
</el-dropdown-item>
<el-dropdown-item icon="el-icon-close"
<el-dropdown-item icon="el-icon-close"
@click.native="logout()"
divided>{{ language.logout }}</el-dropdown-item>
</el-dropdown-menu>
@@ -153,6 +155,10 @@
<el-tabs v-model="tabModel" type="border-card" editable style="height: 100%" @edit="handleTabsEdit"
@tab-click="tabClick">

{# <el-tab-pane :name="222">#}
{# <span slot="label"><i class="el-icon-date"></i> <el-button>测试</el-button></span>#}
{# </el-tab-pane>#}

<el-tab-pane v-for="(item,index) in tabs" :closable="index!=0" :label="item.name" :name="item.id"
:key="item.id">

@@ -184,6 +190,7 @@
</div>
</el-tab-pane>


</el-tabs>
</el-main>
</el-container>
@@ -207,7 +214,8 @@
:width="small?'90%':'50%'">

<div class="change-theme clearfix">
<div v-waves :class="{'theme-item':true,active:themeName==item.text}" v-for="(item,i) in themes" :key="item.text"
<div v-waves :class="{'theme-item':true,active:themeName==item.text}" v-for="(item,i) in themes"
:key="item.text"
:title="getLanuage(item.text)" @click="setTheme(item)">
<div class="theme-menu" :style="{background:item.menu}">
<div class="theme-logo" :style="{background: item.logo}"></div>
@@ -220,14 +228,14 @@
</el-dialog>


<el-dialog
:title="getLanuage('Set font size')"
:visible.sync="fontDialogVisible"
:width="small?'90%':'50%'">
<el-slider v-model="fontSlider" :min="12" :max="100" show-input @change="fontSlideChange"> </el-slider>
<div style="text-align: right;padding-top: 20px">
<el-button type="primary" @click="reset()" v-text="getLanuage('Reset')"></el-button>
</div>
<el-dialog
:title="getLanuage('Set font size')"
:visible.sync="fontDialogVisible"
:width="small?'90%':'50%'">
<el-slider v-model="fontSlider" :min="12" :max="100" show-input @change="fontSlideChange"></el-slider>
<div style="text-align: right;padding-top: 20px">
<el-button type="primary" @click="reset()" v-text="getLanuage('Reset')"></el-button>
</div>
</el-dialog>
</div>
<script type="text/javascript">
@@ -282,7 +290,7 @@
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/cookie.js' %}"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/theme/theme.js' %}"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/waves/waves.min.js' %}?_=2.0.5"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/index.js' %}?_=2.0.5"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/index.js' %}?_=2.1.1"></script>
{% load_analysis %}

{% block script %}
@@ -79,7 +79,7 @@
</div>

<script type="text/javascript" src="{% static '/admin/simpleui-x/js/vue.min.js' %}"></script>
<script src="https://unpkg.com/element-ui@2.7.2/lib/index.js"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/elementui/index.js' %}"></script>
<script type="text/javascript" src="{% static '/admin/simpleui-x/js/login.js' %}"></script>

</body>
@@ -45,6 +45,13 @@
name="{{ spec.field_generic }}gte"/>
<input type="hidden" v-model="{{ spec.field_generic }}lt"
name="{{ spec.field_generic }}lt"/>
{% elif spec|has_filter %}
<input type="hidden" v-model="{{ spec.parameter_name }}" name="{{ spec.parameter_name }}"/>
<el-select v-model="{{ spec.parameter_name }}" clearable placeholder="{{ spec.title }}">
{% for option in spec.lookup_choices %}
<el-option label="{{ option.1 }}" value="{{ option.0 }}"></el-option>
{% endfor %}
</el-select>

{% else %}

@@ -139,6 +146,8 @@
'{{ spec.field_path }}': '',
'{{ spec.field_generic }}gte': '',
'{{ spec.field_generic }}lt': '',
{% elif spec|has_filter %}
'{{ spec.parameter_name }}':'',
{% else %}
'{{ spec.lookup_kwarg }}': '',
{% endif %}
@@ -37,6 +37,10 @@ def load_dates(context):
cl = context.get('cl')
if cl.has_filters:
for spec in cl.filter_specs:
# 自定义的filter,没有field
if not hasattr(spec, 'field'):
continue

field = spec.field
field_type = None
if isinstance(field, models.DateTimeField):
@@ -53,6 +57,11 @@ def load_dates(context):
return '<script type="text/javascript">var searchDates={}</script>'.format(json.dumps(data))


@register.filter
def has_filter(spec):
return hasattr(spec, 'parameter_name')


@register.filter
def get_date_type(spec):
field = spec.field

0 comments on commit ea79d4c

Please sign in to comment.
You can’t perform that action at this time.