def get_toolbar(self): order = self.object toolbar = Toolbar() 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("shoop_admin:order.create-shipment", kwargs={"pk": order.pk}), extra_css_class="btn-info" )) toolbar.append(PostActionButton( post_url=reverse("shoop_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" )) # TODO: Add extensibility to action_button_groups? return toolbar
def get_toolbar(self): order = self.object toolbar = Toolbar() 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("shoop_admin:order.create-shipment", kwargs={"pk": order.pk}), extra_css_class="btn-info" )) toolbar.append(PostActionButton( post_url=reverse("shoop_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" )) for button in get_provide_objects("admin_order_toolbar_button"): toolbar.append(button(order)) return toolbar
def get_context_data(self, **kwargs): context = super(CouponListView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar([ NewActionButton("shoop_admin:coupons.new", text=_("Create new Coupon")), ]) return context
def get_context_data(self, **kwargs): context = super(CampaignListView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar([ NewActionButton("shoop_admin:basket_campaigns.new", text=_("Create new Basket Campaign")), ]) return context
def get_context_data(self, **kwargs): context = super(AddonListView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-save", form_id="addon_list", text=_("Save addon changes"), extra_css_class="btn-success", ), NewActionButton( reverse("shoop_admin:addon.upload"), text=_("Upload new addon"), extra_css_class="btn-info", icon="fa fa-upload", ) ]) if self.request.GET.get("reload"): context["toolbar"].append( URLActionButton( reverse("shoop_admin:addon.reload"), text=_("Reload application"), extra_css_class="btn-warning", icon="fa fa-refresh", )) return context
def get_toolbar(self): return Toolbar([ URLActionButton( text="New Script", icon="fa fa-plus", extra_css_class="btn-success", url=reverse("shoop_admin:notify.script.new") ) ])
def get_toolbar(self): buttons = [] model = self.model if hasattr(self, "get_model"): model = self.get_model() new_button = NewActionButton.for_model(model) if new_button: buttons.append(new_button) return Toolbar(buttons)
def get_context_data(self, **kwargs): context = super(AddonUploadView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-upload", form_id="upload_form", text=_("Upload"), extra_css_class="btn-success", ) ]) return context
def get_context_data(self, **kwargs): context = super(ProductMediaEditView, self).get_context_data(**kwargs) context["title"] = _("Edit Media: %s") % self.object context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-save", form_id="media_form", text=_("Save"), extra_css_class="btn-success", ), ]) return context
def get_context_data(self, **kwargs): context = super(ScriptEditView, self).get_context_data(**kwargs) if self.object.pk: context["toolbar"] = Toolbar([ URLActionButton(text=_(u"Edit Script Contents..."), icon="fa fa-pencil", extra_css_class="btn-info", url=reverse( "shoop_admin:notify.script.edit-content", kwargs={"pk": self.object.pk})) ]) return context
def get_context_data(self, **kwargs): context = super(OrderCreatePaymentView, self).get_context_data(**kwargs) context["title"] = _("Create Payment -- %s") % context["order"] context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-check-circle", form_id="create_payment", text=_("Create Payment"), extra_css_class="btn-success", ), ]) return context
def get_toolbar(self): order = self.object if order.is_canceled(): return toolbar = Toolbar() 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("shoop_admin:order.create-shipment", kwargs={"pk": order.pk}), extra_css_class="btn-info" )) toolbar.append(PostActionButton( post_url=reverse("shoop_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("shoop_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" )) for button in get_provide_objects("admin_order_toolbar_button"): toolbar.append(button(order)) return toolbar
def get_context_data(self, **kwargs): context = super(EditScriptContentView, self).get_context_data(**kwargs) context["title"] = get_create_or_change_title(self.request, self.object) context["action_infos"] = Action.get_ui_info_map() context["condition_infos"] = Condition.get_ui_info_map() context["cond_op_names"] = get_enum_choices_dict(StepConditionOperator) context["step_next_names"] = get_enum_choices_dict(StepNext) context["toolbar"] = Toolbar([ JavaScriptActionButton(text="Save", icon="fa fa-save", extra_css_class="btn-success", onclick="ScriptEditor.save();return false"), get_discard_button(get_model_url(self.object, "edit")) ]) return context
def get_context_data(self, **kwargs): context = super(AddonUploadConfirmView, self).get_context_data(**kwargs) with zipfile.ZipFile(self.get_addon_path()) as zf: context["filenames"] = sorted(zf.namelist()) pkg_info_path = first(filename for filename in context["filenames"] if filename.endswith("PKG-INFO")) if pkg_info_path: context["pkg_info"] = zf.read(pkg_info_path).decode( "UTF-8", "replace") context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-download", form_id="install_form", text=_("Install Addon"), extra_css_class="btn-success", ) ]) return context
def get_context_data(self, **kwargs): context = super(ContactGroupListView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar( [NewActionButton("shoop_admin:contact-group.new")]) return context
def get_toolbar(self): if settings.SHOOP_ENABLE_MULTIPLE_SHOPS: return super(ShopListView, self).get_toolbar() else: return Toolbar([])
def get_toolbar(self): if settings.SHOOP_ENABLE_MULTIPLE_SUPPLIERS: return super(SupplierListView, self).get_toolbar() else: return Toolbar([])
def get_toolbar(self): return Toolbar([])