180 lines
4.9 KiB
Python
180 lines
4.9 KiB
Python
from django.views.generic import TemplateView
|
|
from web_project import TemplateLayout
|
|
from web_project.template_helpers.theme import TemplateHelper
|
|
|
|
|
|
"""
|
|
This file is a view controller for multiple pages as a module.
|
|
Here you can override the page view layout.
|
|
Refer to layouts/urls.py file for more pages.
|
|
"""
|
|
|
|
|
|
class CollapsedMenuView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"menu_collapsed": True,
|
|
}
|
|
)
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class ContentNavSidebarView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"is_flex": True,
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class VerticalView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"layout": "vertical",
|
|
"navbar_full": False,
|
|
"layout_path": TemplateHelper.set_layout(
|
|
"layout_vertical.html", context
|
|
),
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class HorizontalView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"layout": "horizontal",
|
|
"layout_path": TemplateHelper.set_layout(
|
|
"layout_horizontal.html", context
|
|
),
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class WithoutMenuView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"is_menu": False,
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class WithoutNavView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"is_navbar": False,
|
|
"navbar_type": "hidden",
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class FluidView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"content_layout": "wide",
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class ContainerView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"content_layout": "compact",
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|
|
|
|
|
|
class BlankView(TemplateView):
|
|
# Predefined function
|
|
def get_context_data(self, **kwargs):
|
|
# A function to init the global layout. It is defined in web_project/__init__.py file
|
|
context = TemplateLayout.init(self, super().get_context_data(**kwargs))
|
|
|
|
# Update the context
|
|
context.update(
|
|
{
|
|
"layout_path": TemplateHelper.set_layout("layout_blank.html", context),
|
|
}
|
|
)
|
|
|
|
TemplateHelper.map_context(context)
|
|
|
|
return context
|