def get_context_data(self, **kwargs): context = super(ScriptEditView, self).get_context_data(**kwargs) if self.object.pk: buttons = [] edit_button_title = _("Edit Script Contents...") # this script was created through a template # so show an option to easily edit the template if self.object.template: template_cls = get_identifier_to_object_map(SCRIPT_TEMPLATES_PROVIDE_CATEGORY).get(self.object.template) # check whether is possible to edit the script through the template editor if template_cls and template_cls(self.object).can_edit_script(): # change the editor button title to advanced mode edit_button_title = _("Edit Script (advanced)") buttons.append( URLActionButton( text=_("Edit Template"), icon="fa fa-pencil-square-o", extra_css_class="btn-info", url=reverse("wshop_admin:notify.script-template-edit", kwargs={"pk": self.object.pk}) ) ) buttons.insert(0, URLActionButton( text=edit_button_title, icon="fa fa-pencil", extra_css_class="btn-info", url=reverse("wshop_admin:notify.script.edit-content", kwargs={"pk": self.object.pk}) )) context["toolbar"] = Toolbar(buttons) 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("wshop_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("wshop_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("wshop_admin:notify.script.new")), JavaScriptActionButton(text=_("New From Template"), icon="fa fa-book", extra_css_class="btn-info", onclick="showScriptTemplates()") ])
def get_context_data(self, **kwargs): context = super(SystemSettingsView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-save", form_id="settings_form", text=_("Save system settings"), extra_css_class="btn-success", ) ]) return context
def get_context_data(self, **kwargs): context = super(ContactGroupListView, self).get_context_data(**kwargs) if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model( ContactGroup, return_url="contact_group") else: settings_button = None context["toolbar"] = Toolbar([ NewActionButton("wshop_admin:contact_group.new"), settings_button ]) return context
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(CouponListView, self).get_context_data(**kwargs) if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model( self.model, return_url="coupon") else: settings_button = None context["toolbar"] = Toolbar([ NewActionButton("wshop_admin:coupon.new", text=_("Create new Coupon")), settings_button ]) return context
def get_context_data(self, **kwargs): context = super(OrderAddressEditView, self).get_context_data(**kwargs) context["title"] = _("Edit Addresses -- %s") % context["order"] context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-check-circle", form_id="edit-addresses", text=_("Edit Addresses"), extra_css_class="btn-success", ), ]) return context
def get_context_data(self, **kwargs): context = super(PermissionGroupListView, self).get_context_data(**kwargs) context["title"] = _("Permission Groups") if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model(self.model, return_url="permission_group") else: settings_button = None context["toolbar"] = Toolbar([ NewActionButton("wshop_admin:permission_group.new", text=_("Create new Permission Group")), settings_button ]) return context
def get_context_data(self, **kwargs): context = super(OrderCreateFullRefundView, self).get_context_data(**kwargs) context["title"] = _("Create Full Refund -- %s") % context["order"] context["toolbar"] = Toolbar([ URLActionButton( url=reverse("wshop_admin:order.create-refund", kwargs={"pk": self.object.pk}), icon="fa fa-check-circle", text=_("Cancel"), extra_css_class="btn-danger", ), ]) 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): if self.request.user.is_superuser: settings_button = SettingsActionButton.for_model( Contact, return_url="contact") else: settings_button = None return Toolbar([ NewActionButton.for_model(PersonContact, url=reverse("wshop_admin:contact.new") + "?type=person"), NewActionButton.for_model(CompanyContact, extra_css_class="btn-info", url=reverse("wshop_admin:contact.new") + "?type=company"), settings_button ])
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_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_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: buttons.append(settings_button) return Toolbar(buttons)
def get_context_data(self, **kwargs): context = super(ListSettingsView, self).get_context_data(**kwargs) context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-save", form_id="settings_form", text=_("Save"), extra_css_class="btn-success", ), JavaScriptActionButton( icon="fa fa-cog", text=_("Reset Defaults"), onclick="resetDefaultValues()", ) ]) context["defaults"] = "|".join([ self.settings.get_settings_key(c.id) for c in self.settings.default_columns ]) return context
def get_context_data(self, **kwargs): context = super(OrderCreateRefundView, self).get_context_data(**kwargs) context["title"] = _("Create Refund -- %s") % context["order"] context["toolbar"] = Toolbar([ PostActionButton( icon="fa fa-check-circle", form_id="create_refund", text=_("Create Refund"), extra_css_class="btn-success", ), URLActionButton( url=reverse("wshop_admin:order.create-full-refund", kwargs={"pk": self.object.pk}), icon="fa fa-dollar", text=_("Refund Entire Order"), extra_css_class="btn-info", disable_reason=_("This order already has existing refunds") if self.object.has_refunds() else None ), ]) # Setting the line_numbers choices dynamically creates issues with the blank formset, # So adding that to the context to be rendered manually context["line_number_choices"] = self._get_line_number_choices() context["json_line_data"] = [self._get_line_data(self.object, line) for line in self.object.lines.all()] return context
def get_toolbar(self): if settings.WSHOP_ENABLE_MULTIPLE_SUPPLIERS: return super(SupplierListView, self).get_toolbar() else: return Toolbar([])
def get_toolbar(self): if WshopSettings.get_setting("WSHOP_ENABLE_MULTIPLE_SHOPS"): return super(ShopListView, self).get_toolbar() else: return Toolbar([])
def get_toolbar(self): return Toolbar([ NewActionButton.for_model(Order, url=reverse("wshop_admin:order.new")), SettingsActionButton.for_model(Order, return_url="order") ])
def get_toolbar(self): return Toolbar([])