# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.views.generic import TemplateView
from shuup.apps.provides import get_provide_objects
[docs]class DashboardViewMixin(object):
[docs] def get_context_data(self, **kwargs):
context = super(DashboardViewMixin, self).get_context_data(**kwargs)
menu_items = self.get_menu_items()
context["menu_items"] = menu_items
selected_item = None
for item in menu_items:
if self.request.path.startswith(item.url):
selected_item = item
context["selected_item"] = selected_item
return context
[docs]class DashboardView(DashboardViewMixin, TemplateView):
template_name = "shuup/front/dashboard/dashboard.jinja"