Repository: saleor/saleor

Issue:
Improve phone number prefix field rendering
The country prefix and phone number fields render in two lines:
![image](https://user-images.githubusercontent.com/5421321/34664203-00109558-f45b-11e7-8405-42779c4bbda1.png)
Instead, we should render those fields in one line, similarly to how it looks like in the storefront:
![image](https://user-images.githubusercontent.com/5421321/34664244-32a1ff98-f45b-11e7-94a1-1c9a6910635c.png)
I think there is no such pattern in Material Design and we could simply put the two fields next to each other, preserving the with-proportions like in the storefront.



Discussion:

Resolving patch:
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -7,6 +7,7 @@
 from payments import PaymentError, PaymentStatus
 from satchless.item import InsufficientStock
 
+from ..widgets import PhonePrefixWidget
 from ...cart.forms import QuantityField
 from ...core.forms import AjaxSelect2ChoiceField
 from ...discount.utils import decrease_voucher_usage
@@ -18,6 +19,8 @@
     recalculate_order, remove_empty_groups)
 from ...product.models import Product, ProductVariant, Stock
 from ...product.utils import allocate_stock, deallocate_stock
+from ...userprofile.i18n import (AddressForm as StorefrontAddressForm,
+                                 PossiblePhoneNumberFormField)
 
 
 class OrderNoteForm(forms.ModelForm):
@@ -368,3 +371,8 @@ def save(self):
         add_variant_to_delivery_group(
             self.group, variant, quantity, self.discounts)
         recalculate_order(self.group.order)
+
+
+class AddressForm(StorefrontAddressForm):
+    phone = PossiblePhoneNumberFormField(
+        widget=PhonePrefixWidget, required=False)
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.py
--- a/saleor/dashboard/order/views.py
+++ b/saleor/dashboard/order/views.py
@@ -14,10 +14,10 @@
 
 from .filters import OrderFilter
 from .forms import (
-    AddVariantToDeliveryGroupForm, CancelGroupForm, CancelOrderLineForm,
-    CancelOrderForm, CapturePaymentForm, ChangeStockForm, ChangeQuantityForm,
-    MoveLinesForm, OrderNoteForm, RefundPaymentForm, ReleasePaymentForm,
-    RemoveVoucherForm, ShipGroupForm)
+    AddressForm, AddVariantToDeliveryGroupForm, CancelGroupForm,
+    CancelOrderLineForm, CancelOrderForm, CapturePaymentForm,
+    ChangeStockForm, ChangeQuantityForm, MoveLinesForm, OrderNoteForm,
+    RefundPaymentForm, ReleasePaymentForm, RemoveVoucherForm, ShipGroupForm)
 
 from .utils import (
     create_invoice_pdf, create_packing_slip_pdf, get_statics_absolute_url)
@@ -25,7 +25,6 @@
 from ...core.utils import get_paginator_items
 from ...order import GroupStatus
 from ...order.models import Order, OrderLine, OrderNote
-from ...userprofile.i18n import AddressForm
 
 
 @staff_member_required
diff --git a/saleor/dashboard/widgets.py b/saleor/dashboard/widgets.py
--- a/saleor/dashboard/widgets.py
+++ b/saleor/dashboard/widgets.py
@@ -3,6 +3,9 @@
 from django_filters.widgets import RangeWidget
 from django_prices.widgets import PriceInput
 
+from ..userprofile.widgets import (PhonePrefixWidget as
+                                   StorefrontPhonePrefixWidget)
+
 
 class DateRangeWidget(RangeWidget):
     def __init__(self, attrs=None):
@@ -15,3 +18,7 @@ def __init__(self, attrs=None):
         self.currency = getattr(settings, 'DEFAULT_CURRENCY')
         widgets = (PriceInput(self.currency), PriceInput(self.currency))
         super(RangeWidget, self).__init__(widgets, attrs)
+
+
+class PhonePrefixWidget(StorefrontPhonePrefixWidget):
+    template_name = 'dashboard/order/widget/phone_prefix_widget.html'


Test patch: