Skip to content

Commit

Permalink
Merge pull request #73 from newpanjing/dev
Browse files Browse the repository at this point in the history
2.1.2
  • Loading branch information
newpanjing authored Jun 3, 2019
2 parents 184ef62 + d176b0a commit 52a8d68
Show file tree
Hide file tree
Showing 26 changed files with 2,762 additions and 221 deletions.
59 changes: 17 additions & 42 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
Copyright (c) <year> <copyright holders>
MIT License

"Anti 996" License Version 1.0 (Draft)
Copyright (c) 2017-present newpanjing

Permission is hereby granted to any individual or legal entity
obtaining a copy of this licensed work (including the source code,
documentation and/or related items, hereinafter collectively referred
to as the "licensed work"), free of charge, to deal with the licensed
work for any purpose, including without limitation, the rights to use,
reproduce, modify, prepare derivative works of, distribute, publish
and sublicense the licensed work, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

1. The individual or the legal entity must conspicuously display,
without modification, this License and the notice on each redistributed
or derivative copy of the Licensed Work.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

2. The individual or the legal entity must strictly comply with all
applicable laws, regulations, rules and standards of the jurisdiction
relating to labor and employment where the individual is physically
located or where the individual was born or naturalized; or where the
legal entity is registered or is operating (whichever is stricter). In
case that the jurisdiction has no such laws, regulations, rules and
standards or its laws, regulations, rules and standards are
unenforceable, the individual or the legal entity are required to
comply with Core International Labor Standards.

3. The individual or the legal entity shall not induce, suggest or force
its employee(s), whether full-time or part-time, or its independent
contractor(s), in any methods, to agree in oral or written form, to
directly or indirectly restrict, weaken or relinquish his or her
rights or remedies under such laws, regulations, rules and standards
relating to labor and employment as mentioned above, no matter whether
such written or oral agreements are enforceable under the laws of the
said jurisdiction, nor shall such individual or the legal entity
limit, in any methods, the rights of its employee(s) or independent
contractor(s) from reporting or complaining to the copyright holder or
relevant authorities monitoring the compliance of the license about
its violation(s) of the said license.

THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION WITH THE
LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
63 changes: 59 additions & 4 deletions QUICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ simpleui 快速上手指南
+ [如何下载这个模版](#如何下载这个模版)
+ [切换主题](#切换主题)
+ [图标说明](#图标说明)
+ [关闭登录页粒子动画](#关闭登录页粒子动画)
# 进阶指南
+ [自定义主题](#自定义主题)
+ [修改首页图标](#修改默认图标)
Expand All @@ -35,7 +36,7 @@ simpleui 快速上手指南
+ [重写页面](#重写页面)
+ [头部添加自定义代码](#头部添加自定义代码)
+ [底部添加自定义代码](#底部添加自定义代码)

+ [自定义按钮](#自定义按钮)
# 常见问题
+ [settings.py](#settingspy-找不到)
+ [python版本问题](#python版本问题)
Expand Down Expand Up @@ -108,6 +109,12 @@ DEBUG = True
## 图标说明
simpleui中显示的图标 可以参考[fontawesome](https://fontawesome.com/icons?d=gallery)的图标,只需要将完整的class名填入即可。

## 关闭登录页粒子动画
在项目的settings.py中加入
```python
SIMPLEUI_LOGIN_PARTICLES = False
```
粒子动画默认开启

## 自定义主题
在自定义主题之前,请先把simpleui的静态资源克隆到根目录。然后找到theme
Expand Down Expand Up @@ -236,6 +243,11 @@ SIMPLEUI_INDEX = 'https://www.88cto.com'
该字段用于告诉simpleui,是否需要保留系统默认的菜单,默认为False,不保留。
如果改为True,自定义和系统菜单将会并存

#### menu_display 过滤显示菜单和排序功能
该字段用于告诉simpleui,是否需要开启过滤显示菜单和排序功能。<br>
默认可以不用填写,缺省配置为默认排序,不对菜单进行过滤和排序。<br>
开启认为传一个列表,如果列表为空,则什么也不显示。列表中的每个元素要对应到menus里面的name字段

#### menus说明

|字段|说明|
Expand All @@ -249,6 +261,7 @@ SIMPLEUI_INDEX = 'https://www.88cto.com'
```python
SIMPLEUI_CONFIG = {
'system_keep':False,
'menu_display': ['Simpleui', '测试', '权限认证'], # 开启排序和过滤功能, 不填此字段为默认排序和全部显示, 空列表[] 为全部不显示.
'menus': [{
'name': 'Simpleui',
'icon': 'fas fa-code',
Expand Down Expand Up @@ -346,7 +359,7 @@ python setup.py sdist install
{% extends 'admin/index.html' %}
{% load static %}
{%block head}
{% block head %}
{{ block.super }}
..此处写你的代码
{% endblock %}
Expand Down Expand Up @@ -374,7 +387,7 @@ python setup.py sdist install
{% extends 'admin/index.html' %}
{% load static %}
{%block head}
{% block head %}
{{ block.super }}
..此处写你的代码
{% endblock %}
Expand All @@ -389,6 +402,48 @@ python setup.py sdist install
..此处写你的代码
{% endblock %}
```

## 自定义按钮
> 需要在2.1.2以上版本生效

django admin 默认提供了自定义按钮的支持,但是样式、图标均不可自定义,simpleui在django admin 自定义action的基础上增加了样式、图标、按钮类型自定义。

代码:
```python
@admin.register(Employe)
class EmployeAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'gender', 'idCard', 'phone', 'birthday', 'department', 'enable', 'create_time')
# 增加自定义按钮
actions = ['make_copy', 'custom_button']
def custom_button(self, request, queryset):
pass
# 显示的文本,与django admin一致
custom_button.short_description = '测试按钮'
# icon,参考element-ui icon与https://fontawesome.com
custom_button.icon = 'fas fa-audio-description'
# 指定element-ui的按钮类型,参考https://element.eleme.cn/#/zh-CN/component/button
custom_button.type = 'danger'
# 给按钮追加自定义的颜色
custom_button.style = 'color:black;'
def make_copy(self, request, queryset):
pass
make_copy.short_description = '复制员工'
```
该配置与原生admin兼容。
### 字段:

|字段|说明|
|------|------|
|icon|按钮图标,参考https://element.eleme.cn/#/zh-CN/component/icon与https://fontawesome.com,把class 复制进来即可|
|type|按钮类型,参考:https://element.eleme.cn/#/zh-CN/component/button|
|style|自定义css样式|

## 常见问题
### settings.py 找不到

Expand All @@ -410,4 +465,4 @@ python setup.py sdist install

参考连接:[https://blog.csdn.net/sun754276603/article/details/46989965](https://blog.csdn.net/sun754276603/article/details/46989965)

>其他更多问题,请提交[issues](https://github.com/newpanjing/simpleui/issues)给我们。
>其他更多问题,请提交[issues](https://github.com/newpanjing/simpleui/issues)给我们。
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ Simple and friendly.
Django admin theme the simpleui
</p>
<p align="center">
<a href="https://github.com/996icu/996.ICU/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-Anti%20996-blue.svg"></a>
 <a href="https://github.com/newpanjing/simpleui"><img src="https://img.shields.io/badge/developing%20with-Simpleui-2077ff.svg"></a>
<a href="https://github.com/newpanjing/simpleui/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
 <a href="https://pypi.org/project/django-simpleui/#history"><img src="https://img.shields.io/pypi/v/django-simpleui.svg"></a>
<a href="https://python.org"><img src="https://img.shields.io/badge/python->=3.7.x-green.svg"></a>
<a href="https://pypi.org/project/django-simpleui/">
<img src="https://img.shields.io/pypi/dm/django-simpleui.svg">
</a>
</p>


---
<p align="center">
中文 | <a href="./doc/en/README_en.md">English</a>
</p>

---
Expand Down Expand Up @@ -176,4 +184,16 @@ python setup.py sdist install
![](https://github.com/newpanjing/simpleui/raw/master/images/%E7%BC%96%E8%BE%91%E9%A1%B5.png)
# 设置字体大小
![](https://github.com/newpanjing/simpleui/raw/master/images/%E8%AE%BE%E7%BD%AE%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F.png)
![](https://github.com/newpanjing/simpleui/raw/master/images/%E8%AE%BE%E7%BD%AE%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F.png)
## 优质贡献者
simpleui的发展离不开以下优秀贡献者的支持。如果您想为simpleui贡献代码,请fork到自己仓库,然后发起合并请求,合并至dev分支。
|Github|贡献范围|
|------|------|
|[@zhangzhibo1014](https://github.com/zhangzhibo1014)|英文文档翻译|
|[@liaogx](https://github.com/liaogx)|bug修复|
|[@shouyong](https://github.com/shouyong)|bug修复|
|[@Roddy1219](https://github.com/Roddy1219)|bug修复|
|[@WalkerWang731](https://github.com/WalkerWang731)|优质代码贡献|
Loading

0 comments on commit 52a8d68

Please sign in to comment.