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

Update display of question settings page #9687

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

mylesw27
Copy link
Collaborator

@mylesw27 mylesw27 commented Apr 4, 2024

This PR is intended to be the first step in adding editing functionality to the question settings page. Much of the art for this was from the course settings page where this has been previously implemented. In this PR, we are moving the fields into a <form> and updating the display to match our other editable pages. Future PRs will implement editing using the editor class.

Here is an example of the first pass at this:
Screenshot 2024-04-04 at 10 41 22 AM

Copy link
Contributor

github-actions bot commented Apr 4, 2024

All images

Image Platform Old Size New Size Change
prairielearn/executor:b7a27a408de04f5fb86c6c78b8d7f8d37a117b16 null 1642.81 MB 1642.81 MB -0.00%
prairielearn/prairielearn:b7a27a408de04f5fb86c6c78b8d7f8d37a117b16 linux/amd64 1642.99 MB 1642.81 MB -0.01%

}
</div>
</div>
</form>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended the form here. This is to prevent nested forms as we already have forms for public sharing and tests already on the page. However, I believe all of the fields that will want to be editable are captured in this form. That being said, is there a better way to do this? My concern here being that once we are ready to add a submit button, I am not sure where the best place is going to be for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense; we'd probably want to put the "save" button below the top part of the page. Of course, we're sort of developing new patterns here, so we can adjust as we go!

Comment on lines 248 to 271
${
resLocals.authz_data.has_course_permission_view
? resLocals.authz_data.has_course_permission_edit &&
!resLocals.course.example_course
? html`
<a
href="${resLocals.urlPrefix}/question/${resLocals.question
.id}/file_edit/${infoPath}"
>
Edit question configuration
</a>
in <code>info.json</code>
`
: html`
<a
href="${resLocals.urlPrefix}/question/${resLocals.question
.id}/file_view/${infoPath}"
>
View course configuration
</a>
in <code>info.json</code>
`
: ''
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece was intended to be similar to the course settings page.

@mylesw27 mylesw27 marked this pull request as ready for review April 9, 2024 18:36
Comment on lines 167 to 174
<div class="form-group">
<div>Topic</div>
<div name="topic">
${renderEjs(__filename, "<%- include('../partials/topic') %>", {
topic: resLocals.topic,
})}
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the form-group class will do much to help us here, and setting name="..." on a div won't do anything at all.

For better accessibility, I'd recommend using heading tags (<h1>, <h2>, etc.) as appropriate for these sections. Here's a primer if you're new to those: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated these to use <h2> for these sections in f9945bf. The display of <h2> was quite large for these subheaders so added class="h5" to reduce the text to a more appropriate size.

Comment on lines 179 to 181
${renderEjs(__filename, "<%- include('../partials/tags') %>", {
tags: resLocals.tags,
})}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we're giving ourselves more vertical space, maybe we render this as a list group instead? Something like this:

Screenshot 2024-04-17 at 11 50 43

Though we'd want to align the name/description in different columns, sort of like GitHub's "labels" page:

Screenshot 2024-04-17 at 12 09 52

Bootstrap's grid system will probably come in handy for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In f9945bf, updated the "Tags" section to look like the following: Screenshot 2024-04-18 at 5 19 43 PM

Comment on lines 185 to 198
<div class="form-group">
<div>
Issues
${renderEjs(__filename, "<%- include('../partials/issueBadge') %>", {
count: resLocals.open_issue_count,
issueQid: resLocals.question.qid,
suppressLink: resLocals.suppressLink,
urlPrefix: resLocals.urlPrefix,
})}
</div>
</div>
<hr />
<div class="form-group">
<div>Assessments</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit looks funky when there aren't any issues/assessments:

Screenshot 2024-04-17 at 12 11 47

A few ideas:

  • We might consider actually adding an "issues" tab to the instructor question view? That way we could get this out of this page entirely (it's a bit weird to have a link to a list of issues on a "settings" page IMO.

  • We could show the list of assessments with a Bootstrap list group, and maybe show extra information, e.g. the course instance. We could then have a nice empty state when there aren't any, e.g.:

    Screenshot 2024-04-17 at 12 17 26

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an "issues" tab in f9945bf: Screenshot 2024-04-18 at 5 00 08 PM
Currently, this new tab just links to the instructorIssues page with a query param of qid%3A{question.qid}. This will take the user to the existing issues page and filter by the current qid. I can build a specific questionIssues page in a future PR if this is a bit funky, but that seemed like a large endeavor to include in this PR and this seems to provide the functionality we would want here.

The assessments section now looks like this:
Screenshot 2024-04-18 at 5 05 03 PM
Assessments are grouped by course instance and displayed in a card for readability. I'm not certain on the columns we want included though. Currently I have label/badge, type, and title. Let me know if you would prefer any other columns here or to remove the type column if that is redundant (or if I should order these differently?).

Also, questions that are not included in any assessments now show the following:
Screenshot 2024-04-18 at 5 11 54 PM

Comment on lines 209 to 210
</div>
</form>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that these both end up at the same indentation level means that there's probably a mismatched tag somewhere above. See if you can find it; if not, I can take a look myself!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, my <form> and subsequent <div> were backwards. Updated in f9945bf.

@mylesw27 mylesw27 self-assigned this Apr 19, 2024
<div class="card-body">
<form>
<div class="form-group">
<label for="title" class="h5">Title</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be inclined to use normal label styling here (not h5). If you want to label this top section as a whole to match the headings on the other sections, you could add a <h2 class="h5">General</h2> above this.

Note also that we (I, technically) have sorta/kinda been standardizing on <h2 class="h4"> on the administrator pages. Ultimately we can go with what we think looks best here, but can we try out class="h4" to see how it looks?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a "General" section to the top and changed to `class="h4" in 381d728. How does this look?
Screenshot 2024-04-24 at 11 47 59 AM

? html`
<div>
<h2 class="h5">Tests</h5>
<div class="pl-3">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add horizontal padding here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had added horizontal padding here and elsewhere to help indent the information and help with readability. Removed in 381d728.

<div>
<h2 class="h5">Tests</h5>
<div class="pl-3">
${questionTestsForm({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use PascalCase here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to PascalCase in 381d728.

}) {
if (questionSharedPublicly) {
return html`
<div class="row px-3">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you say more about why you added horizontal padding here and elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated above, I thought it improved readability by indenting and adding a little bit of lateral separation from the header. Removed in 381d728.

Comment on lines 155 to 162
<div class="row px-3">
<div class="col-1">
${renderEjs(__filename, "<%- include('../partials/topic') %>", {
topic: resLocals.topic,
})}
</div>
<div class="col-auto">${resLocals.topic.description}</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we wrap this in a list group? I know there will only ever be one topic, but it feels like the badge + description want to be contained in something, IMO. We could do a similar treatment for tags if you like this?

Screenshot 2024-04-19 at 14 09 02
Suggested change
<div class="row px-3">
<div class="col-1">
${renderEjs(__filename, "<%- include('../partials/topic') %>", {
topic: resLocals.topic,
})}
</div>
<div class="col-auto">${resLocals.topic.description}</div>
</div>
<div class="list-group">
<div class="list-group-item d-flex align-items-center">
${renderEjs(__filename, "<%- include('../partials/topic') %>", {
topic: resLocals.topic,
})}
<span class="ml-3">${resLocals.topic.description}</span>
</div>
</div>

Copy link
Collaborator Author

@mylesw27 mylesw27 Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to this here and for tags locally in 381d728.

Screenshot 2024-04-24 at 11 58 44 AM

});
}

function AssessmentRows({ assessmentsWithQuestion }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some weird stuff happens on narrow viewports:

Screenshot 2024-04-19 at 14 11 42

I'm honestly wondering if we need to show this here; it seems strange to show this on a "settings" page? One can already see all assessments on which a question is used on the "statistics" question tab. cc @mwest1066 @mfsilva22 for input: would you be sad if the assessments list on the question settings page went away?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't be terrible to remove it, but I think it makes sense to have it here. I don't think that we need to show titles for the assessments, if that's what's causing the problems? At the moment we just show a nice compact list like this:
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to show the compact list by course instance in 381d728. Would something like this make sense?

Screenshot 2024-04-24 at 12 03 27 PM

and on narrower viewports:
Screenshot 2024-04-24 at 12 03 51 PM

We could also decide which content is hidden or displayed on certain size viewports by using Bootstraps built-in breakpoints (https://getbootstrap.com/docs/4.0/utilities/display/). This could also be useful for deciding if we render the descriptions in the topic and tags sections as well.

</div>
`
: ''}
<hr />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd advise moving this inside the following conditional. As written, we end up with an extra horizontal line for questions that can't be tested.

Screenshot 2024-04-19 at 14 37 21

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the horizontal line into the conditional in 381d728.

@@ -21,4 +21,9 @@
urlSuffix: '/question/'+question.id+'/statistics',
iconClasses: 'fas fa-chart-bar',
tabLabel: 'Statistics'}) %>
<%- include('navTab', {
activeSubPage: 'issues',
urlSuffix: '/course_admin/issues?q=qid%3A'+question.qid,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to take care to properly URL-encode the qid here.

What do you think about possibly showing a badge here with an issue count? That should already be available in resLocals.open_issue_count IIRC. Something like how GitHub displays issue/PR counts:

Screenshot 2024-04-19 at 14 49 42

Copy link
Member

@mwest1066 mwest1066 Apr 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please, a red badge like we already use for the main "Issues" navbar item.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to @nwalters512 help on Zoom, added a red badge in 381d728.

Screenshot 2024-04-24 at 12 10 40 PM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@mwest1066 mwest1066 removed the request for review from SethPoulsen May 2, 2024 16:05
Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 95.51821% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 66.79%. Comparing base (42959d3) to head (b7a27a4).
Report is 2 commits behind head on master.

Files Patch % Lines
...uestionSettings/instructorQuestionSettings.html.ts 95.51% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9687      +/-   ##
==========================================
+ Coverage   66.44%   66.79%   +0.34%     
==========================================
  Files         453      454       +1     
  Lines       70319    71146     +827     
  Branches     5656     5689      +33     
==========================================
+ Hits        46723    47519     +796     
- Misses      23173    23200      +27     
- Partials      423      427       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants