Skip to content

Commit

Permalink
Add unique title to course pages
Browse files Browse the repository at this point in the history
issue #5158
  • Loading branch information
nikolas committed Dec 18, 2023
1 parent aeee0f9 commit 3156cd0
Show file tree
Hide file tree
Showing 30 changed files with 52 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Assignment Feature: Instructor Creation', () => {
.contains('Add Assignment').click();

cy.log('Go through the wizard');
cy.title().should('eq', 'Mediathread Create Assignment');
cy.title().should('eq', 'Create Assignment | Mediathread');
cy.wait(500);
cy.get('a.nav-link.active').contains('Assignments');
cy.get('.breadcrumb-item').contains('Back to all assignments');
Expand Down Expand Up @@ -59,7 +59,7 @@ describe('Assignment Feature: Instructor Creation', () => {
cy.get('#id_publish_1').click();
cy.get('#save-assignment').click();

cy.title().should('eq', 'Mediathread Assignment: Scenario 1');
cy.title().should('eq', 'Assignment: Scenario 1 | Mediathread');
cy.get('.btn-edit-assignment').should('exist');
cy.get('#student-response-dropdown')
.contains('0 of 3 Students Responded').should('be.visible');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Assignment Feature: Student Response', () => {
it('creates a response as a Student', () => {
cy.log('respond as a student');
cy.get('#cu-privacy-notice-button').click();
cy.title().should('eq', 'Mediathread Sample Assignment');
cy.title().should('eq', 'Sample Assignment | Mediathread');
cy.get('.page-title').should('contain', 'Sample Assignment');
cy.get('[data-cy="assignment-visibility"]').should('not.exist');
cy.get('.project-revisionbutton').should('not.exist');
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/6.discussions/discussion.feat.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Discussion View: Create Discussion', () => {
.contains('Add Assignment').click();

cy.log('create discussion wizard');
cy.title().should('eq', 'Mediathread Create Assignment');
cy.title().should('eq', 'Create Assignment | Mediathread');
cy.wait(500);
cy.get('a.nav-link.active').contains('Assignments');
cy.get('.breadcrumb-item').contains('Back to all assignments');
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('Discussion View: Create Discussion', () => {
cy.get('#save-assignment').click();

cy.log('View discussion as an instructor');
cy.title().should('eq', 'Mediathread Discussion: Scenario 1');
cy.title().should('eq', 'Discussion: Scenario 1 | Mediathread');
cy.get('.btn-edit-assignment').should('exist');
cy.get('.project-visibility-description')
.contains('Shared with Class');
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('Discussion View: Create Discussion', () => {
cy.get('a').contains('Add Comments').click();

cy.log('View discussion as a student');
cy.title().should('eq', 'Mediathread Discussion: Scenario 1');
cy.title().should('eq', 'Discussion: Scenario 1 | Mediathread');
cy.get('.btn-edit-assignment').should('not.exist');
cy.get('.project-visibility-description').should('not.exist');
cy.contains('Due').should('be.visible');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Selection Assignment Feat: Instructor Creation', () => {
cy.visit('/course/1/project/create/sa/');
cy.get('#cu-privacy-notice-button').click();
//TODO: test selection creation from homepage
cy.title().should('eq', 'Mediathread Create Assignment');
cy.title().should('eq', 'Create Assignment | Mediathread');
cy.contains('Next').click();
cy.contains('Choose an item from the course collection')
.should('exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Sequence Assignment Feat: Instructor Creation', () => {
cy.contains('Add an assignment').click({force: true});
cy.get('#addSequenceAssignment').click({force: true});
cy.contains('Next').click();
cy.title().should('eq', 'Mediathread Create Sequence Assignment');
cy.title().should('eq', 'Create Sequence Assignment | Mediathread');
cy.contains('Next').click({force: true});
cy.contains('Write title & instructions').should('exist');
cy.contains('Next').click({force: true});
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/99.sequenceproject/sequence.feat.1.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Sequence Project Feat: Student Creation', () => {
cy.get('#cu-privacy-notice-button').click();
cy.get('#projects-list').click();
cy.get('#add-sequence-button').click({force: true});
cy.title().should('contain', 'Mediathread — Untitled');
cy.title().should('contain', 'Untitled | Mediathread');
cy.get('.btn-edit-assignment').should('not.exist');
cy.get('button.btn-show-submit').should('not.exist');
cy.contains('Place secondary elements').should('be.visible');
Expand Down
18 changes: 9 additions & 9 deletions media/js/bundle.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions media/js/src/CollectionTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,18 @@ export default class CollectionTab extends React.Component {
enterAssetDetailView(e, asset) {
followLink(e);

if (asset && asset.title) {
jQuery('title').text(asset.title + ' | Mediathread');
}

jQuery('.collection-header')
.removeClass('d-flex')
.addClass('d-none');

jQuery('.collectionAdd')
.removeClass('show');


// Need to fetch the asset to get all the selections. The
// collection view's selections are filtered by AssetFilter.
const me = this;
Expand All @@ -167,6 +172,11 @@ export default class CollectionTab extends React.Component {

followLink(e);

if (window.MediaThread && window.MediaThread.current_course_title) {
jQuery('title').text(
window.MediaThread.current_course_title + ' | Mediathread');
}

// If the collection's assets haven't been fetched yet (if the
// user navigated directly to the item detail page), we need
// to make sure to fetch the assets.
Expand Down
3 changes: 2 additions & 1 deletion mediathread/templates/base_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Mediathread {% block title %}{% endblock %}</title>
<title>{% block title %}{% endblock %} Mediathread</title>

<meta id="csrf-token" name="csrf-token" content="{{csrf_token}}">

Expand Down Expand Up @@ -178,6 +178,7 @@ <h6 id="course-title" class="course-title">

{% if request.course %}
this.current_course = {{ request.course.pk }};
this.current_course_title = '{{ request.course.title }}';
this.current_course_has_vocab = {% if request.course.vocabulary_set.count > 0 %}true{% else %}false{% endif %};
this.allow_item_download = {% if allow_item_download %}true{% else %}false{% endif %};
{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion mediathread/templates/courseaffils/course_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{% load static %}

{% block title %}
Home
{% if object %}
{{ object.title }} |
{% endif %}
{% endblock %}

{% block masthead %}
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/courseaffils/course_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load coursetags %}
{% load static %}

{% block title %}&mdash; My Courses{% endblock %}
{% block title %}My Courses |{% endblock %}

{% block coursetitle %}
My Courses
Expand Down
2 changes: 0 additions & 2 deletions mediathread/templates/courseaffils/course_update_form.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% extends 'dashboard/base_course_dashboard.html' %}
{% load bootstrap4 %}

{% block title %}{{block.super}}&mdash; Manage Course{% endblock %}

{% block dashboard_content %}
{{ form.media }}
<form action="" method="post">{% csrf_token %}
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/dashboard/base_course_dashboard.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'base_new.html' %}

{% block title %}&mdash; Manage Course {% endblock %}
{% block title %}Manage Course |{% endblock %}

{% block messages %}
{% if messages %}
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/dashboard/class_manage_sources.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'dashboard/base_course_dashboard.html' %}
{% load assetlinks %}
{% block title %}{{block.super}}&mdash; Manage Sources{% endblock %}
{% block title %}{{block.super}} | Manage Sources |{% endblock %}

{% block dashboard_content %}

Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/dashboard/class_migrate.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'dashboard/base_course_dashboard.html' %}
{% load coursetags %}

{% block title %}{{block.super}}&mdash; Migrate Course Materials{% endblock %}
{% block title %}{{block.super}} | Migrate Course Materials |{% endblock %}

{% block uncompressable_css %}
<script type="text/javascript" src="{{STATIC_URL}}js/underscore/underscore-min.js"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'dashboard/base_course_dashboard.html' %}

{% block title %}{{block.super}}&mdash; Panopto Ingest Log{% endblock %}
{% block title %}{{block.super}} | Panopto Ingest Log{% endblock %}

{% block dashboard_content %}
<div class="col-12 col-md">
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/dashboard/class_panopto_source.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'dashboard/base_course_dashboard.html' %}
{% load assetlinks %}
{% block title %}Panopto Source Folder{% endblock %}
{% block title %}Panopto Source Folder |{% endblock %}

{% block switchcourse %}{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/dashboard/class_roster.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'dashboard/base_course_dashboard.html' %}
{% load coursetags %}
{% load static %}
{% block title %}{{block.super}}&mdash; Course Roster{% endblock %}
{% block title %}{{block.super}} | Course Roster |{% endblock %}

{% block css %}
<link rel="stylesheet" href="{% static 'js/lib/tablesorter/theme.default.min.css' %}">
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/main/course_activate.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load bootstrap3 %}
{% load methtags %}

{% block title %}&mdash; Activate Course{% endblock %}
{% block title %}Activate Course |{% endblock %}

{% block css %}
<link rel="stylesheet" href="{% static 'css/bootstrap-datepicker3.min.css' %}" />
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/registration/activate.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base_new.html" %}
{% load i18n %}
{% block title %}&mdash; {% if account %}Activation complete{% else %}Activation problem{% endif %}{% endblock %}
{% block title %}{% if account %}Activation complete{% else %}Activation problem{% endif %} |{% endblock %}

{% block registration_content %}
<h2 class="pagetitle signuptitle">Account Activation</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base_new.html" %}
{% load i18n %}
{% block title %}&mdash; Account activation complete{% endblock %}
{% block title %}Account activation complete |{% endblock %}

{% block content %}
<h2 class="pagetitle signuptitle">Account activation completed.</h2>
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/registration/invitation_accept.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base_new.html" %}
{% load i18n static %}
{% block title %}&mdash; Course Invitation{% endblock %}
{% block title %}Course Invitation |{% endblock %}

{% block css %}
<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base_new.html" %}
{% load i18n %}
{% block title %}&mdash; Course Invitation Accepted{% endblock %}
{% block title %}Course Invitation Accepted |{% endblock %}

{% block content %}
<h2 class="pagetitle signuptitle">Course Invitation Accepted</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base_new.html" %}
{% load i18n %}

{% block title%}&mdash; Change Password{% endblock %}
{% block title%}Change Password |{% endblock %}

{% block content %}
<h2 class="pagetitle signuptitle">Change password</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base_new.html" %}
{% load i18n %}

{% block title%}&mdash; Change Password{% endblock %}
{% block title%}Change Password |{% endblock %}

{% block css %}
<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base_new.html" %}
{% load i18n %}

{% block title %}&mdash; Confirm Password Reset{% endblock %}
{% block title %}Confirm Password Reset |{% endblock %}

{% block css %}
<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base_new.html" %}
{% load i18n %}

{% block title %}&mdash; Reset Password{% endblock %}
{% block title %}Reset Password |{% endblock %}

{% block content %}
<h2 class="pagetitle signuptitle">Reset Password</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base_new.html" %}
{% load i18n %}

{% block title %}&mdash; Reset Password{% endblock %}
{% block title %}Reset Password |{% endblock %}

{% block css %}
<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base_new.html" %}
{% load i18n %}
{% block title %}&mdash; Activation email sent{% endblock %}
{% block title %}Activation email sent |{% endblock %}

{% block content %}
<h2 class="pagetitle signuptitle">Thank you!</h2>
Expand Down
2 changes: 1 addition & 1 deletion mediathread/templates/registration/registration_form.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base_new.html" %}
{% load i18n static %}
{% block title %}&mdash; Sign up for an account{% endblock %}
{% block title %}Sign up for an account |{% endblock %}

{% block css %}
<style>
Expand Down

0 comments on commit 3156cd0

Please sign in to comment.