예제 #1
0
class GroupDiscountFormBase(DiscountFormBase):
    header_template = 'group_header.pt'
    for_attribute = FOR_GROUP
    for_label = _('discount_form_label_group', default=u'Group')
    for_required = _('discount_form_group_required',
                     default=u'Group is required')
    for_callback = 'javascript:discount_form.autocomplete_group'
    for_mode = 'edit'
예제 #2
0
class UserDiscountFormBase(DiscountFormBase):
    header_template = 'user_header.pt'
    for_attribute = FOR_USER
    for_label = _('discount_form_label_user', default=u'User')
    for_required = _('discount_form_user_required',
                     default=u'User is required')
    for_callback = 'javascript:discount_form.autocomplete_user'
    for_mode = 'edit'
예제 #3
0
class CartDiscountView(DiscountView):
    title = _('cart_discount_title', default=u'Discount for Cart')
    default_form = 'cart_discount_form'
    related_forms = [
        ('cart_discount_form',
         _('cart_discount_form', default=u'General Rules for Cart')),
        ('user_cart_discount_form',
         _('user_cart_discount_form', default=u'User Rules for Cart')),
        ('group_cart_discount_form',
         _('group_cart_discount_form', default=u'Group Rules for Cart')),
    ]
예제 #4
0
 def next(self, request):
     message = translate(
         _("changes_saved", default=u"Changes Saved"), context=self.request
     )
     continuation = [AjaxMessage(message, "info", None)]
     ajax_continue(self.request, continuation)
     return False
예제 #5
0
 def next(self, request):
     message = _('changes_saved', default=u'Changes Saved')
     continuation = [
         AjaxMessage(message, 'info', None)
     ]
     ajax_continue(self.request, continuation)
     return False
예제 #6
0
 def title(self):
     title = self.context.Title()
     # Not sure whether Title() may already return unicode in some
     # circumstance. If not, remove condition.
     if not isinstance(title, unicode):
         title = title.decode('utf-8')
     return _('cart_item_discount_title',
              default=u'Discount for "${title}"',
              mapping={'title': title})
예제 #7
0
 def portal_type_vocabulary(self):
     site = getSite()
     portal_types = getToolByName(site, 'portal_types', None)
     request = aq_get(portal_types, 'REQUEST', None)
     vocab = [(ALL_PORTAL_TYPES, _('all', default=u'All'))]
     for portal_type in portal_types.listContentTypes():
         vocab.append((portal_type,
                       translate(portal_types[portal_type].Title(),
                                 context=request)))
     return vocab
예제 #8
0
 def rendered_filter(self):
     selection = factory(
         'label:select',
         name='discount_form_filter',
         value=self.default_form,
         props={
             'vocabulary': self.related_forms,
             'label': _('discount_rules', default=u'Discount Rules'),
         }
     )
     return selection(request=self.request)
예제 #9
0
 def rendered_filter(self):
     selection = factory('label:select',
                         name='discount_form_filter',
                         value=self.default_form,
                         props={
                             'vocabulary':
                             self.related_forms,
                             'label':
                             _('discount_rules', default=u'Discount Rules'),
                         })
     return selection(request=self.request)
예제 #10
0
 def portal_type_vocabulary(self):
     site = getSite()
     portal_types = getToolByName(site, "portal_types", None)
     request = aq_get(portal_types, "REQUEST", None)
     vocab = [(ALL_PORTAL_TYPES, _("all", default=u"All"))]
     for portal_type in portal_types.listContentTypes():
         vocab.append(
             (
                 portal_type,
                 translate(portal_types[portal_type].Title(), context=request),
             )
         )
     return vocab
예제 #11
0
class ItemDiscountView(DiscountView):
    default_form = 'cart_item_discount_form'
    related_forms = [
        ('cart_item_discount_form',
         _('cart_item_discount_form',
           default=u'General Rules for Cart Items')),
        ('user_cart_item_discount_form',
         _('user_cart_item_discount_form',
           default=u'User Rules for Cart Items')),
        ('group_cart_item_discount_form',
         _('group_cart_item_discount_form',
           default=u'Group Rules for Cart Items')),
    ]

    @property
    def title(self):
        title = self.context.Title()
        # Not sure whether Title() may already return unicode in some
        # circumstance. If not, remove condition.
        if not isinstance(title, unicode):
            title = title.decode('utf-8')
        return _('cart_item_discount_title',
                 default=u'Discount for "${title}"',
                 mapping={'title': title})
예제 #12
0
 def next(self, request):
     message = translate(_('changes_saved', default=u'Changes Saved'),
                         context=self.request)
     continuation = [AjaxMessage(message, 'info', None)]
     ajax_continue(self.request, continuation)
     return False
예제 #13
0
 def kind_vocabulary(self):
     return [
         (KIND_PERCENT, _('percent', _('percent', default=u'Percent'))),
         (KIND_OFF, _('off', _('off', default=u'Off'))),
         (KIND_ABSOLUTE, _('absolute', _('absolute', default=u'Absolute'))),
     ]
예제 #14
0
 def kind_vocabulary(self):
     return [
         (KIND_PERCENT, _('percent', _('percent', default=u'Percent'))),
         (KIND_OFF, _('off', _('off', default=u'Off'))),
     ]
예제 #15
0
 def kind_vocabulary(self):
     return [
         (KIND_PERCENT, _('percent', _('percent', default=u'Percent'))),
         (KIND_OFF, _('off', _('off', default=u'Off'))),
         (KIND_ABSOLUTE, _('absolute', _('absolute', default=u'Absolute'))),
     ]
예제 #16
0
 def kind_vocabulary(self):
     return [
         (KIND_PERCENT, _("percent", default=u"Percent")),
         (KIND_OFF, _("off", default=u"Off")),
     ]
예제 #17
0
 def threshold_calculation_vocabulary(self):
     return [
         (THRESHOLD_PRICE, _("price", default=u"Price")),
         (THRESHOLD_ITEM_COUNT, _("item_count", default=u"Item Count")),
     ]
예제 #18
0
 def threshold_calculation_vocabulary(self):
     return [(THRESHOLD_PRICE, _("price", default=u"Price"))]
예제 #19
0
 def threshold_calculation_vocabulary(self):
     return [(THRESHOLD_PRICE, _('price', default=u'Price'))]
예제 #20
0
 def threshold_calculation_vocabulary(self):
     return [
         (THRESHOLD_PRICE, _('price', default=u'Price')),
         (THRESHOLD_ITEM_COUNT, _('item_count', default=u'Item Count')),
     ]
예제 #21
0
 def kind_vocabulary(self):
     return [
         (KIND_PERCENT, _('percent', _('percent', default=u'Percent'))),
         (KIND_OFF, _('off', _('off', default=u'Off'))),
     ]
예제 #22
0
 def kind_vocabulary(self):
     return [
         (KIND_PERCENT, _("percent", default=u"Percent")),
         (KIND_OFF, _("off", default=u"Off")),
         (KIND_ABSOLUTE, _("absolute", default=u"Absolute")),
     ]