Skip to content

Commit 25374d7

Browse files
committed
WIP including all themes
1 parent b60df96 commit 25374d7

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

migrations/0003_a11y_structure_updates.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
def forward_migration(apps, schema_editor):
66
changes_to_make = [
7-
('#content aside', '#content .side-info'),
8-
('#content .side-info h3', '#content .side-info h2'),
7+
('olh', '#content aside', '#content .side-info'),
8+
('olh', '#content .side-info h3', '#content .side-info h2'),
99
]
1010
find_and_handle_custom_stylesheets(apps, schema_editor, changes_to_make, reverse=False)
1111

1212

1313
def reverse_migration(apps, schema_editor):
1414
changes_to_make = [
15-
('#content aside', '#content .side-info'),
16-
('#content aside h3', '#content aside h2'),
15+
('olh', '#content aside', '#content .side-info'),
16+
('olh', '#content aside h3', '#content aside h2'),
1717
]
1818
find_and_handle_custom_stylesheets(apps, schema_editor, changes_to_make, reverse=True)
1919

utils.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
def change_css_selectors(file_paths, changes_to_make, reverse=False):
1313
"""
1414
Modifies custom stylesheets to update specific CSS selectors.
15-
16-
Args:
17-
file_paths: List of file paths to process
18-
changes_to_make: List of tuples with (old_selector, new_selector)
19-
reverse: If True, reverses the changes (new_selector -> old_selector)
15+
Reverse allows this to be used for undo a migration as well.5rf
2016
"""
2117
for file_path in file_paths:
2218
try:
@@ -86,21 +82,21 @@ def get_custom_stylesheet_paths(apps, schema_editor):
8682
)
8783
except SettingValue.DoesNotExist:
8884
continue
89-
if theme.value == 'material':
90-
stylesheet_paths.extend([
91-
os.path.join(
92-
settings.BASE_DIR,
93-
'static',
94-
'material',
95-
'css',
96-
f'journal{journal_id}_override.css',
97-
),
98-
os.path.join(
99-
plugin_settings.BASE_CSS_PATH,
100-
str(journal_id),
101-
'custom.css',
102-
)
103-
])
85+
86+
stylesheet_paths.extend([
87+
os.path.join(
88+
settings.BASE_DIR,
89+
'static',
90+
theme.value,
91+
'css',
92+
f'journal{journal_id}_override.css',
93+
),
94+
os.path.join(
95+
plugin_settings.BASE_CSS_PATH,
96+
str(journal_id),
97+
'custom.css',
98+
)
99+
])
104100

105101
for sheet in CrossJournalStylesheet.objects.filter(journals=journal):
106102
stylesheet_paths.append(
@@ -110,7 +106,8 @@ def get_custom_stylesheet_paths(apps, schema_editor):
110106
sheet.stylesheet_name,
111107
)
112108
)
113-
109+
elif theme.value == 'clean':
110+
pass
114111
# Get press stylesheets
115112
press = Press.objects.first()
116113
if press and press.theme == 'material':
@@ -139,7 +136,7 @@ def find_and_handle_custom_stylesheets(apps, schema_editor, changes_to_make, rev
139136
Args:
140137
apps: Django apps registry
141138
schema_editor: Django schema editor
142-
changes_to_make: List of tuples with (old_selector, new_selector)
139+
changes_to_make: List of tuples with (theme, old_selector, new_selector)
143140
reverse: If True, reverses the changes
144141
"""
145142
stylesheet_paths = get_custom_stylesheet_paths(apps, schema_editor)

0 commit comments

Comments
 (0)