Esempio n. 1
0
 def __init__(self, view_object):
     super(Toolbar, self).__init__()
     self.view_object = view_object
     get_default_edit_toolbar(toolbar=self, view_object=view_object, save_form_id="method_form")
     method = view_object.object
     if method.pk:
         self.build_detail_button(method)
Esempio n. 2
0
    def __init__(self, view):
        super(ProductVariationViewToolbar, self).__init__()
        self.view = view
        self.parent_product = view.object
        self.request = view.request
        get_default_edit_toolbar(self.view, "product_form", with_split_save=False, toolbar=self)

        if self.parent_product.variation_children.exists():
            self.append(PostActionButton(
                post_url=self.request.path,
                name="command",
                value="unvariate",
                confirm=_("Are you sure? This will unlink all children and remove all variation variables."),
                text=_("Clear variation"),
                extra_css_class="btn-danger",
                icon="fa fa-times"
            ))
        if (
            self.parent_product.mode == ProductMode.VARIABLE_VARIATION_PARENT or
            ProductVariationVariable.objects.filter(product=self.parent_product).exists()
        ):
            self.append(PostActionButton(
                post_url=self.request.path,
                name="command",
                value="simplify",
                confirm=_("Are you sure? This will remove all variation variables, "
                          "converting children to direct links."),
                text=_("Convert to simple variation"),
                icon="fa fa-exchange",
                extra_css_class="btn-info"
            ))
Esempio n. 3
0
    def __init__(self, view):
        super(ProductVariationViewToolbar, self).__init__()
        self.view = view
        self.parent_product = view.object
        self.request = view.request
        get_default_edit_toolbar(self.view,
                                 "product_form",
                                 with_split_save=False,
                                 toolbar=self)

        if self.parent_product.variation_children.exists():
            self.append(
                PostActionButton(
                    post_url=self.request.path,
                    name="command",
                    value="unvariate",
                    confirm=
                    _("Are you sure? This will unlink all children and remove all variation variables."
                      ),
                    text=_("Clear variation"),
                    extra_css_class="btn-danger",
                    icon="fa fa-minus"))
        if (self.parent_product.mode == ProductMode.VARIABLE_VARIATION_PARENT
                or ProductVariationVariable.objects.filter(
                    product=self.parent_product).exists()):
            self.append(
                PostActionButton(
                    post_url=self.request.path,
                    name="command",
                    value="simplify",
                    confirm=_(
                        "Are you sure? This will remove all variation variables, "
                        "converting children to direct links."),
                    text=_("Convert to simple variation"),
                    icon="fa fa-minus"))
Esempio n. 4
0
 def __init__(self, view_object):
     super(Toolbar, self).__init__()
     self.view_object = view_object
     get_default_edit_toolbar(toolbar=self,
                              view_object=view_object,
                              save_form_id="method_form")
     method = view_object.object
     if method.pk:
         self.build_detail_button(method)
Esempio n. 5
0
 def __init__(self, view):
     super(ProductParentBaseToolbar, self).__init__()
     self.view = view
     self.parent_product = view.object
     self.request = view.request
     get_default_edit_toolbar(self.view,
                              "product_form",
                              with_split_save=False,
                              toolbar=self)
Esempio n. 6
0
 def get_toolbar(self):
     toolbar = get_default_edit_toolbar(self,
                                        "change_password_form",
                                        discard_url=get_model_url(
                                            self.object),
                                        with_split_save=False)
     return toolbar
Esempio n. 7
0
 def get_toolbar(self):
     toolbar = get_default_edit_toolbar(self,
                                        "permissions_form",
                                        discard_url=get_model_url(
                                            self.object),
                                        with_split_save=False)
     return toolbar
Esempio n. 8
0
 def __init__(self, view):
     self.view = view
     self.request = view.request
     self.user = view.object
     super(UserDetailToolbar, self).__init__()
     self.extend(get_default_edit_toolbar(self.view, "user_form", with_split_save=False))
     if self.user.pk:
         self._build_existing_user()
Esempio n. 9
0
 def get_toolbar(self):
     toolbar = get_default_edit_toolbar(
         self,
         self.get_save_form_id(),
         discard_url=(get_model_url(self.object)
                      if self.object.pk else None))
     # TODO: Add extensibility
     return toolbar
Esempio n. 10
0
 def get_toolbar(self):
     toolbar = get_default_edit_toolbar(
         self,
         "permissions_form",
         discard_url=get_model_url(self.object),
         with_split_save=False
     )
     return toolbar
Esempio n. 11
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     object = self.get_object()
     delete_url = reverse_lazy("shoop_admin:service_provider.delete",
                               kwargs={"pk": object.pk})
     return get_default_edit_toolbar(self,
                                     save_form_id,
                                     delete_url=delete_url)
Esempio n. 12
0
 def get_toolbar(self):
     toolbar = get_default_edit_toolbar(
         self,
         "change_password_form",
         discard_url=get_model_url(self.object),
         with_split_save=False
     )
     return toolbar
Esempio n. 13
0
 def get_toolbar(self):
     toolbar = get_default_edit_toolbar(
         self,
         self.get_save_form_id(),
         discard_url=(get_model_url(self.object) if self.object.pk else None)
     )
     # TODO: Add extensibility
     return toolbar
Esempio n. 14
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     object = self.get_object()
     delete_url = get_model_url(object, "delete") if object.pk else None
     return get_default_edit_toolbar(
         self,
         save_form_id,
         delete_url=(delete_url if object.can_delete() else None))
Esempio n. 15
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     object = self.get_object()
     delete_url = reverse_lazy("shoop_admin:contact-group.delete",
                               kwargs={"pk": object.pk})
     return get_default_edit_toolbar(
         self,
         save_form_id,
         delete_url=delete_url if object.can_delete() else None)
Esempio n. 16
0
 def __init__(self, view):
     super(EditProductToolbar, self).__init__()
     self.view = view
     self.request = view.request
     self.product = view.object
     self.extend(get_default_edit_toolbar(
         self.view, "product_form",
         delete_url="shoop_admin:product.delete"
     ))
     if self.product.pk:
         self._build_existing_product()
Esempio n. 17
0
 def __init__(self, view):
     super(EditProductToolbar, self).__init__()
     self.view = view
     self.request = view.request
     self.product = view.object
     self.extend(
         get_default_edit_toolbar(self.view,
                                  "product_form",
                                  delete_url="shoop_admin:product.delete"))
     if self.product.pk:
         self._build_existing_product()
Esempio n. 18
0
 def __init__(self, view):
     self.view = view
     self.request = view.request
     self.user = view.object
     super(UserDetailToolbar, self).__init__()
     self.extend(
         get_default_edit_toolbar(self.view,
                                  "user_form",
                                  with_split_save=False))
     if self.user.pk:
         self._build_existing_user()
Esempio n. 19
0
    def get_toolbar(self):
        product = self.object
        toolbar = get_default_edit_toolbar(
            self, "product_form", delete_url="shoop_admin:product.delete")
        if product.pk:
            toolbar.append(
                URLActionButton(text=_("Manage Product Media"),
                                icon="fa fa-picture-o",
                                url=reverse("shoop_admin:product.edit_media",
                                            kwargs={"pk": product.pk}),
                                extra_css_class="btn-info"))

        # TODO: Add extensibility

        return toolbar
Esempio n. 20
0
    def get_toolbar(self):
        product = self.object
        toolbar = get_default_edit_toolbar(self, "product_form", delete_url="shoop_admin:product.delete")
        if product.pk:
            toolbar.append(
                URLActionButton(
                    text=_("Manage Product Media"),
                    icon="fa fa-picture-o",
                    url=reverse("shoop_admin:product.edit_media", kwargs={"pk": product.pk}),
                    extra_css_class="btn-info",
                )
            )

        # TODO: Add extensibility

        return toolbar
Esempio n. 21
0
    def get_toolbar(self):
        save_form_id = self.get_save_form_id()
        object = self.get_object()
        delete_url = reverse_lazy("shoop_admin:service_provider.delete", kwargs={"pk": object.pk})
        toolbar = get_default_edit_toolbar(self, save_form_id, delete_url=delete_url)
        if self.object.pk:
            toolbar.append(URLActionButton(
                text=_("Create {service_name}").format(
                    service_name=self.object.service_model._meta.verbose_name),
                icon="fa fa-plus",
                url="{model_url}?provider={id}".format(
                    model_url=get_model_url(self.object.service_model, "new"),
                    id=self.object.id),
                extra_css_class="btn-info"
            ))

        return toolbar
Esempio n. 22
0
    def get_toolbar(self):
        save_form_id = self.get_save_form_id()
        object = self.get_object()
        delete_url = reverse_lazy("shoop_admin:service_provider.delete",
                                  kwargs={"pk": object.pk})
        toolbar = get_default_edit_toolbar(self,
                                           save_form_id,
                                           delete_url=delete_url)
        if self.object.pk:
            toolbar.append(
                URLActionButton(text=_("Create {service_name}").format(
                    service_name=self.object.service_model._meta.verbose_name),
                                icon="fa fa-plus",
                                url="{model_url}?provider={id}".format(
                                    model_url=get_model_url(
                                        self.object.service_model, "new"),
                                    id=self.object.id),
                                extra_css_class="btn-info"))

        return toolbar
Esempio n. 23
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     object = self.get_object()
     delete_url = get_model_url(object, "delete") if object.pk else None
     return get_default_edit_toolbar(self, save_form_id, delete_url=(delete_url if object.can_delete() else None))
Esempio n. 24
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     if save_form_id:
         return get_default_edit_toolbar(self, save_form_id)
Esempio n. 25
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     if save_form_id:
         return get_default_edit_toolbar(self, save_form_id)
Esempio n. 26
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     object = self.get_object()
     delete_url = reverse_lazy("shoop_admin:contact-group.delete", kwargs={"pk": object.pk})
     return get_default_edit_toolbar(self, save_form_id, delete_url=delete_url if object.can_delete() else None)
Esempio n. 27
0
 def __init__(self, view):
     super(ProductParentBaseToolbar, self).__init__()
     self.view = view
     self.parent_product = view.object
     self.request = view.request
     get_default_edit_toolbar(self.view, "product_form", with_split_save=False, toolbar=self)
Esempio n. 28
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     return get_default_edit_toolbar(self, save_form_id, with_split_save=settings.SHOOP_ENABLE_MULTIPLE_SHOPS)
Esempio n. 29
0
 def get_toolbar(self):
     save_form_id = self.get_save_form_id()
     if save_form_id:
         return get_default_edit_toolbar(self, save_form_id, delete_url="shoop_admin:carousel.delete")