<%! import json %>
<%! from django.core.urlresolvers import reverse %>
<%! from django.conf import settings %>
<%! from django.utils.translation import ugettext as _ %>
<%! from microsite_configuration import microsite %>

<!--<%namespace name='static' file='/static_content.html'/>-->

<%inherit file="/main.html" />
<%namespace name='static' file='/static_content.html'/>

<%block name="pagetitle">${_("Account Settings")}</%block>
<%block name="nav_skip">#u-field-input-username</%block>

<%block name="header_extras">

    <script type="text/template" id="account_settings-tpl">
        <%static:include path="student_account/account_settings.underscore" />
    </script>

    % for template_name in ["field_dropdown", "field_link", "field_readonly", "field_text"]:
        <script type="text/template" id="${template_name}-tpl">
            <%static:include path="fields/${template_name}.underscore" />
        </script>
    % endfor
</%block>

% if duplicate_provider:
    <section>
        <%include file='/dashboard/_dashboard_third_party_error.html' />
    </section>
% endif

<div class="wrapper-account-settings"></div>

<%block name="headextra">
    <%static:css group='style-course'/>

    <script>
          (function (require) {
            require(['js/student_account/views/account_settings_factory'], function(setupAccountSettingsSection) {

                var fieldsData = ${ json.dumps(fields) };
                var authData = ${ json.dumps(auth) };
                var platformName = ${ json.dumps(microsite.get_value('platform_name', settings.PLATFORM_NAME))};

                setupAccountSettingsSection(
                        fieldsData, authData, '${user_accounts_api_url}', '${user_preferences_api_url}', ${user.id},
                        platformName
                );
            });
          }).call(this, require || RequireJS.require);
    </script>

</%block>
