Skip to content

Commit

Permalink
fix: add footer template to be usable in django templates
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa committed Jun 13, 2024
1 parent 9d3beef commit d83a579
Showing 1 changed file with 209 additions and 0 deletions.
209 changes: 209 additions & 0 deletions edx-platform/bragi-children/css-runtime/lms/templates/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
## mako
<%page expression_filter="h"/>
<%!
from django.urls import reverse
from django.utils.translation import gettext as _
from lms.djangoapps.branding import api as branding_api
from openedx.core.djangoapps.lang_pref.api import footer_language_selector_is_enabled
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers

from openedx.core.djangoapps.lang_pref.api import released_languages
%>
<%namespace name='static' file='static_content.html'/>

<%
footer_override = theming.options('footer','footer_override', default=False)

footer_logo_src = theming.options('footer', 'footer_logo_src', default= branding_api.get_logo_url(is_secure))
footer_logo_url = theming.options('footer', 'footer_logo_url', default= marketing_link('ROOT'))
footer_logo_alt = theming.options('footer', 'footer_logo_alt', default= static.get_platform_name())
footer_logo_target = theming.options('foooter', 'footer_logo_target', default= '_self')

footer_description = theming.options('footer','footer_description', default='')
footer_links = theming.options('footer','footer_links', default=[])

footer_langselector = theming.options('footer','footer_langselector', default=False)

footer_social = theming.options('footer','footer_social', default=[])

footer_openedx_src = theming.options('footer', 'footer_openedx_src', default= 'https://files.edx.org/openedx-logos/edx-openedx-logo-tag.png')
footer_openedx_url = theming.options('footer', 'footer_openedx_url', default= 'https://open.edx.org/')
footer_openedx_alt = theming.options('footer', 'footer_openedx_alt', default= _('Powered by OPENedX'))
footer_openedx_target = theming.options('footer', 'footer_openedx_target', default= '_self')

footer_edunext_src = theming.options('footer', 'footer_edunext_src', default= 'https://d1uwn6yupg8lfo.cloudfront.net/edxsites/bragi-images/logo-small21.png')
footer_edunext_url = theming.options('footer', 'footer_edunext_url', default= 'https://www.edunext.co')
footer_edunext_alt = theming.options('footer', 'footer_edunext_alt', default= '')
footer_edunext_target = theming.options('footer', 'footer_edunext_target', default= '_self')

footer_extralinks = theming.options('footer', 'footer_extralinks', default= [])
footer_copy = theming.options('footer', 'footer_copy', default= '')

extra_script = theming.options('footer', 'extra_javascript', default= False)
extra_script_inline = theming.options('footer', 'extra_javascript_inline', default= False)

downgrade_level = theming.options('footer', 'downgrade_level', default= False)
%>

%if footer_override:
${footer_override | n, decode.utf8}
%else:
<footer class="footer"
## When rendering the footer through the branding API,
## the direction may not be set on the parent element,
## so we set it here.
% if bidi:
dir=${bidi}
% endif
>
<div class="content-container row no-gutters align-items-center py-2 px-2 px-lg-0">
<div class="col-12 no-gutters d-lg-none">
%if footer_description:
<p class="footer-description col-12 mt-2 text-center">
${footer_description | n, decode.utf8}
</p>
%endif

%if footer_links:
<nav class="footer-links nav col-12 flex-column flex-md-row justify-content-center">
%for link in footer_links:
<a class="nav-link" href="${link.get('url', '#') | h}" target="${link.get('target', '_self') | h}">${link.get('txt', '') | h}</a>
%endfor

%if footer_langselector:
<%include file="lang_selector.html"/>
%endif
</nav>
%endif

%if footer_social:
<nav class="footer-links nav col-12 justify-content-center">
%for social in footer_social:
<a class="nav-link" href="${social.get('url', '#') | h}" target="${social.get('target', '_self') | h}">
%if social.get('icon'):
<i class="${social.get('icon', 'fa fa-square')}"></i>
%endif
${social.get('txt', '') | h}
</a>
%endfor
</nav>
%endif
</div>

%if footer_logo_src:
<div class="col-6 col-lg-2">
<a class="footer-logo" href="${footer_logo_url | h}" target="${footer_logo_target}">
<img src="${footer_logo_src}" alt="${footer_logo_alt | h}"/>
</a>
</div>
%endif

<div class="col-8 no-gutters px-2 d-none d-lg-block">
%if footer_description:
<p class="footer-description col-12 mt-2 ">
${footer_description | n, decode.utf8}
</p>
%endif

%if footer_links:
<nav class="footer-links align-items-center nav col-12">
%for link in footer_links:
<a class="nav-link" href="${link.get('url', '#') | h}" target="${link.get('target', '_self') | h}">${link.get('txt', '') | h}</a>
%endfor

%if footer_langselector:
<%include file="lang_selector.html"/>
%endif
</nav>
%endif

%if footer_social:
<nav class="footer-links nav col-12">
%for social in footer_social:
<a class="nav-link" href="${social.get('url', '#') | h}" target="${social.get('target', '_self') | h}">
%if social.get('icon'):
<i class="${social.get('icon', 'fa fa-square')}"></i>
%endif
${social.get('txt', '') | h}
</a>
%endfor
</nav>
%endif
</div>

%if footer_edunext_src or footer_openedx_src:
<div class="row col-6 col-lg-2 no-gutters">
%if footer_openedx_src:
<a class="footer-logo openedx col-12" href="${footer_openedx_url}" target="${footer_openedx_target}">
<img src="${footer_openedx_src}" alt="${footer_openedx_alt}" />
</a>
%endif

%if footer_edunext_src:
<a class="footer-logo edunext col-12" href="${footer_edunext_url}" target="${footer_edunext_target}">
<img src="${footer_edunext_src}" alt="${footer_edunext_alt}" />
</a>
%endif
</div>
%endif
</div>

%if footer_extralinks or footer_copy:
<div class="footer-extra">
<div class="content-container row no-gutters py-2 px-2 px-lg-0">
%if footer_extralinks:
<nav class="footer-links nav col-12 flex-column flex-md-row">
%for link in footer_extralinks:
<a class="nav-link" href="${link.get('url', '#') | h}" target="${link.get('target', '_self') | h}">${link.get('txt', '') | h}</a>
%endfor
</nav>
%endif

%if footer_copy:
<small class="footer-copy">${footer_copy | n, decode.utf8}</small>
%endif
</div>
</div>
%endif
</footer>
%endif:

% if settings.FEATURES.get('ENABLE_COOKIE_CONSENT', False):
<%include file="/widgets/cookie-consent.html" />
% endif

<!-- Scripts for bootstrap -->
<script src="https://d1uwn6yupg8lfo.cloudfront.net/resources/libs/enext/bragi/tether.min.js"></script>
<script src="https://d1uwn6yupg8lfo.cloudfront.net/resources/libs/enext/bragi/bootstrap.min.js"></script>

% if extra_script:
<script type="text/javascript" src="${extra_script}"></script>
% endif

% if extra_script_inline:
<script type="text/javascript">${extra_script_inline | n}</script>
% endif

<script type="text/javascript">
var setHeight = (function setHeight(){
if ($(window).innerHeight() > $('.window-wrap').innerHeight()) {
$('.content-wrapper').css('min-height', $(window).innerHeight() - $('.navbar').innerHeight() - $('.footer').innerHeight());
}
}());
</script>

% if downgrade_level == 'level1':
<script type="text/javascript">
$(window).load(function windowLoad() {
if ($('.ednxtDowngrade-modal').length > 0) {
$('.ednxtDowngrade-overlay, .ednxtDowngrade-modal__close, .ednxtDowngrade-modal__button').click(function toggleDowngradeModal() {
$('.ednxtDowngrade-overlay, .ednxtDowngrade-modal').fadeOut();
});
}
});
</script>
% endif

% if configuration_helpers.get_value('activity_tracker') and user.is_authenticated:
<script type="text/javascript" src="https://s3-us-west-2.amazonaws.com/edunextpublic/resources/libs/enext/activity_tracker/main.min.js"></script>
% endif

0 comments on commit d83a579

Please sign in to comment.