add customizable colors for selected apps and models in modules
parent
e5318b688b
commit
16022a3efb
|
|
@ -71,8 +71,10 @@ class ThemeAdmin(admin.ModelAdmin):
|
||||||
'classes': ('wide', ),
|
'classes': ('wide', ),
|
||||||
'fields': (
|
'fields': (
|
||||||
'css_module_background_color',
|
'css_module_background_color',
|
||||||
|
'css_module_background_selected_color',
|
||||||
'css_module_text_color',
|
'css_module_text_color',
|
||||||
'css_module_link_color',
|
'css_module_link_color',
|
||||||
|
'css_module_link_selected_color',
|
||||||
'css_module_link_hover_color',
|
'css_module_link_hover_color',
|
||||||
'css_module_rounded_corners',
|
'css_module_rounded_corners',
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
import colorfield.fields
|
||||||
|
from django.db import migrations
|
||||||
|
from django.db.models import F
|
||||||
|
|
||||||
|
def default_link_selected(apps, schema_editor):
|
||||||
|
Theme = apps.get_model("admin_interface", "Theme")
|
||||||
|
Theme.objects.update(css_module_link_selected_color=F('css_module_link_color'))
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('admin_interface', '0019_add_form_sticky'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='theme',
|
||||||
|
name='css_module_background_selected_color',
|
||||||
|
field=colorfield.fields.ColorField(blank=True, default='#FFFFCC', help_text='#FFFFCC', max_length=10, verbose_name='background selected color'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='theme',
|
||||||
|
name='css_module_link_selected_color',
|
||||||
|
field=colorfield.fields.ColorField(blank=True, default='#FFFFFF', help_text='#FFFFFF', max_length=10, verbose_name='link selected color'),
|
||||||
|
),
|
||||||
|
migrations.RunPython(default_link_selected),
|
||||||
|
]
|
||||||
|
|
@ -178,6 +178,12 @@ class Theme(models.Model):
|
||||||
help_text='#44B78B',
|
help_text='#44B78B',
|
||||||
max_length=10,
|
max_length=10,
|
||||||
verbose_name=_('background color'))
|
verbose_name=_('background color'))
|
||||||
|
css_module_background_selected_color = ColorField(
|
||||||
|
blank=True,
|
||||||
|
default='#FFFFCC',
|
||||||
|
help_text='#FFFFCC',
|
||||||
|
max_length=10,
|
||||||
|
verbose_name=_('background selected color'))
|
||||||
css_module_text_color = ColorField(
|
css_module_text_color = ColorField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default='#FFFFFF',
|
default='#FFFFFF',
|
||||||
|
|
@ -190,6 +196,12 @@ class Theme(models.Model):
|
||||||
help_text='#FFFFFF',
|
help_text='#FFFFFF',
|
||||||
max_length=10,
|
max_length=10,
|
||||||
verbose_name=_('link color'))
|
verbose_name=_('link color'))
|
||||||
|
css_module_link_selected_color = ColorField(
|
||||||
|
blank=True,
|
||||||
|
default='#FFFFFF',
|
||||||
|
help_text='#FFFFFF',
|
||||||
|
max_length=10,
|
||||||
|
verbose_name=_('link selected color'))
|
||||||
css_module_link_hover_color = ColorField(
|
css_module_link_hover_color = ColorField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default='#C9F0DD',
|
default='#C9F0DD',
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
|
|
||||||
.admin-interface #nav-sidebar .current-app .section:link,
|
.admin-interface #nav-sidebar .current-app .section:link,
|
||||||
.admin-interface #nav-sidebar .current-app .section:visited {
|
.admin-interface #nav-sidebar .current-app .section:visited {
|
||||||
color: {{ theme.css_module_link_color }};
|
color: {{ theme.css_module_link_selected_color }};
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,11 +136,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-interface #nav-sidebar .current-model {
|
.admin-interface #nav-sidebar .current-model {
|
||||||
background: #FFFFCC;
|
background: {{ theme.css_module_background_selected_color }};
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-interface #changelist table tbody tr.selected {
|
.admin-interface #changelist table tbody tr.selected {
|
||||||
background-color: #FFFFCC;
|
background-color: {{ theme.css_module_background_selected_color }};
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-interface .module h2,
|
.admin-interface .module h2,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ https://github.com/jmrivas86/django-json-widget
|
||||||
.admin-interface div.jsoneditor-contextmenu ul li button.jsoneditor-selected,
|
.admin-interface div.jsoneditor-contextmenu ul li button.jsoneditor-selected,
|
||||||
.admin-interface div.jsoneditor-contextmenu ul li button.jsoneditor-selected:focus,
|
.admin-interface div.jsoneditor-contextmenu ul li button.jsoneditor-selected:focus,
|
||||||
.admin-interface div.jsoneditor-contextmenu ul li button.jsoneditor-selected:hover {
|
.admin-interface div.jsoneditor-contextmenu ul li button.jsoneditor-selected:hover {
|
||||||
background-color: #FFFFCC;
|
background-color: {{ theme.css_module_background_selected_color }};
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue