Skip to content

Commit

Permalink
Merge pull request #103 from newpanjing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
newpanjing authored Jun 27, 2019
2 parents 721ec19 + 53ecef3 commit d00431f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
10 changes: 9 additions & 1 deletion QUICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ simpleui 快速上手指南
+ [底部添加自定义代码](#底部添加自定义代码)
+ [自定义按钮](#自定义按钮)
+ [离线模式](#离线模式)

+ [关闭Loading遮罩层](#关闭Loading遮罩层)
# 常见问题
+ [settings.py](#settingspy-找不到)
+ [python版本问题](#python版本问题)
Expand Down Expand Up @@ -472,6 +472,14 @@ SIMPLEUI_STATIC_OFFLINE = True
指定simpleui 是否以脱机模式加载静态资源,为True的时候将默认从本地读取所有资源,即使没有联网一样可以。适合内网项目

不填该项或者为False的时候,默认从第三方的cdn获取
## 关闭Loading遮罩层
> 在2.1.5或以上的版本中生效

在settings.py中加入
```python
SIMPLEUI_LOADING = False
```
True或None 默认显示加载遮罩层,指定为False 不显示遮罩层。默认显示

## 常见问题
### settings.py 找不到
Expand Down
11 changes: 10 additions & 1 deletion doc/en/QUICK_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Before starting,please take a minte to understand **settings.py**, because it'
+ [Custom code to Footer](#Custom%2dcode%2dto%2dFooter)
+ [Custom Action](#Custom%2dAction)
+ [Offline](#Offline)

+ [Close Loading](#Close%2dLoading)
# Common Problems
+ [settings.py](#Not%2dfound%2dsettings.py)
+ [python version problem](#python%2dversion%2dproblem)
Expand Down Expand Up @@ -443,6 +443,15 @@ Specifies whether simpleui loads static resources in offline mode. When true, al

If you do not fill in the item or are false, the default is obtained from the third-party CDN.

## Close Loading

> Requires version 2.1.5 or above

settings.py:
```python
SIMPLEUI_LOADING = False
```

## Common Problems
### Not found settings.py

Expand Down
4 changes: 2 additions & 2 deletions simpleui/templates/admin/actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<input type="hidden" name="select_across" v-model="select_across" value="0" class="select-across">
<input type="hidden" name="file_format" v-model="file_format">
{% if field.0 == 'export_admin_action' %}
<el-select v-model="file_format" style="width: 80px;">
<el-select filterable v-model="file_format" style="width: 80px;">
<el-option
v-for="item in options"
:key="item.value"
Expand All @@ -42,7 +42,7 @@

{% if cl.formset and cl.result_count %}
<input type="hidden" name="_save" value="{% trans 'Save' %}"/>
<el-button icon="el-icon-circle-check-outline" type="success"
<el-button icon="el-icon-circle-check" type="success"
@click="formSubmit()">{% trans 'Save' %}</el-button>
{% endif %}

Expand Down
13 changes: 8 additions & 5 deletions simpleui/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,15 @@
</div>
<div v-else class="iframe-wrap">
<iframe :src="item.url" :id="item.id" @load="iframeLoad(item,$event)"></iframe>
<div v-if="loading" class="loading" @dblclick="loading=false">
<div class="center">
<span class="el-icon-loading"></span>
<span>loading...</span>
{% if "SIMPLEUI_LOADING"|get_config != False %}
<div v-if="loading" class="loading" @dblclick="loading=false">
<div class="center">
<span class="el-icon-loading"></span>
<span>loading...</span>
</div>
</div>
</div>
{% endif %}

</div>
</el-tab-pane>

Expand Down
5 changes: 3 additions & 2 deletions simpleui/templates/admin/search_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{% autoescape off %}
{% load_dates %}
{% endautoescape %}
<!-- search_form.html -->
<div id="toolbar">
<form id="changelist-search" method="get" onsubmit="preSubmit(this)">
<input type="hidden" name="p" value=""/>
Expand Down Expand Up @@ -48,7 +49,7 @@
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 }}">
<el-select filterable 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 %}
Expand All @@ -57,7 +58,7 @@
{% else %}

<input type="hidden" v-model="{{ spec.lookup_kwarg }}" name="{{ spec.lookup_kwarg }}"/>
<el-select v-model="{{ spec.lookup_kwarg }}" clearable
<el-select filterable v-model="{{ spec.lookup_kwarg }}" clearable
placeholder="{{ spec.title }}">
{% if spec|get_date_type == 'time' %}
{% for option in spec.lookup_choices %}
Expand Down
25 changes: 11 additions & 14 deletions simpleui/templatetags/simpletags.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,20 +349,17 @@ def load_analysis(context):
def custom_button(context):
admin = context.get('cl').model_admin
data = {}
if hasattr(admin, 'actions'):
actions = admin.actions
# 输出自定义按钮的属性
for name in actions:
# __name__
if type(name) != str:
if type(name).__name__ == 'function':
name = name.__name__
values = {}
fun = getattr(admin, name)
for key, v in fun.__dict__.items():
if key != '__len__':
values[key] = v
data[name] = values
actions = admin.get_actions(context.request)
# if hasattr(admin, 'actions'):
# actions = admin.actions
# 输出自定义按钮的属性
for name in actions:
values = {}
fun = actions.get(name)[0]
for key, v in fun.__dict__.items():
if key != '__len__':
values[key] = v
data[name] = values
return json.dumps(data, cls=LazyEncoder)


Expand Down

0 comments on commit d00431f

Please sign in to comment.