def get_toolbar(self): toolbar = Toolbar() toolbar.append( JavaScriptActionButton(onclick="window.saveCategories();", text=_("Save"), icon="fa fa-save", extra_css_class="btn-success")) return toolbar
def get_toolbar(self): toolbar = Toolbar() model = self.model if hasattr(self, "get_model"): model = self.get_model() new_button = NewActionButton.for_model(model) if new_button: toolbar.append(new_button) return_url = self.url_identifier if self.url_identifier else None if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model(model, return_url=return_url) else: settings_button = None if settings_button: toolbar.append(settings_button) toolbar.extend(Toolbar.for_view(self)) return toolbar
def get_toolbar(self): order = self.object toolbar = Toolbar() toolbar.append( URLActionButton(text=_("Create Refund"), icon="fa fa-dollar", disable_reason=_("This order cannot be refunded") if not order.can_create_refund() else None, url=reverse("shuup_admin:order.create-refund", kwargs={"pk": order.pk}), extra_css_class="btn-info")) toolbar.append( URLActionButton( text=_("Create Payment"), icon="fa fa-money", disable_reason=_("This order cannot be paid at this point") if order.is_paid() else None, url=reverse("shuup_admin:order.create-payment", kwargs={"pk": order.pk}), extra_css_class="btn-info")) toolbar.append( URLActionButton(text=_("Create Shipment"), icon="fa fa-truck", disable_reason=_("There are no products to ship") if not order.get_unshipped_products() else None, url=reverse("shuup_admin:order.create-shipment", kwargs={"pk": order.pk}), extra_css_class="btn-info")) toolbar.append( PostActionButton( post_url=reverse("shuup_admin:order.set-status", kwargs={"pk": order.pk}), name="status", value=OrderStatus.objects.get_default_complete().pk, text=_("Set Complete"), icon="fa fa-check-circle", disable_reason=( _("This order can not be set as complete at this point") if not order.can_set_complete() else None), extra_css_class="btn-success")) toolbar.append( PostActionButton( post_url=reverse("shuup_admin:order.set-status", kwargs={"pk": order.pk}), name="status", value=OrderStatus.objects.get_default_canceled().pk, text=_("Cancel Order"), icon="fa fa-trash", disable_reason=( _("Paid, shipped, or canceled orders cannot be canceled") if not order.can_set_canceled() else None), extra_css_class="btn-danger btn-inverse")) toolbar.append( URLActionButton( text=_("Edit order"), icon="fa fa-money", disable_reason=_("This order cannot modified at this point") if not order.can_edit() else None, url=reverse("shuup_admin:order.edit", kwargs={"pk": order.pk}), extra_css_class="btn-info")) for button in get_provide_objects("admin_order_toolbar_button"): toolbar.append(button(order)) return toolbar
def get_toolbar(self): order = self.object toolbar = Toolbar() toolbar.append(URLActionButton( text=_("Create Refund"), icon="fa fa-dollar", disable_reason=_("This order cannot be refunded") if not order.can_create_refund() else None, url=reverse("shuup_admin:order.create-refund", kwargs={"pk": order.pk}), extra_css_class="btn-info" )) toolbar.append(URLActionButton( text=_("Create Payment"), icon="fa fa-money", disable_reason=_("This order cannot be paid at this point") if order.is_paid() else None, url=reverse("shuup_admin:order.create-payment", kwargs={"pk": order.pk}), extra_css_class="btn-info" )) toolbar.append(URLActionButton( text=_("Create Shipment"), icon="fa fa-truck", disable_reason=_("There are no products to ship") if not order.get_unshipped_products() else None, url=reverse("shuup_admin:order.create-shipment", kwargs={"pk": order.pk}), extra_css_class="btn-info" )) toolbar.append(PostActionButton( post_url=reverse("shuup_admin:order.set-status", kwargs={"pk": order.pk}), name="status", value=OrderStatus.objects.get_default_complete().pk, text=_("Set Complete"), icon="fa fa-check-circle", disable_reason=( _("This order can not be set as complete at this point") if not order.can_set_complete() else None ), extra_css_class="btn-success" )) toolbar.append(PostActionButton( post_url=reverse("shuup_admin:order.set-status", kwargs={"pk": order.pk}), name="status", value=OrderStatus.objects.get_default_canceled().pk, text=_("Cancel Order"), icon="fa fa-trash", disable_reason=( _("Paid, shipped, or canceled orders cannot be canceled") if not order.can_set_canceled() else None ), extra_css_class="btn-danger btn-inverse" )) toolbar.append(URLActionButton( text=_("Edit order"), icon="fa fa-money", disable_reason=_("This order cannot modified at this point") if not order.can_edit() else None, url=reverse("shuup_admin:order.edit", kwargs={"pk": order.pk}), extra_css_class="btn-info" )) for button in get_provide_objects("admin_order_toolbar_button"): toolbar.append(button(order)) return toolbar