Skip to content

Commit

Permalink
admin
Browse files Browse the repository at this point in the history
  • Loading branch information
moogoo78 committed May 5, 2024
1 parent 182c035 commit ca8d130
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
4 changes: 4 additions & 0 deletions app/blueprints/admin_register.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from sqlalchemy import (
desc,
)
from app.models.site import (
Article,
ArticleCategory,
Expand Down Expand Up @@ -64,6 +67,7 @@
'resource_name': 'articles',
'model': Article,
'filter_by': 'organization',
'list_query': Article.query.order_by(desc(Article.publish_date)),
'fields': {
'subject': { 'label': '標題' },
'content': { 'label': '內容', 'type': 'textarea'},
Expand Down
21 changes: 4 additions & 17 deletions app/templates/admin/list-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,6 @@
</ul>
</nav>

{% if register.query %}
<div>
<form method="get" action="{{ url_for('admin.'+register.name+'-list')}}">
<div class="uk-inline uk-width-large">
<button id="" type="submit" class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></button>
<input type="search" name="q" class="search-input uk-input" autocapitalize="none" autocorrect="off" autocomplete="off" value="{%if request.args.q %}{{ request.args.q }}{% endif%}"/>
</div>
<div class="uk-text-meta">keyword: 館號、物種、採集者、採集號</div>
</form>
<p>Results: {{ "{:,}".format(total) }}</p>
</div>
{% endif %}

{% if register.list_collection_filter %}
{% include "admin/inc_collection_query_buttons.html" %}
{% endif %}

{% if register.list_filter %}
<form method="get" action="{{ url_for('admin.'+register.name+'-list')}}">
<div class="uk-inline uk-width-large">
Expand All @@ -35,6 +18,10 @@
</form>
{% endif %}

{% if register.list_collection_filter %}
{% include "admin/inc_collection_query_buttons.html" %}
{% endif %}

<div class="uk-flex uk-flex-left">
<a href="{{ url_for('admin.'+register.name+'-create')}}" class="uk-button uk-button-default">新增</a>
</div>
Expand Down

0 comments on commit ca8d130

Please sign in to comment.