Skip to content

Commit f37f8da

Browse files
author
mominur-helios
committed
highlight current page
1 parent d9917ba commit f37f8da

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

apps/charts/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
# Create your views here.
55

66
def index(request):
7-
return render(request, 'pages/apps/charts.html')
7+
context = {
8+
'segment' : 'charts',
9+
'parent' : 'apps',
10+
}
11+
return render(request, 'pages/apps/charts.html', context)

apps/tables/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
# Create your views here.
55

66
def datatables(request):
7-
return render(request, 'pages/apps/datatables.html')
7+
context = {
8+
'segment' : 'datatables',
9+
'parent' : 'apps',
10+
}
11+
return render(request, 'pages/apps/datatables.html', context)

apps/tasks/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def tasks(request):
3333
'cfgError' : ErrInfo,
3434
'tasks' : get_celery_all_tasks(),
3535
'scripts' : scripts,
36-
'segment' : 'tasks'
36+
'segment' : 'tasks',
37+
'parent' : 'apps',
3738
}
3839

3940
# django_celery_results_task_result

apps/users/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def profile(request):
6565

6666
context = {
6767
'form': form,
68+
'segment': 'profile',
6869
}
6970
return render(request, 'pages/dashboard/profile.html', context)
7071

home/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
def index(request):
77

8-
context = {}
8+
context = {
9+
'segment': 'dashboard',
10+
}
911
return render(request, "pages/dashboard/index.html", context)
1012

1113
def starter(request):

templates/includes/sidebar.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</li>
2727
<li>
2828
<a href="/"
29-
class="flex items-center p-2 text-base text-gray-900 rounded-lg hover:bg-gray-100 group dark:text-gray-200 dark:hover:bg-gray-700 ">
29+
class="flex items-center p-2 text-base text-gray-900 rounded-lg hover:bg-gray-100 group dark:text-gray-200 dark:hover:bg-gray-700 {% if 'dashboard' in segment %} bg-gray-100 dark:bg-gray-700 {% endif %}">
3030
<svg class="w-6 h-6 text-gray-500 transition duration-75 group-hover:text-gray-900 dark:text-gray-400 dark:group-hover:text-white"
3131
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
3232
<path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path>
@@ -52,7 +52,7 @@
5252
{% else %}
5353
<li>
5454
<a href="{% url 'profile' %}"
55-
class="flex items-center p-2 text-base text-gray-900 rounded-lg hover:bg-gray-100 group dark:text-gray-200 dark:hover:bg-gray-700 ">
55+
class="flex items-center p-2 text-base text-gray-900 rounded-lg hover:bg-gray-100 group dark:text-gray-200 dark:hover:bg-gray-700 {% if 'profile' in segment %} bg-gray-100 dark:bg-gray-700 {% endif %}">
5656
<svg class="w-6 h-6 text-gray-500 dark:text-white" aria-hidden="true"
5757
xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
5858
<path
@@ -66,7 +66,7 @@
6666
{% endif %}
6767
<li>
6868
<button type="button"
69-
class="flex items-center w-full p-2 text-base text-gray-900 transition duration-75 rounded-lg group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700"
69+
class="flex items-center w-full p-2 text-base text-gray-900 transition duration-75 rounded-lg group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700 {% if 'apps' in parent %} bg-gray-100 dark:bg-gray-700 {% endif %}"
7070
aria-controls="dropdown-dashboard" data-collapse-toggle="dropdown-dashboard">
7171
<svg class="w-6 h-6 text-gray-500 dark:text-white" aria-hidden="true"
7272
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 18">
@@ -82,18 +82,18 @@
8282
clip-rule="evenodd"></path>
8383
</svg>
8484
</button>
85-
<ul id="dropdown-dashboard" class="hidden py-2 space-y-2">
85+
<ul id="dropdown-dashboard" class="py-2 space-y-2 {% if 'apps' in parent %}block {% else %} hidden {% endif %}">
8686
<li>
8787
<a href="{% url 'tasks' %}"
88-
class="flex items-center p-2 text-base text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700">Tasks</a>
88+
class="flex items-center p-2 text-base text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700 {% if 'tasks' in segment %} bg-gray-100 dark:bg-gray-700 {% endif %}">Tasks</a>
8989
</li>
9090
<li>
9191
<a href="{% url 'charts' %}"
92-
class="flex items-center p-2 text-base text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700">Charts</a>
92+
class="flex items-center p-2 text-base text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700 {% if 'charts' in segment %} bg-gray-100 dark:bg-gray-700 {% endif %}">Charts</a>
9393
</li>
9494
<li>
9595
<a href="{% url 'datatables' %}"
96-
class="flex items-center p-2 text-base text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700">Datatables</a>
96+
class="flex items-center p-2 text-base text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700 {% if 'datatables' in segment %} bg-gray-100 dark:bg-gray-700 {% endif %}">Datatables</a>
9797
</li>
9898
<li>
9999
<a href="/api/product/"

0 commit comments

Comments
 (0)