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

Lint views/users #1958

Merged
merged 5 commits into from
Sep 12, 2023
Merged

Lint views/users #1958

merged 5 commits into from
Sep 12, 2023

Conversation

20wildmanj
Copy link
Contributor

@20wildmanj 20wildmanj commented Aug 14, 2023

Summary

Summary generated by Reviewpad on 12 Sep 23 20:30 UTC

This pull request includes multiple file diffs with various code changes. Here is a summary of the changes:

  1. The file users.css.scss added a new CSS class .users-list-header-container, which sets the container's display to flex and aligns the content to the center with space between the items.

  2. The file _form.html.erb in the app/views/users directory has the following changes:

    • Line 4: The heading level of the error message has been changed from <h2> to <h3>.
    • Line 16: The submit button class attribute value has been changed to use hash syntax.
  3. The file app/views/users/index.html.erb has the following changes:

    • Added <% content_for :stylesheets do %> tag.
    • Added <%= stylesheet_link_tag "users" %> inside <% content_for :stylesheets do %> tag.
    • Modified the placement of the "Create user" link inside <div class="users-list-header-container">.
    • Added an else condition for when there are no users, displaying a message "There are currently no users that exist on Autolab.".
  4. The file users/show.html.erb has the following changes:

    • Lines 34-50: The link to edit user information has been updated to use a block syntax instead of raw HTML.
    • Lines 56-61: The link to delete a user has been updated to use a block syntax instead of raw HTML.
    • Lines 66-71: The link to change password has been updated to use a block syntax instead of raw HTML.
    • Lines 74-81: The link to revoke Github token has been updated to use a block syntax instead of raw HTML.
    • Lines 83-88: The link to connect to Github has been updated to use a block syntax instead of raw HTML.
    • Lines 93-98: The link to create a new activation has been updated to use a block syntax instead of raw HTML.
    • Lines 99-104: The link to manage authorized clients has been updated to use a block syntax instead of raw HTML.
  5. The file diff for a file, which contains the form fields for the user model, includes fixing indentation and adding comments to the check_box field for administrators to provide help text.

  6. The file new.html.erb has been modified to update the heading from <h1>New user</h1> to <h2>Create New User</h2>.

  7. The file edit.html.erb has the following changes:

    • Corrected the indentation of lines 7, 8, 9-17, 19, and 21.
    • The partial "_fields" is now being passed the f local variable.
    • The f.submit button now has the class "btn primary".
  8. The file users_controller_spec.rb has the following changes:

    • Line 30: The expectation expect(response.body).to match(/New user/m) has been modified to expect(response.body).to match(/Create New User/m).
    • Line 42: The expectation expect(response.body).not_to match(/New user/m) has been modified to expect(response.body).not_to match(/Create New User/m).
  9. The file lti_launch_initialize.html.erb has been modified to add error handling when rendering the partial "home/topannounce". The code now uses a begin and rescue block to catch any exceptions that may occur during the rendering process and set the output to nil if an error occurs.

  10. The file users_controller.rb has several changes, including updates to flash error messages and success messages in different actions.

Please review these changes in the respective files for more details.

Description

  • Run erblint on views/users using bundle exec erblint app/users/announcements/*.html.erb -a
  • Refactor link_to raw('<span class="btn">Delete User</span>') etc to have html inside of do block
  • Change success flash for creating user to be more user-friendly

Motivation and Context

  • Part of summer linting

How Has This Been Tested?

  • Verified that creating user works and form renders
  • Verified that editing user works and form renders
  • users list renders
  • LTI launch initialization renders successfully
  • buttons for User overview work

Checklist:

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

@reviewpad reviewpad bot requested a review from KesterTan August 14, 2023 17:55
@reviewpad reviewpad bot added medium Pull request is medium waiting-for-review labels Aug 14, 2023
@lykimchee lykimchee requested review from lykimchee and removed request for KesterTan September 10, 2023 16:37
Copy link
Member

@lykimchee lykimchee left a comment

Choose a reason for hiding this comment

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

  • Users list shows up
  • Create new user form loads and works (except doesn’t add course, noted inside another comment)
  • Editing user form works and loads
  • User overview: delete user, change password, revoke token, new api activation, and managed authorized clients buttons all seem to work

app/controllers/users_controller.rb Outdated Show resolved Hide resolved
app/views/users/_form.html.erb Show resolved Hide resolved
app/views/users/_form.html.erb Show resolved Hide resolved
Copy link
Member

@lykimchee lykimchee left a comment

Choose a reason for hiding this comment

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

lgtm :>

@20wildmanj 20wildmanj added this pull request to the merge queue Sep 12, 2023
Merged via the queue into master with commit ccd896b Sep 12, 2023
@20wildmanj 20wildmanj deleted the joeywildman-lint-views-users branch September 12, 2023 20:35
NicholasMy pushed a commit to UB-CSE-IT/Autolab that referenced this pull request Jan 5, 2024
* lint views/users

* Address PR coments

* add newline

* fix test

(cherry picked from commit ccd896b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium Pull request is medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants