Example #1
0
 def get(self, request, *args, **kwargs):
     try_send_telemetry(request)
     if not setup_wizard_complete():
         return HttpResponseRedirect(reverse("shuup_admin:wizard"))
     elif request.shop.maintenance_mode:
         return HttpResponseRedirect(reverse("shuup_admin:home"))
     return super(DashboardView, self).get(request, *args, **kwargs)
Example #2
0
 def get(self, request, *args, **kwargs):
     try_send_telemetry(request)
     if not setup_wizard_complete(request):
         return HttpResponseRedirect(reverse("shuup_admin:wizard"))
     elif request.shop.maintenance_mode:
         return HttpResponseRedirect(reverse("shuup_admin:home"))
     return super(DashboardView, self).get(request, *args, **kwargs)
Example #3
0
File: home.py Project: carles/shuup
    def get_context_data(self, **kwargs):
        context = super(HomeView, self).get_context_data(**kwargs)
        context["blocks"] = blocks = []
        context["tour_key"] = "home"
        context["tour_complete"] = is_tour_complete(get_shop(self.request), "home")
        wizard_complete = setup_wizard_complete(self.request)

        wizard_url = reverse("shuup_admin:wizard")
        wizard_actions = []
        if not wizard_complete:
            wizard_actions.append({
                "text": _("Complete wizard"),
                "url": wizard_url
            })
        else:
            wizard_steps = load_setup_wizard_panes(
                shop=self.request.shop, request=self.request, visible_only=False)
            for step in wizard_steps:
                wizard_actions.append({
                    "text": step.title,
                    "url": "%s?pane_id=%s" % (wizard_url, step.identifier),
                    "no_redirect": True
                })

        blocks.append(
            SimpleHelpBlock(
                _("Complete the setup wizard"),
                actions=wizard_actions,
                icon_url="shuup_admin/img/configure.png",
                priority=-1,
                done=wizard_complete
            )
        )

        for module in get_modules():
            if not get_missing_permissions(self.request.user, module.get_required_permissions()):
                blocks.extend(module.get_help_blocks(request=self.request, kind="setup"))
        blocks.sort(key=lambda b: b.priority)
        blocks.append(
            SimpleHelpBlock(
                priority=1000,
                text=_("Publish your store"),
                description=_("Let customers browse your store and make purchases"),
                css_class="green ",
                actions=[{
                    "method": "POST",
                    "text": _("Publish shop"),
                    "url": reverse("shuup_admin:shop.enable", kwargs={"pk": self.request.shop.pk}),
                    "data": {
                        "enable": True,
                        "redirect": reverse("shuup_admin:dashboard")
                    }
                }],
                icon_url="shuup_admin/img/publish.png",
                done=not self.request.shop.maintenance_mode
            )
        )
        return context
Example #4
0
    def get_context_data(self, **kwargs):
        context = super(HomeView, self).get_context_data(**kwargs)
        context["blocks"] = blocks = []
        context["tour_key"] = "home"
        context["tour_complete"] = is_tour_complete("home")
        wizard_complete = setup_wizard_complete()

        wizard_url = reverse("shuup_admin:wizard")
        wizard_actions = []
        if not wizard_complete:
            wizard_actions.append({
                "text": _("Complete wizard"),
                "url": wizard_url
            })
        else:
            wizard_steps = load_setup_wizard_panes(
                shop=Shop.objects.first(), request=self.request, visible_only=False)
            for step in wizard_steps:
                wizard_actions.append({
                    "text": step.title,
                    "url": "%s?pane_id=%s" % (wizard_url, step.identifier),
                    "no_redirect": True
                })

        blocks.append(
            SimpleHelpBlock(
                _("Complete the setup wizard"),
                actions=wizard_actions,
                icon_url="shuup_admin/img/configure.png",
                priority=-1,
                done=wizard_complete
            )
        )

        for module in get_modules():
            if not get_missing_permissions(self.request.user, module.get_required_permissions()):
                blocks.extend(module.get_help_blocks(request=self.request, kind="setup"))
        blocks.sort(key=lambda b: b.priority)
        blocks.append(
            SimpleHelpBlock(
                priority=1000,
                text=_("Publish your store"),
                description=_("Let customers browse your store and make purchases"),
                css_class="green",
                actions=[{
                    "method": "POST",
                    "text": _("Publish shop"),
                    "url": reverse("shuup_admin:shop.enable", kwargs={"pk": self.request.shop.pk}),
                    "data": {
                        "enable": True,
                        "redirect": reverse("shuup_admin:dashboard")
                    }
                }],
                icon_url="shuup_admin/img/publish.png"
            )
        )
        return context
Example #5
0
    def get_context_data(self, **kwargs):
        context = super(HomeView, self).get_context_data(**kwargs)
        shop = get_shop(self.request)
        context["blocks"] = blocks = []
        context["tour_key"] = "home"
        context["tour_complete"] = is_tour_complete(shop,
                                                    "home",
                                                    user=self.request.user)

        wizard_complete = setup_wizard_complete(self.request)
        wizard_url = reverse("shuup_admin:wizard")
        wizard_actions = []
        if not wizard_complete:
            wizard_actions.append({
                "text": _("Complete wizard"),
                "url": wizard_url
            })
        else:
            wizard_steps = load_setup_wizard_panes(shop=shop,
                                                   request=self.request,
                                                   visible_only=False)
            for step in wizard_steps:
                wizard_actions.append({
                    "text":
                    step.title,
                    "url":
                    "%s?pane_id=%s" % (wizard_url, step.identifier),
                    "no_redirect":
                    True
                })

        if wizard_actions:
            blocks.append(
                SimpleHelpBlock(_("Complete the setup wizard"),
                                actions=wizard_actions,
                                icon_url="shuup_admin/img/configure.png",
                                priority=-1,
                                done=wizard_complete))

        for module in get_modules():
            if not get_missing_permissions(self.request.user,
                                           module.get_required_permissions()):
                blocks.extend(
                    module.get_help_blocks(request=self.request, kind="setup"))
        blocks.sort(key=lambda b: b.priority)

        if not blocks:
            blocks.append(
                SimpleHelpBlock(_("All set. Nothing to be configured"),
                                actions=[],
                                icon_url="shuup_admin/img/configure.png",
                                priority=-1,
                                done=True))

        return context
Example #6
0
    def get_context_data(self, **kwargs):
        context = super(HomeView, self).get_context_data(**kwargs)
        shop = get_shop(self.request)
        context["blocks"] = blocks = []
        context["tour_key"] = "home"
        context["tour_complete"] = is_tour_complete(shop, "home", user=self.request.user)

        wizard_complete = setup_wizard_complete(self.request)
        wizard_url = reverse("shuup_admin:wizard")
        wizard_actions = []
        if not wizard_complete:
            wizard_actions.append({
                "text": _("Complete wizard"),
                "url": wizard_url
            })
        else:
            wizard_steps = load_setup_wizard_panes(shop=shop, request=self.request, visible_only=False)
            for step in wizard_steps:
                wizard_actions.append({
                    "text": step.title,
                    "url": "%s?pane_id=%s" % (wizard_url, step.identifier),
                    "no_redirect": True
                })

        if wizard_actions:
            blocks.append(
                SimpleHelpBlock(
                    _("Complete the setup wizard"),
                    actions=wizard_actions,
                    icon_url="shuup_admin/img/configure.png",
                    priority=-1,
                    done=wizard_complete
                )
            )

        for module in get_modules():
            if not get_missing_permissions(self.request.user, module.get_required_permissions()):
                blocks.extend(module.get_help_blocks(request=self.request, kind="setup"))
        blocks.sort(key=lambda b: b.priority)

        if not blocks:
            blocks.append(
                SimpleHelpBlock(
                    _("All set. Nothing to be configured"),
                    actions=[],
                    icon_url="shuup_admin/img/configure.png",
                    priority=-1,
                    done=True
                )
            )

        return context
Example #7
0
    def get_context_data(self, **kwargs):
        context = super(HomeView, self).get_context_data(**kwargs)
        context["blocks"] = blocks = []
        context["tour_key"] = "home"
        context["tour_complete"] = is_tour_complete("home")
        wizard_complete = setup_wizard_complete()
        blocks.append(
            SimpleHelpBlock(_("Complete the setup wizard"),
                            actions=[{
                                "text": _("Complete wizard"),
                                "url": reverse("shuup_admin:wizard")
                            }] if not wizard_complete else [],
                            icon_url="shuup_admin/img/configure.png",
                            priority=-1,
                            done=wizard_complete))

        for module in get_modules():
            if not get_missing_permissions(self.request.user,
                                           module.get_required_permissions()):
                blocks.extend(
                    module.get_help_blocks(request=self.request, kind="setup"))
        blocks.sort(key=lambda b: b.priority)
        blocks.append(
            SimpleHelpBlock(
                priority=1000,
                text=_("Publish your store"),
                description=_(
                    "Let customers browse your store and make purchases"),
                css_class="green",
                actions=[{
                    "method":
                    "POST",
                    "text":
                    _("Publish shop"),
                    "url":
                    reverse("shuup_admin:shop.enable",
                            kwargs={"pk": self.request.shop.pk}),
                    "data": {
                        "enable": True,
                        "redirect": reverse("shuup_admin:dashboard")
                    }
                }],
                icon_url="shuup_admin/img/publish.png"))
        return context