From 417ee8959fd0c7eb6284e5de4fbac869eb6cbff4 Mon Sep 17 00:00:00 2001 From: Abdullah Waheed Date: Fri, 17 Jun 2022 18:50:11 +0500 Subject: [PATCH 1/4] refactor: changed derecated table component to datatable --- credentials/static/components/FoldingTable.jsx | 5 +++-- credentials/static/components/ProgramRecord.jsx | 16 ++++++++-------- .../components/specs/ProgramRecord.test.jsx | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/credentials/static/components/FoldingTable.jsx b/credentials/static/components/FoldingTable.jsx index 085ee45f5..0e0826c33 100644 --- a/credentials/static/components/FoldingTable.jsx +++ b/credentials/static/components/FoldingTable.jsx @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { Table } from '@edx/paragon'; +import { DataTable } from '@edx/paragon'; /** * Depending on view width, either renders as a normal everyday @@ -23,8 +23,9 @@ class FoldingTable extends React.Component { renderTable() { return ( - ); diff --git a/credentials/static/components/ProgramRecord.jsx b/credentials/static/components/ProgramRecord.jsx index ddb5a84a1..918c41946 100644 --- a/credentials/static/components/ProgramRecord.jsx +++ b/credentials/static/components/ProgramRecord.jsx @@ -387,14 +387,14 @@ class ProgramRecord extends React.Component { columns={[ // Note that when you change one of these strings, you should look at // the foldedColumns for any necessary changes there too. - { key: 'name', label: gettext('Course Name') }, - { key: 'school', label: gettext('School') }, - { key: 'course_id', label: gettext('Course ID') }, - { key: 'percent_grade', label: gettext('Highest Grade Earned') }, - { key: 'letter_grade', label: gettext('Letter Grade') }, - { key: 'attempts', label: gettext('Verified Attempts') }, - { key: 'issue_date', label: gettext('Date Earned') }, - { key: 'status', label: gettext('Status') }, + { accessor: 'name', Header: gettext('Course Name') }, + { accessor: 'school', Header: gettext('School') }, + { accessor: 'course_id', Header: gettext('Course ID') }, + { accessor: 'percent_grade', Header: gettext('Highest Grade Earned') }, + { accessor: 'letter_grade', Header: gettext('Letter Grade') }, + { accessor: 'attempts', Header: gettext('Verified Attempts') }, + { accessor: 'issue_date', Header: gettext('Date Earned') }, + { accessor: 'status', Header: gettext('Status') }, ]} foldedColumns={[ { key: 'name', className: 'h6 font-weight-bold' }, diff --git a/credentials/static/components/specs/ProgramRecord.test.jsx b/credentials/static/components/specs/ProgramRecord.test.jsx index 7414ae761..7af83b57f 100644 --- a/credentials/static/components/specs/ProgramRecord.test.jsx +++ b/credentials/static/components/specs/ProgramRecord.test.jsx @@ -104,7 +104,7 @@ describe('', () => { const firstRowData = programRows.at(0).find('td'); expect(firstRowData.at(0).text()).toEqual(grades[0].name); - expect(firstRowData.at(0).key()).toEqual('name'); + expect(firstRowData.at(0).key()).toEqual('cell_0_name'); expect(firstRowData.at(1).text()).toEqual(grades[0].school); expect(firstRowData.at(2).text()).toEqual(grades[0].course_id); expect(firstRowData.at(3).text()).toEqual('82%'); @@ -115,7 +115,7 @@ describe('', () => { const thirdRowData = programRows.at(2).find('td'); expect(thirdRowData.at(0).text()).toEqual(grades[2].name); - expect(thirdRowData.at(0).key()).toEqual('name'); + expect(thirdRowData.at(0).key()).toEqual('cell_2_name'); expect(thirdRowData.at(1).text()).toEqual(grades[2].school); expect(thirdRowData.at(2).text()).toEqual(''); expect(thirdRowData.at(3).text()).toEqual(''); From 719205f64cf97e63e060c9f982f66bb0945be17a Mon Sep 17 00:00:00 2001 From: Abdullah Waheed Date: Wed, 6 Jul 2022 15:06:53 +0500 Subject: [PATCH 2/4] fix: missing single quote added that was crashing frontend --- credentials/templates/programs.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/credentials/templates/programs.html b/credentials/templates/programs.html index 4678ba2d5..eacfad745 100644 --- a/credentials/templates/programs.html +++ b/credentials/templates/programs.html @@ -36,7 +36,7 @@ isPublic: {{ is_public|yesno:"true,false"}}, uuid: '{{uuid}}', helpUrl: '{{records_help_url}}', - programListUrl: '{{program_list_url}}, + programListUrl: '{{program_list_url}}', }); {% endblock %} From bb46cdce352aceadb5a631d664b9552771d729a9 Mon Sep 17 00:00:00 2001 From: Abdullah Waheed Date: Fri, 15 Jul 2022 21:06:14 +0500 Subject: [PATCH 3/4] refactor: added override styles for edx.org theme --- credentials/templates/base.html | 1 + webpack.config.js | 1 + 2 files changed, 2 insertions(+) diff --git a/credentials/templates/base.html b/credentials/templates/base.html index 885029a2d..d29f5c6b6 100644 --- a/credentials/templates/base.html +++ b/credentials/templates/base.html @@ -17,6 +17,7 @@ {% if base_style_template %} {% include base_style_template %} + {% render_bundle 'override-style' 'css' %} {% else %} {% include '_base_style.html' %} {% endif %} diff --git a/webpack.config.js b/webpack.config.js index 102541ef3..13acb2c6c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -19,6 +19,7 @@ module.exports = { entry: { 'base.style-ltr': './credentials/static/sass/main-ltr.scss', 'base.style-rtl': './credentials/static/sass/main-rtl.scss', + 'override-style': './credentials/static/sass/overrides.scss', 'openedx.certificate.style-ltr': './credentials/apps/credentials_theme_openedx/static/sass/certificate-ltr.scss', 'openedx.certificate.style-rtl': './credentials/apps/credentials_theme_openedx/static/sass/certificate-rtl.scss', sharing: './credentials/static/js/sharing.js', From 8670b00f22b30bb2d60c79d930d44121193bde91 Mon Sep 17 00:00:00 2001 From: Abdullah Waheed Date: Fri, 15 Jul 2022 21:06:33 +0500 Subject: [PATCH 4/4] refactor: added missing file --- credentials/static/sass/overrides.scss | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 credentials/static/sass/overrides.scss diff --git a/credentials/static/sass/overrides.scss b/credentials/static/sass/overrides.scss new file mode 100644 index 000000000..3f0707e72 --- /dev/null +++ b/credentials/static/sass/overrides.scss @@ -0,0 +1,12 @@ +// ------------------------------ +// Overrides styles + +// ------------------------------ + +.pgn__data-table-cell-wrap { + max-width: 20vw; + display: table-cell !important; + white-space: normal; + overflow: hidden; + text-overflow: ellipsis; + } \ No newline at end of file