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

Uncrispify ColumnsForm #3108

Merged
merged 2 commits into from
Oct 10, 2024
Merged

Uncrispify ColumnsForm #3108

merged 2 commits into from
Oct 10, 2024

Conversation

stveit
Copy link
Contributor

@stveit stveit commented Oct 8, 2024

Fixes #3100

Not sure if the form_action value is correct. tried to set it to reverse('webfront-preferences-setwidgetcolumns') directly but that created some errors, but just giving the string without reversing seems to have worked fine?

We dont have a separate uncrispy class for NavSubmit, but it seems a NavSubmit button is pretty much just a smaller submit button using the css classes button small, so I just used a SubmitField with the additional css.
Is it even necessary to include button as a class? It seems to look and behave exactly the same with just small

@stveit stveit added the refactor label Oct 8, 2024
@stveit stveit self-assigned this Oct 8, 2024
@stveit stveit marked this pull request as ready for review October 8, 2024 14:22
Copy link

github-actions bot commented Oct 8, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 992 0 10.87s
✅ PYTHON ruff 987 0 0.11s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

Copy link

github-actions bot commented Oct 8, 2024

Test results

    9 files      9 suites   8m 30s ⏱️
2 136 tests 2 136 ✅ 0 💤 0 ❌
4 011 runs  4 011 ✅ 0 💤 0 ❌

Results for commit 967abd4.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.44%. Comparing base (94633a6) to head (967abd4).
Report is 290 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3108      +/-   ##
==========================================
- Coverage   60.47%   60.44%   -0.03%     
==========================================
  Files         605      605              
  Lines       43773    43765       -8     
  Branches       48       48              
==========================================
- Hits        26472    26455      -17     
- Misses      17289    17298       +9     
  Partials       12       12              

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

@stveit stveit mentioned this pull request Oct 8, 2024
Copy link
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

I can confirm that this works (I even checked in the database that the value was actually changed).

legend='Number of columns for widgets',
fields=[
self['num_columns'],
SubmitField(value='Save', css_classes='button small'),
Copy link
Contributor

Choose a reason for hiding this comment

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

The submit field already sets the css class button, so this should be enough:

Suggested change
SubmitField(value='Save', css_classes='button small'),
SubmitField(value='Save', css_classes='small'),

Copy link
Contributor

@podliashanyk podliashanyk left a comment

Choose a reason for hiding this comment

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

Looks good!
reverse is redundant since we do not process path name in python, instead we use url in the form template to get url path when given name

{% if form.attrs.action %}action="{% url form.attrs.action %}"{% endif %}

Have tested it manually and it works like the original implementation. Which to me seems broken given that it doesn't update the number of columns in the UI on success.

Also see @johannaengland comment about the class name.

@stveit stveit force-pushed the uncrispify/ColumnsForm branch from 5acf7b5 to 967abd4 Compare October 10, 2024 09:52
Copy link

@stveit stveit merged commit 78439e7 into master Oct 10, 2024
11 of 12 checks passed
@johannaengland johannaengland deleted the uncrispify/ColumnsForm branch November 25, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uncrispify python/nav/web/webfront/forms.py:ColumnsForm
3 participants