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

Added conditional text color for partial marks in marks_panel.jsx #6483

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions app/assets/javascripts/Components/Result/marks_panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ export class CheckboxCriterionInput extends React.Component {
render() {
const unassignedClass = this.props.unassigned ? "unassigned" : "";
const expandedClass = this.props.expanded ? "expanded" : "collapsed";
let partialMarkClass = "";
if (
this.props.mark !== undefined &&
this.props.mark !== null &&
this.props.mark !== this.props.max_mark
) {
partialMarkClass = "red-text";
}

return (
<li
id={`checkbox_criterion_${this.props.id}`}
Expand Down Expand Up @@ -207,7 +216,7 @@ export class CheckboxCriterionInput extends React.Component {
</label>
</span>
)}
<span className="mark">
<span className={`mark ${partialMarkClass}`}>
{this.props.mark === null ? "-" : this.props.mark}
&nbsp;/&nbsp;
{this.props.max_mark}
Expand Down Expand Up @@ -376,6 +385,14 @@ export class FlexibleCriterionInput extends React.Component {
render() {
const unassignedClass = this.props.unassigned ? "unassigned" : "";
const expandedClass = this.props.expanded ? "expanded" : "collapsed";
let partialMarkClass = "";
if (
this.props.mark !== undefined &&
this.props.mark !== null &&
this.props.mark !== this.props.max_mark
) {
partialMarkClass = "red-text";
}

let markElement;
if (this.props.released_to_students) {
Expand Down Expand Up @@ -413,7 +430,7 @@ export class FlexibleCriterionInput extends React.Component {
className="criterion-description"
dangerouslySetInnerHTML={{__html: safe_marked(this.props.description)}}
/>
<span className="mark">
<span className={`mark ${partialMarkClass}`}>
{markElement}
&nbsp;/&nbsp;
{this.props.max_mark}
Expand Down Expand Up @@ -460,12 +477,14 @@ export class RubricCriterionInput extends React.Component {
const levelMark = level.mark.toFixed(2);
let selectedClass = "";
let oldMarkClass = "";
let partialMarkClass = "";
if (
this.props.mark !== undefined &&
this.props.mark !== null &&
levelMark === this.props.mark.toFixed(2)
) {
selectedClass = "selected";
partialMarkClass = this.props.mark !== this.props.max_mark ? "red-text" : "";
}
if (
this.props.oldMark !== undefined &&
Expand All @@ -485,7 +504,7 @@ export class RubricCriterionInput extends React.Component {
<strong>{level.name}</strong>
<span dangerouslySetInnerHTML={{__html: safe_marked(level.description)}} />
</td>
<td className={"mark"}>
<td className={`mark ${partialMarkClass}`}>
{levelMark}
&nbsp;/&nbsp;
{this.props.max_mark}
Expand Down