CSS tweaks to the button layout in django admin (object-tools)

This commit is contained in:
Rachid Mrad 2023-10-31 13:02:34 -04:00
parent 1cb0127dfb
commit ee49290e98
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
5 changed files with 59 additions and 12 deletions

View file

@ -778,6 +778,8 @@ class DomainAdmin(ListHeaderAdmin):
urlpatterns = super().get_urls()
#Used to extrapolate a path name, for instance
# name="{app_label}_{model_name}_export_data_type"
info = self.model._meta.app_label, self.model._meta.model_name
my_url = [

View file

@ -180,3 +180,48 @@ h1, h2, h3 {
background: var(--primary);
color: var(--header-link-color);
}
// Font mismatch issue due to conflicts between django and uswds,
// rough overrides for consistency and readability. May want to revise
// in the future
.object-tools li a,
.object-tools p a {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
text-transform: capitalize!important;
font-size: 14px!important;
}
// For consistency, make the overrided p a
// object tool buttons the same size as the ul li a
.object-tools p {
line-height: 1.25rem;
}
// Fix margins in mobile view
@media (max-width: 767px) {
.object-tools li {
// our CSS is read before django's, so need !important
// to override
margin-left: 0!important;
margin-right: 15px;
}
}
// Fix height of buttons
.object-tools li {
height: auto;
}
// Fixing height of buttons breaks layout because
// object-tools and changelist are siblings with
// flexbox positioning
#changelist {
clear: both;
}
// Account for the h2, roughly 90px
@include at-media(tablet) {
.object-tools {
padding-left: 90px;
}
}

View file

@ -77,7 +77,7 @@ class ExportDataTest(TestCase):
columns = [
"Domain name",
"Domain type",
"Federal agency",
"Agency",
"Organization name",
"City",
"State",
@ -111,7 +111,7 @@ class ExportDataTest(TestCase):
# We expect READY domains,
# sorted alphabetially by domain name
expected_content = (
"Domain name,Domain type,Federal agency,Organization name,City,State,AO,"
"Domain name,Domain type,Agency,Organization name,City,State,AO,"
"AO email,Submitter,Submitter title,Submitter email,Submitter phone,"
"Security Contact Email,Status\n"
"adomain2.gov,Interstate,dnsneeded\n"
@ -134,7 +134,7 @@ class ExportDataTest(TestCase):
self.assertEqual(csv_content, expected_content)
def test_export_domains_to_writer_2(self):
def test_export_domains_to_writer_additional(self):
"""An additional test for filters and multi-column sort"""
# Create a CSV file in memory
csv_file = StringIO()
@ -144,7 +144,7 @@ class ExportDataTest(TestCase):
columns = [
"Domain name",
"Domain type",
"Federal agency",
"Agency",
"Organization name",
"City",
"State",
@ -173,7 +173,7 @@ class ExportDataTest(TestCase):
# federal only
# sorted alphabetially by domain name
expected_content = (
"Domain name,Domain type,Federal agency,Organization name,City,"
"Domain name,Domain type,Agency,Organization name,City,"
"State,Security Contact Email\n"
"cdomain1.gov,Federal - Executive,World War I Centennial Commission\n"
"ddomain3.gov,Federal,Armed Forces Retirement Home\n"

View file

@ -24,7 +24,7 @@ def export_domains_to_writer(writer, columns, sort_fields, filter_condition):
+ domainInfo.get_federal_type_display()
if domainInfo.federal_type
else domainInfo.get_organization_type_display(),
"Federal agency": domainInfo.federal_agency,
"Agency": domainInfo.federal_agency,
"Organization name": domainInfo.organization_name,
"City": domainInfo.city,
"State": domainInfo.state_territory,
@ -51,7 +51,7 @@ def export_data_type_to_csv(csv_file):
columns = [
"Domain name",
"Domain type",
"Federal agency",
"Agency",
"Organization name",
"City",
"State",
@ -78,7 +78,7 @@ def export_data_full_to_csv(csv_file):
columns = [
"Domain name",
"Domain type",
"Federal agency",
"Agency",
"Organization name",
"City",
"State",
@ -101,7 +101,7 @@ def export_data_federal_to_csv(csv_file):
columns = [
"Domain name",
"Domain type",
"Federal agency",
"Agency",
"Organization name",
"City",
"State",