-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add frontend view for course feedback
feat: Add basic frontend configuration fix: move to frontend folder feat: first approx to xp frontend templates fix: extract static folder from course experience fix: render react basic component feat: set environment and add report button feat: add feedback carousel component in template feat: add styles from learning mfe of stage This styles were built by learning mfe. This includes paragon vars that allow give more beauty approach to the component. feat: add paragon styles refactor: move main view to feedback courses view feat: generate final js file by using frontend-build chore: remove unused dependencies and add missing dependency feat: add templates files config feat: add backend for edxmako style: pass isort and pytest feat: change url for frontend courses test: add unittest for edxmako templates This is for course experience feedback templates. feat: add template render extra test style: add docstrings for tests feat: add hash to webpack built to uncache CDN Revert "feat: add hash to webpack built to uncache CDN" This reverts commit cd789c2. fix: remove extra typo ; rendered in the component chore: pr feedback improve docstring feat: remove unnecessary pasted styles feat: add custom styles to manage feedback title feat: unset background color for body
- Loading branch information
1 parent
77ef5f1
commit ced74ad
Showing
27 changed files
with
36,648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"], | ||
"plugins": ["@babel/plugin-proposal-class-properties"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
BASE_URL='http://lms.mango.edunext.link:8000' | ||
ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload' | ||
LMS_BASE_URL=http://lms.mango.edunext.link:8000 | ||
BASE_URL='http://localhost:2000' | ||
CONTACT_URL='http://lms.mango.edunext.link:8000/contact' | ||
CREDENTIALS_BASE_URL='http://localhost:18150' | ||
CREDIT_HELP_LINK_URL='https://edx.readthedocs.io/projects/edx-guide-for-students/en/latest/SFD_credit_courses.html#keep-track-of-credit-requirements' | ||
CSRF_TOKEN_API_PATH='/csrf/api/v1/token' | ||
DISCOVERY_API_BASE_URL='http://localhost:18381' | ||
DISCUSSIONS_MFE_BASE_URL='http://localhost:2002' | ||
ECOMMERCE_BASE_URL='http://localhost:18130' | ||
ENABLE_JUMPNAV='true' | ||
ENABLE_NOTICES='' | ||
ENTERPRISE_LEARNER_PORTAL_HOSTNAME='localhost:8734' | ||
EXAMS_BASE_URL='http://localhost:18740' | ||
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico | ||
IGNORED_ERROR_REGEX='' | ||
LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference' | ||
LOGIN_URL='http://lms.mango.edunext.link:8000/login' | ||
LOGOUT_URL='http://lms.mango.edunext.link:8000/logout' | ||
LOGO_URL='http://lms.mango.edunext.link:8000/theming/asset/images/logo.png' | ||
LOGO_TRADEMARK_URL='http://lms.mango.edunext.link:8000/theming/asset/images/logo.png' | ||
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg | ||
LEGACY_THEME_NAME='' | ||
MARKETING_SITE_BASE_URL='http://lms.mango.edunext.link:8000' | ||
REFRESH_ACCESS_TOKEN_ENDPOINT='http://lms.mango.edunext.link:8000/login_refresh' | ||
SEARCH_CATALOG_URL='http://lms.mango.edunext.link:8000/courses' | ||
SEGMENT_KEY='' | ||
SITE_NAME='edX' | ||
SOCIAL_UTM_MILESTONE_CAMPAIGN='edxmilestone' | ||
STUDIO_BASE_URL='http://localhost:18010' | ||
SUPPORT_URL='https://support.edx.org' | ||
SUPPORT_URL_CALCULATOR_MATH='https://support.edx.org/hc/en-us/articles/360000038428-Entering-math-expressions-in-assignments-or-the-calculator' | ||
SUPPORT_URL_ID_VERIFICATION='https://support.edx.org/hc/en-us/articles/206503858-How-do-I-verify-my-identity' | ||
SUPPORT_URL_VERIFIED_CERTIFICATE='https://support.edx.org/hc/en-us/articles/206502008-What-is-a-verified-certificate' | ||
TERMS_OF_SERVICE_URL='https://www.edx.org/edx-terms-service' | ||
TWITTER_HASHTAG='myedxjourney' | ||
TWITTER_URL='https://twitter.com/edXOnline' | ||
USER_INFO_COOKIE_NAME='edx-user-info' | ||
SESSION_COOKIE_DOMAIN='mango.edunext.link:8000' | ||
MFE_CONFIG_API_URL=/eox-nelp/api/mfe_config/v1/ | ||
COURSE_EXPERIENCE_API_URL=/eox-nelp/api/experience/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
25 changes: 25 additions & 0 deletions
25
eox_nelp/course_experience/frontend/src/components/FeedbackCarousel/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { useState} from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { APP_INIT_ERROR, APP_READY, subscribe, initialize } from '@edx/frontend-platform'; | ||
import { getLocale, getMessages, IntlProvider } from '@edx/frontend-platform/i18n'; | ||
import { FeedbackCarousel, messages as essentialsMessages } from '@edunext/frontend-essentials' | ||
|
||
import './index.scss'; | ||
|
||
|
||
function LaunchFeedbackCarousel() { | ||
const [locale, setLocale] = useState(getLocale()); | ||
|
||
return ( | ||
<IntlProvider locale={locale} messages={getMessages()}> | ||
<FeedbackCarousel /> | ||
</IntlProvider> | ||
); | ||
} | ||
|
||
subscribe(APP_READY, () => { | ||
ReactDOM.render(<LaunchFeedbackCarousel />, document.getElementById('feedback-courses-carousel')); | ||
|
||
}); | ||
|
||
initialize({ messages: [essentialsMessages]}); |
17 changes: 17 additions & 0 deletions
17
eox_nelp/course_experience/frontend/src/components/FeedbackCarousel/index.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@import "~@edx/brand/paragon/fonts"; | ||
@import "~@edx/brand/paragon/variables"; | ||
@import "~@edx/paragon/scss/core/core"; | ||
@import "~@edx/brand/paragon/overrides"; | ||
|
||
#feedback-courses-carousel .feedback-container .feedback-carousel-title { | ||
margin: 0 0 20px 0; | ||
color: var(--pgn-color-primary-base); | ||
} | ||
|
||
body { | ||
background-color: unset; | ||
} | ||
|
||
.feedback-card { | ||
background: white; | ||
} |
Empty file.
12 changes: 12 additions & 0 deletions
12
eox_nelp/course_experience/frontend/templates/feedback_courses.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<%namespace name='static' file='static_content.html'/> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Feedback courses general</title> | ||
<link rel="stylesheet" href="${static.url('feedback_carousel/css/feedback_carousel.css')}"> | ||
</head> | ||
<body> | ||
<div id="feedback-courses-carousel"></div> | ||
<script src="${static.url('feedback_carousel/js/feedback_carousel.js')}"></script> | ||
</body> | ||
</html> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""This file contains all the test for the course_experience views.py file. | ||
Classes: | ||
CourseExperienceFrontendTestCase: Test CourseExperienceFrontendView template. | ||
""" | ||
from django.apps import apps | ||
from django.http import HttpResponse | ||
from django.shortcuts import render | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
from mock import patch | ||
from rest_framework.test import APIClient | ||
|
||
|
||
class FrontendFeedbackCourseTestCase(TestCase): | ||
""" Test FeedbackCoursesTemplate view """ | ||
|
||
def setUp(self): # pylint: disable=invalid-name | ||
""" | ||
Set base variables and objects across experience test cases. | ||
""" | ||
self.client = APIClient() | ||
self.url_endpoint = reverse("course-experience-frontend:feedback-courses") | ||
|
||
@patch("eox_nelp.templates_config.edxmako") | ||
def test_edxmako_render_correct_call(self, edxmako_mock): | ||
""" Test edxmako functions from edxapp_wrapper are called with the right values. | ||
Expected behavior: | ||
- `edxmako_mock.paths.add_lookup` is called with course_experience_template_path. | ||
(The path of course xp templates is used) | ||
- The get request to the url_endpoint is using the template `feedback_courses.html`. | ||
""" | ||
course_experience_template_path = apps.get_app_config('eox_nelp').path + "/course_experience/frontend/templates" | ||
edxmako_mock.shortcuts.render_to_response.return_value = HttpResponse(content='Template mock') | ||
|
||
self.client.get(self.url_endpoint) | ||
|
||
edxmako_mock.paths.add_lookup.assert_called_with('main', course_experience_template_path) | ||
edxmako_mock.shortcuts.render_to_response.assert_called_with("feedback_courses.html", {}, 'main', None) | ||
|
||
@patch("eox_nelp.course_experience.frontend.views.render_to_response") | ||
def test_feedback_course_template_behaviour(self, render_to_response_mock): | ||
""" The correct rendering of the feedback courses template using the url_endpoint | ||
for frontend feedback courses. | ||
Expected behavior: | ||
- Status code 200. | ||
- Response has the correct title page. | ||
- Response has the main div for feedback courses carousel. | ||
- Response has the correct path to load styles with feedback carrousel css. | ||
- Response has the correct path to load script with feedback carrousel js. | ||
""" | ||
render_to_response_mock.return_value = render(None, "feedback_courses.html") | ||
|
||
response = self.client.get(self.url_endpoint) | ||
|
||
self.assertContains(response, '<title>Feedback courses general</title>', status_code=200) | ||
self.assertContains(response, '<div id="feedback-courses-carousel"></div') | ||
self.assertContains(response, 'feedback_carousel/css/feedback_carousel.css') | ||
self.assertContains(response, 'feedback_carousel/js/feedback_carousel.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""frontend templates urls for course_experience""" | ||
from django.urls import path | ||
|
||
from eox_nelp.course_experience.frontend import views | ||
|
||
app_name = "eox_nelp" # pylint: disable=invalid-name | ||
|
||
urlpatterns = [ | ||
path('feedback/courses/', views.FeedbackCoursesTemplate.as_view(), name='feedback-courses') | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Frontend Views file. | ||
Contains all the views for render react views using django templates. | ||
These views render frontend react components from npm like frontend essentials. | ||
classes: | ||
FeedbackCoursesTemplate: View template that render courses carousel. | ||
""" | ||
from django.views import View | ||
|
||
from eox_nelp.templates_config import render_to_response | ||
|
||
|
||
class FeedbackCoursesTemplate(View): | ||
"""Eoxnelp CoursesFeedbackTemplate view class. | ||
General feedback courses template. | ||
""" | ||
|
||
def get(self, request): # pylint: disable=unused-argument | ||
"""Render start html""" | ||
return render_to_response("feedback_courses.html", {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
""" Backend abstraction """ | ||
from common.djangoapps import edxmako # pylint: disable=import-error | ||
|
||
|
||
def get_edxmako(): | ||
"""Allow to get edxmako from | ||
https://github.com/eduNEXT/edx-platform/blob/open-release/maple.master/common/djangoapps/edxmako/__init__.py | ||
Returns: | ||
edxmako module. | ||
""" | ||
return edxmako |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
Wrapper edxmako module. | ||
This contains all the required dependencies from modulestore | ||
Attributes: | ||
backend:Imported module by using the plugin settings. | ||
edxmako: Wrapper edxmako module. | ||
""" | ||
from importlib import import_module | ||
|
||
from django.conf import settings | ||
|
||
backend = import_module(settings.EOX_NELP_EDXMAKO_BACKEND) | ||
|
||
edxmako = backend.get_edxmako() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from mock import MagicMock | ||
|
||
|
||
def get_edxmako(): | ||
"""Test backend for eox_nelp.edxapp_wrapper.backends.edxmako_m_v1. | ||
Returns: | ||
Mock class. | ||
""" | ||
return MagicMock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
eox_nelp/static/feedback_carousel/css/feedback_carousel.css
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
eox_nelp/static/feedback_carousel/js/feedback_carousel.js.LICENSE.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/ | ||
|
||
/*! | ||
Copyright (c) 2018 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
|
||
/*! | ||
localForage -- Offline Storage, Improved | ||
Version 1.10.0 | ||
https://localforage.github.io/localForage | ||
(c) 2013-2017 Mozilla, Apache License 2.0 | ||
*/ | ||
|
||
/*! | ||
* cookie | ||
* Copyright(c) 2012-2014 Roman Shtylman | ||
* Copyright(c) 2015 Douglas Christopher Wilson | ||
* MIT Licensed | ||
*/ | ||
|
||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
|
||
/** | ||
* @mui/styled-engine v5.13.2 | ||
* | ||
* @license MIT | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v0.19.1 | ||
* scheduler.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v16.13.1 | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v16.14.0 | ||
* react-dom.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v16.14.0 | ||
* react-jsx-runtime.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** @license React v16.14.0 | ||
* react.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ |
Oops, something went wrong.