Code Monkey home page Code Monkey logo

djangocms-admin-style's Introduction

django CMS Admin Style

pypi python django djangocms djangocms4 coverage

Adds pretty CSS styles for the django CMS admin interface. Supports optional django-admin-shortcuts package.

Note

This project is considered 3rd party (no supervision by the django CMS Association). Join us on Slack for more information.

image image
image image

The shortcuts you see on top of the dashboard are from django-admin-shortcuts

Contribute to this project and win rewards

Because this is a an open-source project, we welcome everyone to get involved in the project and receive a reward for their contribution. Become part of a fantastic community and help us make django CMS the best CMS in the world.

We'll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We're grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

Installation

For a manual install:

  • run pip install djangocms-admin-style
  • add djangocms_admin_style to your INSTALLED_APPS just before 'django.contrib.admin'
  • run python manage.py migrate djangocms_admin_style

Configuration

The django CMS Admin Style overrides django admin's base_site.html, but you can still partially customize this page. Look at the source of templates/admin/base_site.html and override the templates that are included in various blocks. For example, you can add your own CSS in templates/admin/inc/extrastyle.html.

The following additional settings can be set:

  • CMS_ENABLE_UPDATE_CHECK = True Set to False to disable the update notification.
  • CMS_UPDATE_CHECK_TYPE = ('minor') Set to ('patch') to get only patch notifications. (minor = 3.x.x, patch = 3.4.x)

The update checker does not gather or record any data.

To compile CSS run the following commands using node 16:

  • nvm use
  • npm install
  • npx gulp icons sass bundle

For further options have a look at the gulpfile.js.

Dark mode support

Django supports a dark mode admin since version 3.1. djangocms-admin-style introduces css variables that contain color codes and change with the selected mode:

CMS variable name Color Django admin fallback Color
--dca-white #ffffff --body-bg #ffffff
--dca-black #000000 --body-fg #303030
--dca-gray #666 --body-quiet-color #666
--dca-gray-lightest #f2f2f2 --darkened-bg #f8f8f8
--dca-gray-lighter #ddd --border-color #ccc
--dca-gray-light #999 --close-button-bg #888
--dca-gray-darker #454545
--dca-gray-darkest #333
--dca-gray-super-lightest #f7f7f7
--dca-primary #00bbff --primary #79aec8

Extending styles in your own app

If your project or app requires specific styles if djangocms-admin-style is installed (e.g., to better adjust to the django CMS style) you can add selective styling by adding the .djangocms-admin-style selector:

// Show widget in CMS colors if djangocms-admin-style is installed
.djangocms-admin-style #my-widget {
    color:  var(--dca-primary, black);
}

We recommend to following rules for your app's admin css:

  • Try avoid using color, background etc. styles where possible and meaningful
  • If necessary use as few as possible standard django CMS colors (preferably from see above list with fallback colors)
  • Usage: var(--dca-color-var, var(--fallback-color-var, #xxxxxx)) where #xxxxxx represents the light version of the color.

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r tests/requirements/base.txt
python setup.py test

In order to run integration tests you need to have Docker installed, then run the following command:

make test

To test other Django versions simply append VERSION=4.1`. You can also run the test server through:

make run

The integration tests are written using Casperjs, phantomcss and djangocms-casper-helpers.

djangocms-admin-style's People

Contributors

aiky30 avatar alesdotio avatar beniwohli avatar benzkji avatar chaosk avatar czpython avatar digi604 avatar finalangel avatar fsbraun avatar geoidesic avatar gkmngrgn avatar itbabu avatar jbpenrath avatar jqb avatar jrief avatar lory87 avatar marksweb avatar mfcovington avatar mkoistinen avatar nicolairidani avatar pre-commit-ci[bot] avatar rafalp avatar raffaellasuardini avatar ryanbagwell avatar sakhawy avatar stefanfoulis avatar tobifroe avatar vinitkumar avatar vxsx avatar yakky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

djangocms-admin-style's Issues

Indentation introduces by MPTT is lost

MPTTModelAdmin (0.6.0) indents children using an inline padding-left on the th. However this is overwritten by djangocms-admin-style's CSS (0.2.2) with:

.module table th {
    padding: 2px 5px !important;
    [...]
}

id_username has no background color

I have a dark system theme and so all text boxes in websites are dark too. As #id_username on the login page has no style (or at least no background colour) the text is black on dark, as you can see in the screenshot:

djangocms_login

ManyToManyField is hardly usable (django-cms v3.0)

It looks like the two boxes which are used within the default admin have disappeared. It would be nice to have them back, as the current m2m multiselect field is hardly usable (especially with more than, say, 20 options in it):

screen shot 2013-08-19 at 9 57 40 pm

Additional: it is mainly because when you've selected 60 out of 150 options, and you accidentally click without control/command, you lose the whole selection...

Also you can't see in one view which options are selected and which are not. And last but not least the scrolling doesn't really work in the sidebar of the frontend (like everything scrolls a bit: the actual page, the admin sidebar and the multiselect field.

Re-enabling source maps without worrying about .css file sizes

I noticed that source map creation has been disabled in gruntfile.js due to file size concerns:

// Sourcemaps are disabled by default to reduce filesize
// .pipe(sourcemaps.init())
    ...
// Sourcemaps are disabled by default to reduce filesize
// .pipe(sourcemaps.write())

Using sourcemaps.write() without an argument creates inline source maps within the destination .css files, thereby inflating those files; however, sourcemaps.write('.') will create external source maps at the same level as the destination .css files and leave the those .css files alone.

It seems that external source maps are only loaded if developer tools are opened, so you can have source maps without worrying about the source map file sizes.

Strange styles in plugin editor

Hi there!

I see some strange stylings in the plugin editor.
First I don't like the table titles to be uppercased, but that's a matter of opinion of course.

Other than that - can you have a look at the icons near "SlideshowImage object"?
What's the "edit pen" icon for? It's not clickable.

Last point: Too me, nofile_48x48.png (image symbol with questionmark) looks like an error - wouldn't the icon work without the questionmark?

Thanks!
Florian

plugin editor

Make headings more defined

In projects with a lot of stuff in the admin, it can be difficult to find what you are looking for as headings don't really stand out.

Just my thoughts :)

horizontal fields in site admin

In an app that coexists with django-cms on my site, the admin declares:

fieldsets = (
(None, {
'fields': (('shortname', 'published', 'notfeature'),),
}),
...

I get
got

I want
want

Looks to me like djangocms-admin-style sets float to none and removes horizontal margins:

form .form-row .field-box {
float: none;
margin-right: 0 !important;
margin-top: 20px;
}

Am I doing something wrong? Without djangocms-admin-style, the admin form looks right, but I'm also using django-cms, and it's a requirement.

Djangocms Admin Style search box CSS broken with Django 1.9 and djangocms-admin-style==1.0.9

Hi all,

I recently upgraded to Django 1.9 and DjangoCMS 3.2.1. I also updated djangocms-admin-style to the latest current version, 1.0.9. Upon doing so, the search bar in the admin interface breaks for all instances where search_fields is set in the ModelAdmin. I'm not able to click on the search box to make it active, and it appears broken in the layout. I have reproduced this in Firefox (44.0) and in Chrome (50.0.2633.3)

See the screenshot below.

I've run a collectstatic and have migrated everything upon doing this upgrade. Here are the apps that I have installed.

$ pip freeze
beautifulsoup4==4.4.0
dj-database-url==0.3.0 
Django==1.9.1
django-classy-tags==0.6.2
django-cms==3.2.1
django-extensions==1.6.1
django-formtools==1.0
django-htmlmin==0.9.0
django-nocaptcha-recaptcha==0.0.18
django-reversion==1.10.1
django-sekizai==0.9.0
Django-Select2==4.3.1
django-treebeard==4.0
djangocms-admin-style==1.0.9
djangocms-inherit==0.1.1
djangocms-link==1.7.1
djangocms-snippet==1.7.1
djangocms-teaser==0.2.0
djangocms-text-ckeditor==2.8.1
html5lib==0.999999
Pillow==3.1.0
psycopg2==2.6.1
six==1.9.0
sorl-thumbnail==12.3
wheel==0.24.0

djangocms-admin-style-broken

Filer clear icon too big

EDIT: My proposed solution does not work, the "nofile" image / icon is too big then.

Hey,

I am having trouble with the clear icon size of the filer image. When removing the image size it looks good, but I am not sure if this is the correct way to fix it.

Thank you in advance

Jakob

Versions

django-cms==3.2.0
djangocms-admin-style==1.0.7
django-filer==1.0.2

Screenshots

filer_problem_01

filer_problem_02

cleanup static file locations

static files should be all namespaced inside a app folder inside static. Anything placed directly in static might clash with other static assets of the project.

So all djangocms-admin-style staticfiles should be in static/djangocms_admin_style/. Of course with the exception of static files that are overridden for other apps.

Do not add fixed length in form-input

Currently,
.form-row input, .form-row textarea { width: 250px; }

This limits size of TextInput fields like CharField, SlugField etc. Default django admin uses html size attribute which allows to customize size of html input. Since fixed with is added, it's not possible anymore.

The `filter_vertical` setting is broken. It is horizontal, instead.

I'm upgrading from djangocms-admin-style==0.2.5 and noticed that the admin's filter_vertical setting for many-to-many fields is no longer respected.

A vertical filter is actually horizontal in djangocms-admin-style==1.0.4:

screen shot 2015-11-08 at 1 23 58 pm

Also, vanilla Django admin and the older django CMS admin kept the filter box sizes consistent. It seems weird having them lopsided like this.

List display issues if no admin actions

Here is what the display looks like with admin actions enabled:

screen shot 2015-12-09 at 6 30 05 pm

Here's what it looks like with actions = None:

screen shot 2015-12-09 at 6 30 26 pm

These screenshots are from 1.0.7 but I also tested this on master @121a91d97c8fa0fa953c35274b44d976a6a5e50a

Problems upload images

With djangocms-admin-style, when I open the image upload dialog, the two buttons at the top are not visible anymore (and few more other visual quirks). This is happening in version 1.0.4 and 1.0.6 in django-cms 3.1.3.

bildschirmfoto 2015-11-20 um 15 27 02

Big tables & filters appear strangely

As you can see in the following screenshot the table gets 2 inner scrollbars, while the filters part gets another vertical scrollbar, and the whole page also has a (disabled) scrollbar.

2015-12-04-175758_1588x790_scrot

I think this is quite confusing. Wouldn't there be a better way of displaying such information?

Input line height issue in linux

Under certain conditions (eg Ubuntu using fallback font Verdana), the line height (12px) for input and select elements can be too low for the font size (12px), causing descenders and underscores to be cropped by the padding:

example

120% line height should resolve this, which would be 14.4px, so I tried increasing the line height to large font size (16px) and reducing the vertical padding accordingly, but it caused problems in IE. This will therefore either need further css hackery to fix those issues, or it becomes a design decision around input element sizes and padding.

admin style breaks module content

the .module class styles all the inner html. But when using custom html or wysiwygs it also overrides those styles.

.module table td for example adds unrequired padding to the ckeditor.

Inline change link icon and text overlap

Hi there. When show_change_link = True in an admin.TabularInline class, the corresponding change link is styled improperly.

It looks like this:
screen shot 2015-11-16 at 2 28 11 am

It should look like this:
screen shot 2015-11-16 at 2 28 24 am

The inlinechangelink class normally has a padding-left of 12px:
screen shot 2015-11-16 at 2 27 46 am

However, this is overridden and set to 0 with the .tabular table td a selector:
screen shot 2015-11-16 at 2 27 41 am

Thanks!

Support of django versions

I recommend that you make it more clear that V1.10 is not compatible with older versions of django anymore. It really needs django 1.9 - at least the admin styles of django 1.9. Otherwise the change forms don't really look well (submit row, inlines)

Workaround for django 1.8: from django 1.9, copy forms.css to your local static/admin/css folder (create, if not existing yet) and fix the style for .submit-row:

.submit-row {
    padding: 12px 14px !important;
    margin: 0 0 20px;
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 4px;
    text-align: right;
    overflow: hidden;
}

(padding needs an !important)

retina screen icons messed up

Apologies if I'm not doing this right but it appears I'm the first person to use this on a retina screen? This is what the admin looks like for me in an essentially base install. I'm running the latest Yosemite.

screen shot 2014-12-20 at 9 17 27 pm

SCSS won't compile with Compass >= 1.x

Since Compass 1.x release comes with a lot of deprecations, this is breaking scss compilation for most project built with Compass 0.x.

If i try to compile djangocms-admin-style scss with my Compass 1.x install it fails with some errors:

$ compass compile --force -c config_admin-style.rb
 modified config.rb
    clean /home/work/projects/pims/try-it/project/webapp_statics/djangocms_admin_style/css
   delete /home/work/projects/pims/try-it/project/webapp_statics/djangocms_admin_style/css/djangocms-admin-frontend.css
   delete /home/work/projects/pims/try-it/project/webapp_statics/djangocms_admin_style/css/djangocms-admin.css
   delete /home/work/projects/pims/try-it/project/webapp_statics/djangocms_admin_style/css/ie.css
    write /home/work/projects/pims/try-it/project/webapp_statics/djangocms_admin_style/css/djangocms-admin-frontend.css
WARNING: $base-line-height must resolve to a pixel unit.
         on line 47 of /home/work/.rvm/gems/ruby-2.1.1@foundation55/gems/compass-core-1.0.3/stylesheets/compass/typography/_vertical_rhythm.scss
         from line 4 of /home/work/.rvm/gems/ruby-2.1.1@foundation55/gems/compass-core-1.0.3/stylesheets/compass/_typography.scss
         from line 152 of /home/work/projects/pims/try-it/compass/admin_style/_settings.scss
         from line 1 of /home/work/projects/pims/try-it/compass/admin_style/djangocms-admin.scss

I didn't try to fix it yet, so there is probably more errors to fix.

You should put a notice about that (Scss require Compass 0.x to compile) in your Readme or if you are interested to use Compass 1.x, i may be able to fix your scss within a pull request.

Admin header display: none;?

Just installed 1.0.4 and now have a blank header in the admin. Browser inspection says djangocms-admin.css is display: none;-ing both the #user-tools and #header #branding h1.

screen shot 2015-11-05 at 2 40 55 pm

Cant override block usertools.

Hi, I am overriding the admin/base_site.html template, this is my code:

{% extends "admin/base.html" %}
{% load i18n staticfiles %}

{% block extrastyle %}{% include 'admin/inc/extrastyle.html' %}{% endblock %}

{% block extrahead %}<link rel="stylesheet" type="text/css" href="{% static 'djangocms_admin_style/css/djangocms-admin.css' %}" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script type="text/javascript">
if (window.self!==window.top) { document.write('<link rel="stylesheet" type="text/css" href="{% static 'djangocms_admin_style/css/djangocms-admin-frontend.css' %}" />'); }
</script>
{% include 'admin/inc/extrahead.html' %}{% endblock %}

{% block title %}{% include 'admin/inc/title.html' %}{% endblock %}

{% block branding %}{% include 'admin/inc/branding.html' %}{% endblock %}

{% block usertools %}{% include 'admin/inc/usertools.html' %}{% endblock %}

Everything looks good, but I cant seem to display the {% block usertools %}{% include 'admin/inc/usertools.html' %}{% endblock %} part.

My usertools.html looks like this.

{# usertools #}
usertools

I cant get it to show. Using Django 1.7 Any ideas?

Wrong template path in README.rst

The extrastyle.html path in the readme is wrong:
templates/admin/extrastyle.html

The correct path is:
templates/admin/inc/extrastyle.html

NoReverseMatch exception triggered on object deletion.

Whenever you try to delete an object from the admin with Django 1.7 and Python 2.7, you end up with a NoReverseMatch exception raised in

djangocms_admin_style/templates/admin/delete_selected_confirmation.html

The traceback says

Reverse for 'app_list' with arguments '()' and keyword arguments '{u'app_label': ''}' not found.

and this is related to line 11 of the template which renders the nested menu (depicted below).
screenshot from 2014-12-31 13 04 31

I can provide a fix that was successfully tested under Django 1.7 and Python 2.7 in a pull request if one of the contributors agrees.

Replace compass against libsass

This app would be a perfect fit to use django-sass-processor instead of compass.

@yakky remember, you asked a while ago to allow offsite compilation, so that djangocms-admin-style can be shipped with precompiled .css files, rather than having them to compile in a productive environment. Well, django-sass-processor can do that now.

If desired, I can create a PR for this. Would help during development to get rid of a Ruby dependency and having to run a directory watching process.

Add ability to make dropdown filter menu

I think, good idea is to have option to make dropdown filter menu as django-cms page list:
default

Option may be like that:

@admin.register(Example)
class ExampleAdmin(DjangocmsAdminStyleMix, admin.ModelAdmin):
    ...
    dropdown_filter_list = True

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.