Skip to content

Releases: locomotivemtl/charcoal-admin

0.29.3

23 Aug 15:40
2dc15ec
Compare
Choose a tag to compare

This release adds support for changing the default options for the lost password email. Options can be changed using the charcoal admin config.

New Config Options

{
    "admin": {
        "user": {
            "lost_password_email": {
                "template_ident": "charcoal/admin/email/user.lost-password",
                "campaign": "admin.lost-password",
                "from": {
                    "name": "Charcoal",
                    "email": "[email protected]"
                },
                "log": true
            }
        }
    }
}

Full Changelog: 0.29.2...0.29.3

0.29.2

23 Aug 14:29
cc02ee0
Compare
Choose a tag to compare

This release provides tweaks to the base admin Widget as well as a new input type that allows https://github.com/locomotivemtl/charcoal-contrib-advanced-search to function correctly.

New

  • New Input - Date-Time Picker Range input. Contains a start date and end date.
  • Table Widget - add total_rows + total_pages counts
  • Table Widget - add option to show/hide the table's header show_table_header
  • Table Widget - add option to show/hide the table's header show_table_header
  • Allow overriding SwitchInput's default size class .switch-lg

Changes

  • Widget - On load failure, call callback.
  • Merge abandoned selectize-bootstrap-4 into Admin

Full Changelog: 0.29.1...0.29.2

charcoal-admin 0.30.5

30 Jan 18:26
0.30.5
004aab9
Compare
Choose a tag to compare

Complete commits list: 0.30.4.1...0.30.5

Key Feature

Fix and improve base path in AssetsBuilder

The AssetsBuilder now accepts a base path from its constructor.

Replaced relative base path assumption (dirname(__DIR__, 7)) with dedicated base path, either:

  1. Explicit base path (see constructor parameter), or
  2. Implicit base path (the current working directory).

By default, the base path is explicitly set to the AppConfig's base path.

This ensures relative asset paths are loaded according a more reliable base path.

Summary

  • Ensure master object exists in HierarchicalOjectProperty.
  • Remove default constructor descriptions from AssetsBuilder and SelectizeRenderer.
  • Fix issues reported by PHPCS and PHPUnit.

charcoal-admin 0.30.4

14 Jul 16:12
Compare
Choose a tag to compare

Key Features

New group display mode for Quick Form widget (#63)

Added support for grouping properties by language, for multilingual form properties.

{
    "type": "charcoal/admin/widget/quick-form",
    "form_ident": "quick-edit",
    "group_display_mode": "lang"
}

Improve language switcher

With the aforementioned new feature, new interfaces have been introduced to assist with controlling the form's language switcher:

  • HasLanguageSwitcherInterface — Classes that implement this interface are in charge of displaying or hiding the switcher as well as deciding of that state.
  • LanguageSwitcherAwareInterface — Classes that implement this interface can be used to determine if the language switcher should be displayed or hidden.

Improved reloading in widget.js

Added methods:

  • Widget#is_reloading() with internal property to track when a widget is reloading itself.
  • Widget#try_reload() to call Widget#reload() if the widget is not already busy reloading itself.

Improved error handling in form.js

Added properties attempts and max_attempts (defaults to 5) to track if the form is busy or blocked/broken and try to warn user with feedback.

Improved language switching in form.js

Deprecated custom event switch_language.charcoal in favour of new custom events:

  • beforelanguageswitch.charcoal.form triggered before language switch and allow for cancelling of action via event.preventDefault().
  • languageswitch.charcoal.form triggered after language switch (supersedes switch_language.charcoal).

Refactored internals of attachment.js

⚠️ [BC] This MAY break any JS component that extends or customizes Widget_Attachment.

🩹 Fixed saving issues introduced in 0.30.0

Repurposed dirty property to track any changes to the blocks:

  • When the sortable positions of blocks have changed.
  • When a block is added.

Added busy property and methods to track when the widget is processing changes:

  • When blocks are being attached (joined) to a content model or parent block.
  • When a block is being dettached.

Replaced switch_language.charcoal event listener with listeners on new events for switching language:

  • beforelanguageswitch to check if widget is busy (and cancel the switch) and to check if widget is dirty (and save changes).
  • languageswitch (reload the widget).

What's new in 0.30.4?

Complete commits list: 0.30.3...0.30.4

Updated

  • NPM
    • bootstrap-table v1.12.1 → v1.19.1
    • echarts v5.3.2 → v5.3.3
    • eslint v6.8.0 → v8.6.0
    • jsoneditor v9.7.4 → v9.9.0
    • tinymce v5.10.4 → v5.10.5

Added

  • [PHP] Added interface Charcoal\Admin\Ui\FormGroupInterface, which extends Charcoal\Ui\FormGroupInterface, to declare groupProperties() method.
  • [PHP] Added methods hasL10nGroupProperties() and isL10nModelProperty() to decouple property check from iteration of form properties (hasL10nFormProperties()) on ObjectFormWidget.
  • [PHP] Added Sorter utility class to centralize sorting by priority comparator functions to minimize duplicate code.
  • [SCSS] Merged styles from abandoned selectize-bootstrap-4 (papakay/selectize-bootstrap-4-style).

Changed

  • [PHP] Improved ObjectFormWidget#hasL10nFormProperties() to iterate group properties (instead of the form's properties) on the record model or blank model (instead of just the blank model).
  • [JS] Improved event namespacing in JS components by ensuring EVENT_NAMESPACE property is available as an instance member and a static member.
  • [JS] Improved handling of XHR requests in attachment.js to track failures.
  • [JS] Improved internals of feedback.js, assertion and validation of levels, display modes, and messages.
  • [JS] Improved widget.js with access to the XHR object that handles "widget/load" request to the dialog object to allow others to extend Promise.
  • [JS] Improved validate/save in component_manager.js, by passing scope to help with validating and saving data.
  • [JS] Improved error messages in component_manager.js.
  • Updated ESLint rules to allow coercive equality for null.

Removed

  • Abandoned NPM dependency papakay/selectize-bootstrap-4-style, merged styles into Admin.

Fixed

  • [JS] Disabled will_save constraint in attachment.js to revert to initial behaviour of always saving no matter the context.
    • The reason for this is that the attachment widget is often integrated as adjacent to the form widget instead of being nested.
  • [JS] Fixed Charcoal.Admin.resolveSimpleJsonXhr() in charcoal.js.
    • Since Promises are chainable (in this scenario, jQuery's Deferred object), we now ensure we chain the success, failure, and complete callbacks.
  • By merging styles from and removing dependency the abandoned selectize-bootstrap-4:
    • [SCSS] Skip duplicate inclusion of all of Bootstrap v4.
    • [NPM] Misuse of NPM dependencies which installed Gulp (which we don't use) and constrained ESLint to v6 (where grunt-eslint requires v8).

charcoal-admin 0.30.3

14 Jul 15:01
Compare
Choose a tag to compare

Complete commits list: 0.30.2...0.30.3

Summary

  • Improved performance of exporter y using LazyCollectionLoader to prevent memory errors when fetching a large collection.
  • Deactivated time limit for exporter controller since large collections will probably take more than the default 30 seconds to export.

charcoal-admin 0.30.2

11 May 21:22
686cb23
Compare
Choose a tag to compare

Complete commits list: 0.30.1...0.30.2

Summary

Added module assets collection to support JavaScript ES6–ES11.

charcoal-admin 0.30.1

11 May 20:29
Compare
Choose a tag to compare

Key Features

Use name in ACL Role for admin users

⚠️ [BC] This MAY break Adminland or ACL Roles dashboards if Roles do not have a name value.

Use the ACL Role's name property, instead of its ident, for Admin users.


What's new in 0.30.1?

Complete commits list: 0.30.0...0.30.1

Changed

  • Cleaned-up ACF Role class and metadata.

Removed

  • Removed AclRole#key() method since unchanged from base class in locomotivemtl/charcoal-user.

Fixed

  • Fixed JSON syntax in config/admin.config.default.json.

charcoal-admin 0.30.0

05 May 00:04
Compare
Choose a tag to compare

Key Features

Improved component management

Previously, when reloading a widget often the new HTML contained a new widget registration call which would duplicate its occurrence in the Component Manager.

Now, the Component Manager will check if a component was already registered with a given ID and type before adding it to its internal lists.

These changes should reduce the number of duplicate and obsolete components in the Manager.

Also, when a widget is reloading, it will now call its destroy() method before injecting the new HTML.

Improved form/property/widget validation and submission

⚠️ [BC] This MAY break any JS component that extends Widget_Form or Widget_Quick_Form.

Previously, Widget_Form#submit_form() and Widget_Quick_Form#submit_form() would call Manager#prepare_submit() which called the Component#validate() and Component#save() methods (if defined) on every registered property input or widget. Unfortunately, any return type from those component methods were ignored preventing a component from stopping form submission and by extension dispatching feedback.

Now, the form submission can be aborted by a component.

The Manager#prepare_submit() (via the new method Manager#prepare_components()) will bail early on the first Component#validate() or Component#save() that returns false, otherwise form submission will proceed.

The Manager#prepare_components() method will also call methods Component#will_validate() and Component#will_save() (if defined), providing the parent component that called it (if provided), to determine if the component should validate or save. This is useful to avoid validating and saving components outside of the form (or other container-type components).

Any feedback added during these steps will be displayed during the form's request_complete() method.

Custom events for form validation and submission

⚠️ [BC] This MAY break any JS event listeners on elements of Widget_Form or Widget_Quick_Form.

⚠️ [BC] This WILL break saving of Widget_Attachment if declared adjacent to Widget_Form as opposed to nested.

🩹 Fixed saving issues in 0.30.4

Added custom events triggered when form validation fails, form submission fails, succeeds, or completes.

Example of events for Widget_Form:

$($0).on('failed.charcoal.form', (event) => console.log(event));
// → Event {
//     subtype: 'validation'
//     component: Widget_Form
//   }
// 
//   Event {
//     subtype: 'submission'
//     component: Widget_Form
//     response: {…}
//   }
$($0).on('success.charcoal.form', (event) => console.log(event));
// → Event {
//     subtype: 'submission'
//     component: Widget_Form
//     response: {…}
//   }
$($0).on('complete.charcoal.form', (event) => console.log(event));
// → Event {
//     subtype: 'submission'
//     component: Widget_Form
//     response: {…}
//   }

Example of equivalent events for Widget_Quick_Form:

// Widget_Quick_Form
$($0).on('failed.charcoal.quickform', (event) => console.log(event));
$($0).on('success.charcoal.quickform', (event) => console.log(event));
$($0).on('complete.charcoal.quickform', (event) => console.log(event));

Predefined form validation messages

Added generic form validation messages (localized in English and French) based on browser's default messages for Constraint validation API.

Useful for providing informative predefined messages when creating validation constraints in PHP or JS.

Example in JS using formWidgetL10n object:

formWidgetL10n.validation.badInput;

formWidgetL10n.validation.patternMismatchWithFormat.replace('{{ format }}', 'H0H 0H0');

Example in PHP using the Translator service:

$translator->trans('form.validation.bad_input');

$translator->trans('form.validation.pattern_mismatch_with_format', [
    '{{ format }}' => 'H0H 0H0'
]);

Improved form sidebar appearance

Added support for position sticky (enabled by default) to improve scrolling of sidebar.
Useful if the sidebar is taller than the screen.

BC Breaks

If you were previously calling or overriding the submit_form() method on Widget_Form or Widget_Quick_Form:

  1. Replace submit_form() with request_submit().
  2. The two methods no longer receive the form element, use the Widget_Form#$form and Widget_Quick_Form#$form properties respectively.
  3. The new method should trigger a custom failed event if Manager#prepare_submit() returns false.

The Widget_Form#submit_form() method has been repurposed to only handle the making of XHR request. In its place, the submit event listener will (and developers should) call Widget_Form#request_submit() which will handle validation and then call submit_form().

If you were previously calling or overriding the enable_form() and disable_form() methods on Widget_Form or Widget_Quick_Form:

  1. The methods no longer receive the form element, use the Widget_Form#$form and Widget_Quick_Form#$form properties respectively.

If you were previously calling or overriding the request_done(), request_success(), request_failed(), and request_complete() methods on Widget_Form or Widget_Quick_Form:

  1. These methods no longer receive $form or $trigger parameters, use the Widget_Form#$form and Widget_Quick_Form#$form properties respectively and $form.find('[type="submit"]').
  2. The latter three methods should trigger their respective custom events.

If you were previously using the .charcoal.bs.dialog and .charcoal.form.quick events from Widget_Quick_Form:

  1. Rename those events to .charcoal.quickform.

What's new in 0.30.0?

Complete commits list: 0.29.1...0.30.0

Added

  • [JS] Added method Manager#has_component() to check if a raw component or component instance is registered.
  • [JS] Added method Manager#destroy_component() to destroy component and remove a component from manager.
  • [JS] Added method Manager#create_component() to decouple component instantiation.
  • [JS] Added dialog as second parameter to Widget#dialog() callback parameter to be able to interact with dialog.
  • [JS] Added return of dialog in Widget#confirm() instead of void.
  • [JS] Added option with_data to Widget_Attachment's XHR call to load the QuickFormWidget to ensure its widget data is included and used in the dialog.
  • [JS] Added EVENT_NAMESPACE to Widget_Form and Widget_Quick_Form, similar to Property_Input_File and its derivatives.
  • [JS] Added method Widget_Form#add_actions_for_confirmation to decouple adding feedback actions for needs_confirmation response setting.
  • [JS] Added support for customizing the needs confirmation label "Continue" with confirmation_label.
  • [JS] Added method Widget_Form#add_action_for_next_url to decouple adding feedback action to continue to next_url response setting.
  • [JS] Added support for customizing the next URL label "Continue" with next_url_label.
  • [JS] Added support for absolute URIs for next_url.
  • [JS] Added support for custom save_action and update_action URIs on Widget_Form.

Changed

  • [JS] Reduced duplicate code (such as "conditional groups") and shared missing parity (such as "needs confirmation") between Widget_Form and Widget_Quick_Form.
  • [JS] Improved error messages to include component ID, if available, in Manager.

Removed

  • [JS] Replaced variable arr in favour of Array.prototype in Component Manager.

Fixed

  • [JS] Destruction of Widget_Quick_Form when dialog is closed in Widget_Attachment and Widget_Relation to avoid polluting Component Manager with obsolete components.
  • [JS] Close only the current dialog instead of all dialogs in Widget_Form and Property_Input_Selectize_Tags.
  • [CSS] Fixed page scrolling when Bootstrap modal is open.

charcoal-admin 0.29.1

04 May 23:10
Compare
Choose a tag to compare

Key Features

Split Selectize property input views

Moved form control markup and JS component registration from property input view (selectize.ms and selectize/tags.ms) to a separate partial views (selectize/control.ms, selectize/tags/control.ms, and selectize/js.ms), like for TinyMCE property input.

This will allow for easier customization of a Selectize input view (such as altering the JS registration but not the form control).


What's new in 0.29.1?

Complete commits list: 0.29.0...0.29.1

Updated

  • Composer
    • studio-42/elfinder v2.1.60 → v2.1.61
  • NPM
    • echarts v5.3.0 → v5.3.2
    • jsoneditor v9.7.2 → v9.7.4
    • tempusdominus-bootstrap-4 v5.39.0 → v5.39.2
    • tempusdominus-core v5.19.0 → v5.19.3
    • tinymce v5.10.3 → v5.10.4

Fixed

  • [JS] Escape of single-quote characters in Widget_Search.

charcoal-admin 0.29.0

14 Mar 22:49
Compare
Choose a tag to compare

Key Features

Improved model property validation feedback

The model property's label will be prepended, if missing, to the validator result message to provide context as to which data is invalid when saving changes.


What's new in 0.29.0?

Complete commits list: 0.28.2...0.29.0

Added

  • Method FeedbackContainerTrait::addFeedbackFromValidatable()
  • Method FeedbackContainerTrait::addFeedbackFromValidator()
  • Method FeedbackContainerTrait::addFeedbackFromValidatorResult()
  • Method AbstractSaveAction::isValidatable()
  • Method AbstractSaveAction::addFeedbackFromModel() (replaces addFeedbackFromValidation())
  • Method AbstractSaveAction::addFeedbackFromModelValidatorResult()

Removed

  • Method AbstractSaveAction::addFeedbackFromValidation()