def accept_label(self):
     base = api.portal.get_navigation_root(self.context).absolute_url()
     # XXX: url from config
     tac_url = '%s/%s' % (base, TERMS_AND_CONDITONS_ID)
     tac_label = _('terms_and_conditions', 'Terms and conditions')
     tac_label = translate(tac_label, context=self.request)
     tac_link = '<a href="%s" class="terms_and_conditions">%s</a>'
     tac_link = tac_link % (tac_url, tac_label)
     tac_text = _('terms_and_conditions_text',
                  'I have read and accept the ${terms_and_conditions}',
                  mapping={'terms_and_conditions': tac_link})
     return tac_text
 def prepare(self):
     if not readcookie(self.request):
         raise Redirect(self.context.absolute_url())
     checkout = self.form_context is CHECKOUT
     form_class = checkout and "mode_edit" or "mode_display"
     self.form = factory("#form", name="checkout", props={"action": self.form_action, "class_add": form_class})
     for fields_factory in self.provider_registry:
         fields_factory(self.context, self.request).extend(self.form)
     # checkout data input
     if checkout:
         self.form["checkout_back"] = factory(
             "submit",
             props={
                 "label": _("back", "Back"),
                 "action": "checkout_back",
                 "class_add": "standalone",
                 "handler": None,
                 "next": self.checkout_back,
                 "skip": True,
             },
         )
         self.form["next"] = factory(
             "submit",
             props={
                 "label": _("next", "Next"),
                 "action": "next",
                 "class_add": "context",
                 "handler": None,
                 "next": self.checkout_summary,
             },
         )
     # checkout confirmation
     else:
         self.form["confirm_back"] = factory(
             "submit",
             props={
                 "label": _("back", "Back"),
                 "action": "confirm_back",
                 "handler": None,
                 "next": self.confirm_back,
             },
         )
         self.form["finish"] = factory(
             "submit",
             props={
                 "class": "prevent_if_no_longer_available context",
                 "label": _("finish", "Order now"),
                 "action": "finish",
                 "handler": self.finish,
                 "next": self.checkout_done,
             },
         )
 def accept_label(self):
     nav_root = plone.api.portal.get_navigation_root(self.context)
     base = nav_root.absolute_url()
     # XXX: url from config
     tac_url = "%s/%s" % (base, TERMS_AND_CONDITONS_ID)
     tac_label = _("terms_and_conditions", "Terms and conditions")
     tac_label = translate(tac_label, context=self.request)
     tac_link = '<a href="%s" class="terms_and_conditions">%s</a>'
     tac_link = tac_link % (tac_url, tac_label)
     tac_text = _(
         "terms_and_conditions_text",
         "I have read and accept the ${terms_and_conditions}",
         mapping={"terms_and_conditions": tac_link},
     )
     return tac_text
 def accept_label(self):
     nav_root = plone.api.portal.get_navigation_root(self.context)
     base = nav_root.absolute_url()
     # XXX: url from config
     tac_url = '{}/{}'.format(base, TERMS_AND_CONDITONS_ID)
     tac_label = _('terms_and_conditions', 'Terms and conditions')
     tac_label = translate(tac_label, context=self.request)
     tac_link = (
         u'<a href="{}"'
         u'   class="terms_and_conditions pat-plone-modal"'
         u'   data-pat-plone-modal="width: 75%;">{}</a>'
     ).format(tac_url, tac_label)
     tac_text = _(
         'terms_and_conditions_text',
         'I have read and accept the ${terms_and_conditions}',
         mapping={'terms_and_conditions': tac_link}
     )
     return tac_text
 def prepare(self):
     if not readcookie(self.request):
         raise Redirect(self.context.absolute_url())
     checkout = self.form_context is CHECKOUT
     form_class = checkout and 'mode_edit' or 'mode_display'
     self.form = factory('#form', name='checkout', props={
         'action': self.form_action,
         'class_add': form_class})
     for fields_factory in self.provider_registry:
         fields_factory(self.context, self.request).extend(self.form)
     # checkout data input
     if checkout:
         self.form['checkout_back'] = factory('submit', props={
             'label': _('back', 'Back'),
             'action': 'checkout_back',
             'class_add': 'standalone',
             'handler': None,
             'next': self.checkout_back,
             'skip': True})
         self.form['next'] = factory('submit', props={
             'label': _('next', 'Next'),
             'action': 'next',
             'class_add': 'context',
             'handler': None,
             'next': self.checkout_summary})
     # checkout confirmation
     else:
         self.form['confirm_back'] = factory('submit', props={
             'label': _('back', 'Back'),
             'action': 'confirm_back',
             'handler': None,
             'next': self.confirm_back})
         self.form['finish'] = factory('submit', props={
             'class': 'prevent_if_no_longer_available context',
             'label': _('finish', 'Order now'),
             'action': 'finish',
             'handler': self.finish,
             'next': self.checkout_done})
 def extend(self, form):
     if not self.form_context == CONFIRM:
         return
     compound = form[self.fields_name] = factory('compound', props={
         'structural': True})
     compound['heading'] = factory('tag', props={
         'structural': True,
         'tag': 'h2',
         'text': _('heading_cart_summary', 'Cart')})
     compound['overview'] = factory('tag', props={
         'structural': True,
         'class': 'cart_overview checkout_cart_overview clearfix',
         'tag': 'div',
         'text': self.context.restrictedTraverse('@@cart_overview')()})
 def extend(self, form):
     if not self.form_context == CONFIRM:
         return
     compound = form[self.fields_name] = factory("compound", props={"structural": True})
     compound["heading"] = factory(
         "tag", props={"structural": True, "tag": "h2", "text": _("heading_cart_summary", "Cart")}
     )
     compound["overview"] = factory(
         "tag",
         props={
             "structural": True,
             "class": "cart_overview checkout_cart_overview clearfix",
             "tag": "div",
             "text": self.context.restrictedTraverse("@@cart_overview")(),
         },
     )
 def validate_accept(self, widget, data):
     if not data.extracted:
         raise ExtractionError(_('error_accept_terms_and_conditiond',
                                 'Please accept our terms and conditions.'))
     return data.extracted
 def alternative_delivery_vocab(self):
     return {
         True: _('yes', 'Yes'),
         False: _('no', 'No'),
         UNSET: _('not set', 'not set'),
     }
def gender_vocabulary():
    return [('male', _('male', default=u'Male')),
            ('female', _('female', default=u'Female'))]
def gender_vocabulary():
    return [('male', _('male', default=u'Male')),
            ('female', _('female', default=u'Female'))]
 def alternative_delivery_vocab(self):
     return {True: _("yes", "Yes"), False: _("no", "No"), UNSET: _("not set", "not set")}