diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 50ac1cd..9735e26 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ github: [fabiocaccamo] -custom: ['https://www.paypal.me/fabiocaccamo'] diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index fc4df59..4dbc6f2 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -18,12 +18,7 @@ jobs: uses: ffurrer2/extract-release-notes@v1 - name: Create release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: ncipollo/release-action@v1 with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false body: ${{ steps.extract-release-notes.outputs.release_notes }} + token: ${{ secrets.WORKFLOWS_CREATE_RELEASE_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index a226380..98df847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.20.0](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.20.0) - 2022-08-25 +- Add `django-streamfield` compatibility. + +## [0.19.2](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.19.2) - 2022-08-04 +- Fix `hashlib` compatibility with `FIPS` enabled systems. #167 (by [@jonlev1n](https://github.com/jonlev1n) in #168) + +## [0.19.1](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.19.1) - 2022-05-14 +- [css] Fixed dashboard alignment when recent-actions are not visible. + ## [0.19.0](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.19.0) - 2022-03-08 - Converted dynamic inline CSS to external static CSS using CSS variables. #157 #93 (thanks to [@Mustafa-Abu-Ghazy](https://github.com/Mustafa-Abu-Ghazy)) diff --git a/README.md b/README.md index 24f5d00..5c00ab4 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ django-admin-interface is a modern **responsive flat admin interface customizabl - `django-json-widget` - `django-modeltranslation` - `django-tabbed-admin` + - `django-streamfield` - `sorl-thumbnail` --- @@ -100,31 +101,48 @@ You can add a theme you've created through the admin to this repository by [send 4. Edit the section above to document your theme. ### Add theme support to third-party libraries -You can add **theme support to existing third-party libraries** using the following **css variables**: +You can add **theme support to existing third-party libraries** using the following **CSS variables**: -- `--admin-interface-title-color` -- `--admin-interface-logo-color` -- `--admin-interface-env-color` -- `--admin-interface-header-background-color:` +#### Header + +- `--admin-interface-header-background-color` - `--admin-interface-header-text-color` - `--admin-interface-header-link-color` - `--admin-interface-header-link_hover-color` +- `--admin-interface-title-color` +- `--admin-interface-env-color` + +#### Logo + +- `--admin-interface-logo-color` +- `--admin-interface-logo-default-background-image` +- `--admin-interface-logo-max-width` +- `--admin-interface-logo-max-height` + +#### Modules / Links - `--admin-interface-module-background-color` - `--admin-interface-module-background-selected-color` +- `--admin-interface-module-border-radius` - `--admin-interface-module-text-color` - `--admin-interface-module-link-color` - `--admin-interface-module-link-selected-color` - `--admin-interface-module-link-hover-color` - `--admin-interface-generic-link-color` - `--admin-interface-generic-link-hover-color` + +#### Buttons - `--admin-interface-save-button-background-color` - `--admin-interface-save-button-background-hover-color` - `--admin-interface-save-button-text-color` - `--admin-interface-delete-button-background-color` - `--admin-interface-delete-button-background-hover-color` - `--admin-interface-delete-button-text-color` + +#### Related Modal - `--admin-interface-related-modal-background-color` - `--admin-interface-related-modal-background-opacity` +- `--admin-interface-related-modal-border-radius` +- `--admin-interface-related-modal-close-button-display` --- @@ -187,18 +205,17 @@ urlpatterns += i18n_patterns(path("admin/", admin.site.urls)) ## Testing ```bash -# create python virtual environment -virtualenv testing_django_admin_interface +# clone repository +git clone https://github.com/fabiocaccamo/django-admin-interface.git && cd django-admin-interface -# activate virtualenv -cd testing_django_admin_interface && . bin/activate +# create virtualenv and activate it +python -m venv venv && . venv/bin/activate -# clone repo -git clone https://github.com/fabiocaccamo/django-admin-interface.git src && cd src +# upgrade pip +python -m pip install --upgrade pip -# install dependencies -pip install -r requirements.txt -pip install -r requirements-test.txt +# install requirements +pip install -r requirements.txt -r requirements-test.txt # run tests tox @@ -215,6 +232,13 @@ Released under [MIT License](LICENSE.txt). --- +## Supporting + +- :star: Star this project on [GitHub](https://github.com/fabiocaccamo/django-admin-interface) +- :octocat: Follow me on [GitHub](https://github.com/fabiocaccamo) +- :blue_heart: Follow me on [Twitter](https://twitter.com/fabiocaccamo) +- :moneybag: Sponsor me on [Github](https://github.com/sponsors/fabiocaccamo) + ## See also - [`django-colorfield`](https://github.com/fabiocaccamo/django-colorfield) - simple color field for models with a nice color-picker in the admin. 🎨 diff --git a/admin_interface/models.py b/admin_interface/models.py index 549d0ab..090ef13 100644 --- a/admin_interface/models.py +++ b/admin_interface/models.py @@ -172,14 +172,8 @@ class Theme(models.Model): default=True, verbose_name=_("active") ) language_chooser_display_choices = ( - ( - "code", - _("code"), - ), - ( - "name", - _("name"), - ), + ("code", _("code")), + ("name", _("name")), ) language_chooser_display = models.CharField( max_length=10, @@ -332,42 +326,15 @@ class Theme(models.Model): verbose_name=_("background color"), ) related_modal_background_opacity_choices = ( - ( - "0.1", - "10%", - ), - ( - "0.2", - "20%", - ), - ( - "0.3", - "30%", - ), - ( - "0.4", - "40%", - ), - ( - "0.5", - "50%", - ), - ( - "0.6", - "60%", - ), - ( - "0.7", - "70%", - ), - ( - "0.8", - "80%", - ), - ( - "0.9", - "90%", - ), + ("0.1", "10%"), + ("0.2", "20%"), + ("0.3", "30%"), + ("0.4", "40%"), + ("0.5", "50%"), + ("0.6", "60%"), + ("0.7", "70%"), + ("0.8", "80%"), + ("0.9", "90%"), ) related_modal_background_opacity = models.CharField( max_length=5, diff --git a/admin_interface/static/admin_interface/magnific-popup/jquery.magnific-popup.js b/admin_interface/static/admin_interface/magnific-popup/jquery.magnific-popup.js index 08aefc2..f06f96d 100755 --- a/admin_interface/static/admin_interface/magnific-popup/jquery.magnific-popup.js +++ b/admin_interface/static/admin_interface/magnific-popup/jquery.magnific-popup.js @@ -1507,7 +1507,7 @@ } }, - // Get element postion relative to viewport + // Get element position relative to viewport _getOffset: function(isLarge) { var el; if(isLarge) { diff --git a/admin_interface/static/admin_interface/related-modal/related-modal.js b/admin_interface/static/admin_interface/related-modal/related-modal.js index 49c4fd9..b3b9d32 100644 --- a/admin_interface/static/admin_interface/related-modal/related-modal.js +++ b/admin_interface/static/admin_interface/related-modal/related-modal.js @@ -136,23 +136,30 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined') window.presentRelatedObjectModalOnClickOn = presentRelatedObjectModalOnClickOn; // django 1.7 compatibility - // $('a.add-another').removeAttr('onclick').click({ lookup:false }, presentRelatedObjectModal); presentRelatedObjectModalOnClickOn('a.add-another'); // django 1.8 and above - // $('a.related-widget-wrapper-link').click({ lookup:false }, presentRelatedObjectModal); presentRelatedObjectModalOnClickOn('a.related-widget-wrapper-link'); // raw_id_fields support - // $('a.related-lookup').unbind('click').click({ lookup:true }, presentRelatedObjectModal); presentRelatedObjectModalOnClickOn('a.related-lookup', true); // django-dynamic-raw-id support - #61 // https://github.com/lincolnloop/django-dynamic-raw-id presentRelatedObjectModalOnClickOn('a.dynamic_raw_id-related-lookup', true); - // show_change_link=True support - presentRelatedObjectModalOnClickOn('a.inlinechangelink'); + // django-streamfield support + // https://github.com/raagin/django-streamfield/ + presentRelatedObjectModalOnClickOn('.streamfield_app a.stream-btn[href*="_popup=1"]'); + // Vanilla js for catching the click during capture phase for anticipating Vue.js listener. + document.addEventListener('click', function(event) { + // console.log('click intercepted before Vue.'); + if (event.target.matches('.streamfield_app a.stream-btn[href*="_popup=1"]')) { + event.stopImmediatePropagation(); + event.preventDefault(); + $(event.target).trigger('click'); + } + }, { capture: true }); }); })(django.jQuery); diff --git a/admin_interface/static/ckeditor/ckeditor/skins/light/skin.js b/admin_interface/static/ckeditor/ckeditor/skins/light/skin.js index 8373225..0bc63f4 100644 --- a/admin_interface/static/ckeditor/ckeditor/skins/light/skin.js +++ b/admin_interface/static/ckeditor/ckeditor/skins/light/skin.js @@ -49,7 +49,7 @@ CKEDITOR.skin.name = 'husky'; // the complete list: // http://docs.ckeditor.com/#!/api/CKEDITOR.env // -// Internet explorer is an expection and the browser version is also accepted +// Internet explorer is an exception and the browser version is also accepted // (ie7, ie8, ie9, ie10), as well as a special name for IE in Quirks mode (iequirks). // // The available browser specific files must be set separately for editor.css diff --git a/admin_interface/static/streamfield/js/admin_popup_response.js b/admin_interface/static/streamfield/js/admin_popup_response.js new file mode 100644 index 0000000..bd41559 --- /dev/null +++ b/admin_interface/static/streamfield/js/admin_popup_response.js @@ -0,0 +1,22 @@ +(function() { + + 'use strict'; + + var windowRef = window; + var openerRef = windowRef.parent; + + var initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse); + switch (initData.action) { + case 'change': + openerRef.streamapps[initData.app_id].updateBlock(initData.block_id, initData.instance_id); + openerRef.dismissRelatedObjectModal(); + break; + case 'delete': + break; + default: + openerRef.streamapps[initData.app_id].updateBlock(initData.block_id, initData.instance_id); + openerRef.dismissRelatedObjectModal(); + break; + } + +})(); \ No newline at end of file diff --git a/admin_interface/templates/admin/base_site.html b/admin_interface/templates/admin/base_site.html index 14e2be4..c5e4115 100644 --- a/admin_interface/templates/admin/base_site.html +++ b/admin_interface/templates/admin/base_site.html @@ -2,19 +2,88 @@ {% load i18n static admin_interface_tags %} {% block title %} +{% get_admin_interface_theme as theme %} {% if title %}{{ title }} | {% endif %}{% if theme.title %}{% trans theme.title %}{% else %}{{ site_title|default:_('Django administration') }}{% endif %} {% endblock %} {% block extrastyle %} +{% get_admin_interface_theme as theme %} {% get_admin_interface_nocache as version_md5_cache %} {% get_current_language as current_lang %}