Skip to content

Commit

Permalink
Merge pull request #35 from forellana-digithinkit/dev-refactor-addres…
Browse files Browse the repository at this point in the history
…ses-for-widget

Dev refactor addresses for widget
  • Loading branch information
vjFaLk authored Sep 21, 2017
2 parents 11459e0 + b755c81 commit dedb79d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
3 changes: 2 additions & 1 deletion gateway_selector/public/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ frappe.integration_service.gateway_selector_gateway = Class.extend({
})

$('#gateway-selector-continue').click(function() {
$('html, body').animate({ scrollTop: $('#awc-forms').offset().top - 60 }, 'slow');

$('html, body').animate({ scrollTop: $('#awc-forms, #gateway-selector-forms').first().offset().top - 60 }, 'slow');
if ( !base._is_enabled ) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ <h2>Select Payment Method</h2>
{% if not is_backend %}
<h2>Billing Address</h2>
<div class="row">
<div id="awc-select-bill-addr">
{% include "templates/includes/integrations/gateway_selector/billing_address_select.html" with context %}
<div id="select-bill-addr">
<div id="awc-billing-addrs"></div>
</div>
<div id="form-bill-addr" style="display: none;">
{% include "templates/includes/integrations/gateway_selector/billing_address.html" with context %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from frappe.utils.formatters import format_value
from awesome_cart.compat.customer import get_current_customer
from awesome_cart.session import get_awc_session, set_awc_session
from frappe.integration_broker.doctype.integration_service.integration_service import get_integration_controller
from gateway_selector.gateway_selector.doctype.gateway_selector_settings.gateway_selector_settings import is_gateway_embedable, build_embed_context
from gateway_selector import payments
import json
Expand All @@ -27,8 +26,6 @@ def get_context(context):
awc_session = get_awc_session()
pr_access = awc_session.get("gateway_selector_pr_access")

print(pretty_json(awc_session))

# or from pathname, this works better for redirection on auth errors
if not proxy_name:
path_parts = context.get("pathname", "").split('/')
Expand Down Expand Up @@ -76,11 +73,6 @@ def get_context(context):
default_country = frappe.get_value("System Settings", "System Settings", "country")
default_country_doc = next((x for x in context["billing_countries"] if x.name == default_country), None)

customer = get_current_customer()

if customer:
context["addresses"] = frappe.get_all("Address", filters={"customer" : customer.name, "disabled" : 0, "address_type" : "Billing"}, fields="*")

country_idx = context["billing_countries"].index(default_country_doc)
context["billing_countries"].pop(country_idx)
context["billing_countries"] = [default_country_doc] + context["billing_countries"]
Expand Down

0 comments on commit dedb79d

Please sign in to comment.