-
Notifications
You must be signed in to change notification settings - Fork 2
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
#157 Serve Catalog Page from Wagtail #411
#157 Serve Catalog Page from Wagtail #411
Conversation
@ahmed-arbisoft you need to rebase it. I have looked into the PR, it looks good me. 👍 |
77447ea
to
005b9bf
Compare
Codecov Report
@@ Coverage Diff @@
## master #411 +/- ##
==========================================
+ Coverage 94.32% 94.35% +0.02%
==========================================
Files 202 202
Lines 6560 7105 +545
Branches 370 439 +69
==========================================
+ Hits 6188 6704 +516
- Misses 301 323 +22
- Partials 71 78 +7
Continue to review full report at Codecov.
|
@pdpinch Do we need to be able to link directly to the programs or courses tab in the catalog? To put it another way: If a user is on the course catalog with the "Programs" tab selected and reloads the page, is it important that the user remain on the "Programs" tab? If so, do you have any strong opinions about what the path should be, e.g.: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
courses.views.CourseCatalogView
should be removed, shouldn't it?
cms/models.py
Outdated
"HUBSPOT_NEW_COURSES_FORM_GUID" | ||
), | ||
) | ||
return context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you can remove the super()
call on the first line, and this return can be changed to:
return dict(
**super().get_context(request),
**get_js_settings_context(request),
program_pages=program_pages,
course_pages=course_pages,
default_image_path=DEFAULT_COURSE_IMG_PATH,
hubspot_portal_id=settings.HUBSPOT_CONFIG.get("HUBSPOT_PORTAL_ID"),
hubspot_new_courses_form_guid=settings.HUBSPOT_CONFIG.get(
"HUBSPOT_NEW_COURSES_FORM_GUID"
),
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
</div> | ||
</div> | ||
<div class="bottom"> | ||
<input type="checkbox" class="toggle" id="collapsible_{{ tab }}_{{ object_type }}_{{ courseware_page.pk }}" data-target="#collapse-{{ tab }}-{{ object_type }}-{{ courseware_page.pk }}" data-toggle="collapse" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we should use the 'with' templatetag to define these complex id's rather than redefining them. Also, wouldn't it be sufficient just to define them as something like collapsible_{{ courseware_page.pk }}
? Shouldn't the pk value be unique for each object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating to collapsible_{{ tab}}_{{ coursewate_page.pk }}
as the same page can appear in another tab and we don't want to be toggling in both tabs at once.
<ul class="program-course-links"> | ||
{% for course_page in courseware_page.course_pages %} | ||
<li> | ||
<a href="{% pageurl course_page %}" target="_blank"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a requirement that these links open in a new tab? Same comment for the link at line 82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, it was requested by @asadiqbal08 do you want me to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NVM, I just went ahead and removed it, was creating too many tabs anyway.
courses/views_test.py
Outdated
course=CourseFactory.create(program=program, live=True) | ||
) | ||
course_page_no_program = CoursePageFactory.create( | ||
course=CourseFactory.create(no_program=True, live=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good change, but I think the create
calls can be simplified:
course_page_in_program = CoursePageFactory.create(
course__program=program, course__live=True
)
course_page_no_program = CoursePageFactory.create(
course__no_program=True, course__live=True
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
ProgramPageFactory.create(program=program) | ||
CoursePageFactory.create(course=course_in_program) | ||
CoursePageFactory.create(course=course_no_program) | ||
program_page = ProgramPageFactory.create(program=program) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
courses/views_test.py
Outdated
catalog_page = CatalogPage(title="Catalog", slug="catalog") | ||
catalog_page = Site.objects.get(is_default_site=True).root_page.add_child( | ||
catalog_page, "last-child" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a fixture for (a) the root page (Site.objects.get(is_default_site=True).root_page
), and (b) the catalog page (lines 210 to here). The catalog page fixture would user the root page fixture, then this test case would use the catalog page fixture. You can just define them at the top of this module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
mitxpro/urls_test.py
Outdated
@@ -1,12 +1,7 @@ | |||
"""Tests for URLs""" | |||
|
|||
from unittest import TestCase | |||
from django.urls import reverse | |||
|
|||
|
|||
class URLTests(TestCase): | |||
"""URL tests""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file can be deleted. It's not doing anything for us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
@gsidebo asked:
I think the current implementation, with one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last thing
</div> | ||
<div class="bottom"> | ||
{% with page_id=courseware_page.pk|stringformat:"i" %} | ||
{% with collapse_id="collapsible_"|add:tab|add:"_"|add:page_id|add:page_id collapse_input_id="collapse_"|add:tab|add:page_id %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Looks like you're adding
page_id
twice to the first var:add:page_id|add:page_id
- The
collapse_input_id
value should have an underscore betweentab
andpage_id
- Any reason we can't combine these definitions with the
page_id
definition above to make onewith
block instead of 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- That' a typo, will fix it in the next commit
- Will update.
- The
tab
variable is string andcourseware_page.pk
is an int. Using both in the same chain ofadd
filter does not play nice with string concatenation so we have to convert it to a string before we can use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 👍
Missed change Rebase and Migration Fixes Feedback collapsible tags fix Fix typo and feedback
6073c32
to
74ab561
Compare
Pre-Flight checklist
What are the relevant tickets?
Closes #157
Closes #378
What's this PR do?
Simplifies catalog page structure. Removes extraneous html markup. Configures wagtail to server the catalog page.
How should this be manually tested?
Go to the catalog page by clicking the link in the header or going to the path
/catalog/
in your deployment. The page should appear as per specifications.