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

Remove unnecessary TreeIndexView media property #13

Merged
merged 1 commit into from
Jan 8, 2020

Conversation

chosak
Copy link
Member

@chosak chosak commented Jan 8, 2020

The TreeModelAdmin index view (TreeIndexView) defines its own media property, which pulls in the extra CSS from this package. This is unnecessary, because the base ModelAdmin IndexView from which it inherits already provides a media property, which pulls in both extra CSS and JS, if specified by inheriting ModelAdmins.

This functionality exists in all versions of Wagtail supported by this package: 1.13, 2.5, and current master.

Removing this not only eliminates duplicate code, but also fixes a problem where TreeModelAdmins can't provide their own JS files, because they aren't included in the media property. For example, TreeModelAdmin currently isn't compatible with wagtail-orderable for this reason. Making this change, and falling back on the default CSS+JS inclusion, allows for customization of TreeModelAdmin JS.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the development playbook
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

@coveralls
Copy link

coveralls commented Jan 8, 2020

Pull Request Test Coverage Report for Build 669

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 667: 0.0%
Covered Lines: 1010
Relevant Lines: 1010

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jan 8, 2020

Pull Request Test Coverage Report for Build 671

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 667: 0.0%
Covered Lines: 201
Relevant Lines: 201

💛 - Coveralls

The TreeModelAdmin index view (TreeIndexView) defines its own media
property, which pulls in the extra CSS from this package. This is
unnecessary, because the base ModelAdmin IndexView from which it
inherits already provides a media property, which pulls in both extra
CSS and JS, if specified by inheriting ModelAdmins.

This functionality exists in all versions of Wagtail supported by this
package:

1.13: https://github.com/wagtail/wagtail/blob/v1.13/wagtail/contrib/modeladmin/views.py#L251-L256
2.5: https://github.com/wagtail/wagtail/blob/v2.5/wagtail/contrib/modeladmin/views.py#L261-L266
Current master: https://github.com/wagtail/wagtail/blob/7fdb06c86cd7fd32e4ff6b85e012daffbe1637e4/wagtail/contrib/modeladmin/views.py#L258-L262

Removing this not only eliminates duplicate code, but also fixes a
problem where TreeModelAdmins can't provide their own JS files, because
they aren't included in the media property. For example, TreeModelAdmin
currently isn't compatible with wagtail-orderable
(https://pypi.org/project/wagtail-orderable/) for this reason. Making
this change, and falling back on the default CSS+JS inclusion, allows
for customization of TreeModelAdmin JS.
@chosak chosak merged commit f31f2e5 into cfpb:master Jan 8, 2020
@chosak chosak deleted the remove-indexview-media branch January 8, 2020 19:44
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.

3 participants