Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature.nutmeg/jltang/terms of service #214

Open
wants to merge 15 commits into
base: develop/nutmeg.master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/djangoapps/student/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from openedx.core.djangoapps.user_authn.utils import is_safe_login_or_logout_redirect
from xmodule.data import CertificatesDisplayBehaviors # lint-amnesty, pylint: disable=wrong-import-order


# Enumeration of per-course verification statuses
# we display on the student dashboard.
VERIFY_STATUS_NEED_TO_VERIFY = "verify_need_to_verify"
Expand Down
5 changes: 5 additions & 0 deletions common/djangoapps/student/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
)
from common.djangoapps.util.milestones_helpers import get_pre_requisite_courses_not_completed
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
from openedx.features.termsofservice.api.v1 import views as tos_views

log = logging.getLogger("edx.student")

Expand Down Expand Up @@ -816,6 +817,10 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem
# TODO START: clean up as part of REVEM-199 (END)
}

if settings.FEATURES.get('ENABLE_TERMSOFSERVICE'):
tos_modal = tos_views.terms_of_service_api(request)
context.update({'tos_modal': tos_modal})

# Include enterprise learner portal metadata and messaging
enterprise_learner_portal_context = get_enterprise_learner_portal_context(request)
context.update(enterprise_learner_portal_context)
Expand Down
8 changes: 6 additions & 2 deletions lms/djangoapps/static_template_view/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


import mimetypes

from django.conf import settings
from django.http import Http404, HttpResponse, HttpResponseNotFound, HttpResponseServerError
from django.shortcuts import redirect
Expand All @@ -22,7 +21,7 @@
from common.djangoapps.util.cache import cache_if_anonymous
from common.djangoapps.util.views import fix_crum_request
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers

from openedx.features.termsofservice import views as tos_views
valid_templates = []

if settings.STATIC_GRAB:
Expand Down Expand Up @@ -59,6 +58,11 @@ def render(request, template):
# This is necessary for the dialog presented with the TOS in /register
if template == 'honor.html':
context['allow_iframing'] = True

if settings.FEATURES.get('ENABLE_TERMSOFSERVICE'):
latest_tos_html = tos_views.latest_terms_of_service()
context['tos_html'] = latest_tos_html

# Format Examples: static_template_about_header
configuration_base = 'static_template_' + template.replace('.html', '').replace('-', '_')
page_header = configuration_helpers.get_value(configuration_base + '_header')
Expand Down
1 change: 1 addition & 0 deletions lms/static/sass/_build-lms-v1.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
@import 'features/_unsupported-browser-alert';
@import 'features/content-type-gating';
@import 'features/course-duration-limits';
@import 'features/termsofservice';

// search
@import 'search/search';
Expand Down
105 changes: 105 additions & 0 deletions lms/static/sass/features/_termsofservice.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.modal-tos {
position: fixed;
top: 0;
left: 0;
width:100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
display: inline-block;
}

.modal-main-tos {
position:fixed;
background: white;
width: 80%;
height: auto;
top:50%;
left:50%;
transform: translate(-50%,-50%);
border-radius: 10px;

form {
margin-bottom: 20px;
}
}

.scrollable_tos_style {
height: 58vh;
width: auto;
overflow-x: hidden;
overflow-y: auto;
padding: 6px;
}

.display-block {
display: block;
}

.display-none {
display: none;
}

.tos-part {
margin-top: 15px !important;
}

.tos-section {
list-style: none !important;
padding: 0px !important;
}

.tos-section-item {
display:block !important;
margin-bottom: 15px !important;
}

.tos-section-item > span {
display:block !important;
font-weight: bold !important;
// position: absolute !important;
}

.tos-section-item > p {
margin-top: -18px;
margin-left: 40px !important;
display:block;
// display: inline-block !important;
// position: relative !important;
/*top: -21px !important;*/
}


.tos-section-alpha {
list-style: none !important;
counter-reset: tos-section-alpha-counter;
}

.tos-section-alpha > li {
margin: 10px 0;
}

.tos-section-alpha > li::after {
min-width: 30px !important;
}

.tos-section-alpha > li::before {
content: '(' counter(tos-section-alpha-counter, lower-alpha) ')';
counter-increment: tos-section-alpha-counter;
display:inline-block !important;
display: table-cell;
text-align: right;


// position: absolute !important;
/*min-width: 20px !important;*/
}

.tos-section-alpha > li p {
margin-left: 40px !important;
// display: inline-block !important;
margin-top: -18px;

// position: relative !important;
/*top: -21px !important;*/
}

9 changes: 9 additions & 0 deletions lms/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,12 @@ <h2 id="unenrollment-modal-title">
</div>

<%include file="dashboard/_dashboard_entitlement_unenrollment_modal.html"/>

<%include file="dashboard/_dashboard_entitlement_unenrollment_modal.html"/>

% if settings.FEATURES.get('ENABLE_TERMSOFSERVICE'):
<%include file='termsofservice/modal_termsofservice.html' />
% endif



112 changes: 102 additions & 10 deletions lms/templates/static_templates/tos.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,105 @@

<%block name="pagetitle">${_("Terms of Service")}</%block>

<main id="main" aria-label="Content" tabindex="-1">
<section class="container about">
<h1>
<%block name="pageheader">${page_header or _("Terms of Service")}</%block>
</h1>
<p>
<%block name="pagecontent">${page_content or _("This page left intentionally blank. Feel free to add your own content.")}</%block>
</p>
</section>
</main>
<style type="text/css">

.tos-part {
margin-top: 15px !important;
}

.tos-section {
list-style: none !important;
padding: 0px !important;
}

.tos-section-item {
margin-bottom: 15px !important;
}

.tos-section-item > span {
font-weight: bold !important;
position: absolute !important;
}

.tos-section-item > p {
margin-left: 40px !important;
display: inline-block !important;
position: relative !important;
margin-top: 0px !important;
/*top: -21px !important;*/
}

.tos-section-alpha {
list-style: none !important;
counter-reset: tos-section-alpha-counter;
}

.tos-section-alpha > li::after {
min-width: 30px !important;
}

.tos-section-alpha > li::before {
content: '(' counter(tos-section-alpha-counter, lower-alpha) ')';
counter-increment: tos-section-alpha-counter;
position: absolute !important;
/*min-width: 20px !important;*/
}

.tos-section-alpha > li p {
margin-left: 40px !important;
/* display: inline-block !important; */
position: relative !important;
/*top: -21px !important;*/
margin-top: 0px !important;
}
}
</style>

<main id="main" role="main" class="clearfix width-100" aria-label="Content" tabindex="-1">
<div class="fusion-row" style="max-width:100%;">
<div id="content" class="full-width">
<div id="post-24" class="post-24 page type-page status-publish hentry" style="padding-left:30px; padding-right:30px">

<div class="post-content">
<div class="fusion-fullwidth fullwidth-box nonhundred-percent-fullwidth"
style="background-color: white;background-position: left top;background-repeat: no-repeat;padding-top:20px;padding-right:30px;padding-bottom:20px;padding-left:30px;border-top-width:0px;border-bottom-width:0px;border-color:#eae9e9;border-top-style:solid;border-bottom-style:solid;">
<div class="fusion-builder-row fusion-row ">

<div class="fusion-layout-column fusion_builder_column fusion_builder_column_1_1 fusion-one-full fusion-column-first fusion-column-last 1_1" style="margin-top:0px;margin-bottom:20px;">
<div class="fusion-column-wrapper" style="background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;" data-bg-url="">
<div class="fusion-title title fusion-sep-none fusion-title-size-two fusion-border-below-title"
style="margin-top:40px;margin-bottom:0px;">
<h1>Terms of Service</h1>
${tos_html}
<div class="fusion-fullwidth fullwidth-box hundred-percent-fullwidth fusion-equal-height-columns"
style="background-color: #dddddd;background-position: left top;background-repeat: no-repeat;padding-top:45px;padding-right:23%;padding-bottom:20px;padding-left:23%;border-top-width:0px;border-bottom-width:0px;border-color:#eae9e9;border-top-style:solid;border-bottom-style:solid; margin-top: 30px;">
<div class="fusion-builder-row fusion-row ">
<div class="fusion-layout-column fusion_builder_column fusion_builder_column_1_1 fusion-one-full fusion-column-first fusion-column-last 1_1"
style="margin-top:0px;margin-bottom:20px;">
<div class="fusion-column-wrapper"
style="background-color: rgb(58, 73, 88); border-left: 9px solid rgb(132, 193, 152); padding: 27px; background-position: left top; background-repeat: no-repeat; background-size: cover; /*min-height: 135px;*/ height: auto;"
data-bg-url="">
<p class="ca2ves-goals"
style="font-size: 20px; line-height: 27px; color: #fff;">
By clicking "Agree" I am representing that I have read the
above Terms, and expressly acknowledge and agree to the
above Terms.
</p>
<div class="fusion-clearfix"></div>

</div>
</div>
</div>
</div>
</div>
<div class="fusion-clearfix"></div>
</div>
</div>

</div>
</div>
</div>
</div>
</div>
</div> <!-- fusion-row -->
</main> <!-- #main -->
10 changes: 10 additions & 0 deletions lms/templates/termsofservice/modal_termsofservice.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

<%page expression_filter="h"/>
<%namespace name='static' file='../static_content.html'/>
<div>
<div id="tos-modal" aria-label="TOS-Modal" tabindex="-1"></div>

<%static:webpack entry="TOSModalView">
new TOSModalView();
</%static:webpack>
</div>
3 changes: 3 additions & 0 deletions lms/templates/termsofservice/tos_content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
{{tos_html | safe}}
</div>
3 changes: 3 additions & 0 deletions lms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
from openedx.features.enterprise_support.api import enterprise_enabled
from common.djangoapps.student import views as student_views
from common.djangoapps.util import views as util_views
from openedx.features.termsofservice import views as tos_views

RESET_COURSE_DEADLINES_NAME = 'reset_course_deadlines'
RENDER_XBLOCK_NAME = 'render_xblock'
Expand Down Expand Up @@ -111,6 +112,8 @@
# Static template view endpoints like blog, faq, etc.
path('', include('lms.djangoapps.static_template_view.urls')),

path('', include('openedx.features.termsofservice.urls')),

path('heartbeat', include('openedx.core.djangoapps.heartbeat.urls')),

path('i18n/', include('django.conf.urls.i18n')),
Expand Down
Empty file.
27 changes: 27 additions & 0 deletions openedx/features/termsofservice/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# lint-amnesty, pylint: disable=missing-module-docstring

from django.contrib import admin
from .models import TermsOfService, TermsOfServiceAcknowledgement, TermsOfServiceSites, TermsOfServiceAllSites
# Register your models here.


class TermsOfServiceAdmin(admin.ModelAdmin):
list_display = ('id', 'curf_id')


class TermsOfServiceAcknowledgementAdmin(admin.ModelAdmin):
list_display = ('id', 'user', 'curf')


class TermsOfServiceSitesAdmin(admin.ModelAdmin):
list_display = ('site', 'curf')


class TermsOfServiceAllSitesAdmin(admin.ModelAdmin):
list_display = ('curf',)


admin.site.register(TermsOfService, TermsOfServiceAdmin)
admin.site.register(TermsOfServiceAcknowledgement, TermsOfServiceAcknowledgementAdmin)
admin.site.register(TermsOfServiceSites, TermsOfServiceSitesAdmin)
admin.site.register(TermsOfServiceAllSites, TermsOfServiceAllSitesAdmin)
Empty file.
Empty file.
13 changes: 13 additions & 0 deletions openedx/features/termsofservice/api/v1/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# pylint: disable=missing-module-docstring

"""
Contains URLs for the Terms of Service API
"""
from django.urls import path
from django.contrib.auth.decorators import login_required

from openedx.features.termsofservice.api.v1.views import terms_of_service_api

urlpatterns = [
path('v1/current_tos/', login_required(terms_of_service_api), name='current_tos')
]
Loading
Loading