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

Hide view writeup button when no writeup exists #1615

Merged
merged 5 commits into from
Sep 29, 2022
Merged

Conversation

damianhxy
Copy link
Member

Description

  • Hide view writeup button when writeup does not exist
  • Use flash instead of text to report when writeup does not exist

Note: Defining an analogous check for handouts is harder because the config file might override the default handout behavior

Also note: flash.now is necessary because we are rendering directly rather than redirecting (as otherwise the flash would persist for an additional page load). I have updated handout's code to use flash.now, but it appears that flash works too because the route is defined in a different file and that somehow makes a difference.

Motivation and Context

Currently, the view writeup button is visible to students even if no writeup exists. Furthermore, the error text is unnecessarily large.

How Has This Been Tested?

Before

Error Text
Screen Shot 2022-09-28 at 16 49 32

Button visible
Screen Shot 2022-09-28 at 16 49 48

After

Error Flash
Screen Shot 2022-09-28 at 16 49 58

Button not visible
Screen Shot 2022-09-28 at 16 49 55

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have run rubocop for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting

Copy link
Contributor

@20wildmanj 20wildmanj left a comment

Choose a reason for hiding this comment

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

  • verified writeup option disappears from menu when none specified
  • verified writeup button stills works when specified
  • verified new /writeup page modifications
    LGTM

app/views/assessments/show.html.erb Outdated Show resolved Hide resolved
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.

2 participants