def _build_existing_product(self): product = self.product # :type product: shuup.core.models.Product save_as_copy_button = JavaScriptActionButton( onclick="saveAsACopy()", text=_("Save as a copy"), icon="fa fa-clone", ) self.append(save_as_copy_button) cross_sell_button = DropdownItem( text=_("Manage Cross-Selling"), icon="fa fa-random", url=reverse("shuup_admin:shop_product.edit_cross_sell", kwargs={"pk": product.pk}), ) menu_items = [ DropdownHeader(text=_("Cross-Selling")), cross_sell_button ] for item in self._get_variation_and_package_menu_items(product): menu_items.append(item) for button in get_provide_objects("admin_product_toolbar_action_item"): if button.visible_for_object(product): menu_items.append(button(product)) if menu_items: self.append(DropdownActionButton( menu_items, icon="fa fa-star", text=_(u"Actions"), extra_css_class="btn-info", ))
def _build_existing_product(self): product = self.product # :type product: shuup.core.models.Product cross_sell_button = DropdownItem( text=_("Manage Cross-Selling"), icon="fa fa-random", url=reverse("shuup_admin:product.edit_cross_sell", kwargs={"pk": product.pk}), ) menu_items = [ DropdownHeader(text=_("Cross-Selling")), cross_sell_button ] for item in self._get_variation_and_package_menu_items(product): menu_items.append(item) self.append( DropdownActionButton( menu_items, icon="fa fa-star", text=_(u"Actions"), extra_css_class="btn-info", ))
def _get_header_items(self, header, divider=True, identifier=None): if divider: yield DropdownDivider() yield DropdownHeader(text=header, identifier=identifier)
def _get_header_item(self, header): yield DropdownDivider() yield DropdownHeader(text=header)