Skip to content

Commit b541ee7

Browse files
Merge pull request #14 from app-generator/dynamic-dt
Fix dynamic DT UI
2 parents 0630906 + 89b47ef commit b541ee7

File tree

8 files changed

+422
-421
lines changed

8 files changed

+422
-421
lines changed

apps/dyn_dt/routes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
def dynamic_dt():
1414
context = {
1515
'routes': config.Config.DYNAMIC_DATATB.keys(),
16-
'segment': 'dynamic_dt'
16+
'segment': 'dynamic_dt',
17+
'parent': 'dashboard',
1718
}
1819
return render_template('dyn_dt/index.html', **context)
1920

@@ -167,6 +168,7 @@ def model_dt(aPath):
167168
'fk_fields_keys': fk_fields.keys(),
168169
'fk_fields': fk_fields,
169170
'segment': 'dynamic_dt',
171+
'parent': 'dashboard',
170172
'choices_dict': choices_dict,
171173
'exclude_auto_gen_fields': exclude_auto_gen_fields(aModelClass)
172174
}

apps/home/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@blueprint.route('/')
1313
@blueprint.route('/index')
1414
def index():
15-
return render_template('pages/index.html', segment='dashboard')
15+
return render_template('pages/index.html', segment='dashboard', parent="dashboard")
1616

1717
@blueprint.route('/billing')
1818
def billing():

apps/static/assets/img/csv.png

9.51 KB
Loading

apps/static/assets/img/export.png

5.92 KB
Loading

apps/templates/dyn_dt/index.html

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,23 @@
77

88
{% block content %}
99

10-
<div class="pc-container">
11-
<div class="pc-content">
12-
<!-- [ breadcrumb ] start -->
13-
<div class="page-header">
14-
<div class="page-block">
15-
<div class="row align-items-center">
16-
<div class="col-md-12">
17-
<div class="page-header-title">
18-
<h5 class="mb-0">Profile</h5>
19-
</div>
20-
</div>
21-
<div class="col-md-12">
22-
<ul class="breadcrumb mb-0">
23-
<li class="breadcrumb-item"><a href="{{ url_for('home_blueprint.index') }}">Home</a></li>
24-
<li class="breadcrumb-item"><a href="javascript: void(0)">Basic UI</a></li>
25-
<li class="breadcrumb-item" aria-current="page">Profile</li>
26-
</ul>
27-
</div>
28-
</div>
29-
</div>
30-
</div>
31-
<!-- [ breadcrumb ] end -->
3210

33-
<div class="row">
34-
<div class="col-sm-12">
35-
<div class="card">
36-
<div class="card-header">
37-
<h5>Available Routes (defined in config.DYNAMIC_DATATB)</h5>
38-
</div>
39-
<div class="card-block px-4">
40-
<ul class="pc-submenu mt-3">
41-
{% for link in routes %}
42-
<li class="pc-item">
43-
<a class="pc-link" href="{{ url_for('table_blueprint.model_dt', aPath=link) }}">{{ link }}</a>
44-
</li>
45-
{% endfor %}
46-
</ul>
47-
48-
</div>
11+
<div class="container-fluid py-4">
12+
<div class="row">
13+
<div class="col-sm-12">
14+
<div class="card">
15+
<div class="card-header p-2 ps-3">
16+
<h4 class="mb-0">Available Routes (defined in config.DYNAMIC_DATATB)</h4>
17+
</div>
18+
<div class="card-body">
19+
<ul class="">
20+
{% for link in routes %}
21+
<li class="">
22+
<a class="" href="{{ url_for('table_blueprint.model_dt', aPath=link) }}">{{ link }}</a>
23+
</li>
24+
{% endfor %}
25+
</ul>
26+
4927
</div>
5028
</div>
5129
</div>

apps/templates/dyn_dt/model.html

Lines changed: 358 additions & 379 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
<div class="dt-responsive table-responsive">
3+
<table class="table">
4+
<thead>
5+
<tr>
6+
{% for field in db_field_names %}
7+
<th id="th_{{ field }}_export" class="px-0" scope="col">{{ field }}</th>
8+
{% endfor %}
9+
</tr>
10+
</thead>
11+
<tbody>
12+
{% for item in items %}
13+
<tr>
14+
{% for field_name in db_field_names %}
15+
{% if field_name in choices_dict %}
16+
<td class="td_{{ field_name }} px-0">{{ item|getenumattribute(field_name) }}</td>
17+
{% else %}
18+
<td class="td_{{ field_name }} px-0">{{ item|getattribute(field_name) }}</td>
19+
{% endif %}
20+
{% endfor %}
21+
</tr>
22+
{% endfor %}
23+
</tbody>
24+
</table>
25+
</div>

apps/templates/includes/sidebar.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<ul class="navbar-nav">
1212

1313
<li class="nav-item">
14-
<a class="nav-link {% if segment == 'dashboard' %}active{% endif %}" href="{{ url_for('home_blueprint.index') }}">
15-
<div class="icon icon-shape icon-sm shadow border-radius-md bg-white text-center me-2 d-flex align-items-center justify-content-center">
14+
<a data-bs-toggle="collapse" href="#dashboard-dropdown" class="nav-link {% if 'dashboard' in parent %}active{% endif %}" aria-controls="dashboard-dropdown" role="button" aria-expanded="false">
15+
<div class="icon icon-shape icon-sm shadow border-radius-md bg-white text-center d-flex align-items-center justify-content-center me-2">
1616
<svg width="12px" height="12px" viewBox="0 0 45 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
1717
<title>shop </title>
1818
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
@@ -29,7 +29,24 @@
2929
</div>
3030
<span class="nav-link-text ms-1">Dashboard</span>
3131
</a>
32+
<div class="collapse {% if 'dashboard' in parent %}show{% endif %} " id="dashboard-dropdown">
33+
<ul class="nav ms-4 ps-3">
34+
<li class="nav-item {% if 'dashboard' in segment %}active{% endif %}">
35+
<a class="nav-link {% if 'dashboard' in segment %}active{% endif %}" href="{{ url_for('home_blueprint.index') }}">
36+
<span class="sidenav-mini-icon"> D </span>
37+
<span class="sidenav-normal"> Default </span>
38+
</a>
39+
</li>
40+
<li class="nav-item {% if 'dynamic_dt' in segment %}active{% endif %}">
41+
<a class="nav-link {% if 'dynamic_dt' in segment %}active{% endif %}" href="{{ url_for('table_blueprint.dynamic_dt') }}">
42+
<span class="sidenav-mini-icon"> D </span>
43+
<span class="sidenav-normal"> Dynamic DT </span>
44+
</a>
45+
</li>
46+
</ul>
47+
</div>
3248
</li>
49+
3350
<li class="nav-item">
3451
<a class="nav-link {% if segment == 'tables' %}active{% endif %}" href="{{ url_for('home_blueprint.tables') }}">
3552
<div class="icon icon-shape icon-sm shadow border-radius-md bg-white text-center me-2 d-flex align-items-center justify-content-center">

0 commit comments

Comments
 (0)