2017 © Pedro PelĂĄez
 

contao-bundle contao-ajax_reload_element

AjaxReloadElement for Contao OpenSource CMS

image

richardhj/contao-ajax_reload_element

AjaxReloadElement for Contao OpenSource CMS

  • Sunday, July 22, 2018
  • by richardhj
  • Repository
  • 3 Watchers
  • 9 Stars
  • 155 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 20 Versions
  • 29 % Grown

The README.md

AjaxReloadElement for Contao Open Source CMS

Latest Version on Packagist ![Software License][ico-license], (*1)

AjaxReloadElement gives you the possibility to fetch a particular front end module or content element via an ajax request., (*2)

Scroll down to see some nice animated screenshots 😎, (*3)

Usage

You need to tick the box «Allow ajax reload» for the module/element in the back end input mask and include a JavaScript., (*4)

Basic/custom usage

If you are using jQuery you can use something like this. Modify this code snippet for your purposes. (Create a j_myajaxreload.html5 template and include it in the layout.), (*5)

This code snippet will replace the HTML node .mod_my_module when clicking on a.reloadThisElementOnClick., (*6)



Ajax Calendar

Add this to the cal_default.html5 template. Don't forget to activate ajax reload on the module., (*7)

<script>
    $(".calendar .head.previous a, .calendar .head.next a").click(function (event) {
        var element;
        // Get url of next/previous month
        var $url = window.location.origin + '/' + $(this).attr('href');
        // Don't follow the link
        event.preventDefault();
        // This is the element's div container like ".mod_my_module". "Allow ajax reload" has to be enabled for this module in the back end
        element = $(this).closest('[class^="ce_"],[class^="mod_"]');
        // Add a css class to this element. An overlay and spinning icon can be set via css.
        element.addClass('ajax-reload-element-overlay');

        $.ajax({
            method: 'POST',
            url: $url,
            data: {
                // The data- attribute is set automatically
                ajax_reload_element: element.attr('data-ajax-reload-element')
            }
        })
            .done(function (response, status, xhr) {
                if ('ok' === response.status) {
                    // Replace the DOM
                    element.replaceWith(response.html);
                } else {
                    // Reload the page as fallback
                    location.reload();
                }
            });
    });
</script>

Ajax forms

This one comes out of the box., (*8)

For all modules that integrate forms, you can tick the box «Update a form via ajax». Additionally, the template "j_ajaxforms" has to be included in the page layout. Instead of reloading the entire page, forms will update itself., (*9)

This feature is supported for all Contao core forms like change password, personal data, login form etc. and forms from third-party apps that are programmed in Contao style., (*10)

Demonstration

When the login was successful, the redirect processed in the login form will be followed., (*11)

Demonstration with Contao's core login form, (*12)

This one is a bit more advanced., (*13)

First of all, this is the list of requirements for this plugin:, (*14)

  1. jquery-ui.js (with at least the Dialog widget)
  2. jquery.dialogOptions.js (can be optional, if you adjust the script)
  3. jQuery.modal-editing.js (the jQuery plugin written for this extension)

Then we create a template called j_modal_editing.js and include it in the page layout:, (*15)








This code snippet is tailored to a MetaModel frontend editing. You set the id of the editing form as the element option. In addition, you enable the ajax form as stated above (see paragraph «Ajax forms»)., (*16)

Demonstration

Demonstration of the modal editing script, (*17)

The Versions

22/07 2018

v2.1.x-dev

2.1.9999999.9999999-dev

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+ LGPL-3.0-or-later

The Requires

 

ajax contao ajaxform ajax reload

06/04 2018

v2.1.0

2.1.0.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0-or-later

The Requires

 

ajax contao ajaxform ajax reload

06/04 2018

v2.1.1

2.1.1.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0-or-later

The Requires

 

ajax contao ajaxform ajax reload

21/02 2018

v2.1-alpha.2

2.1.0.0-alpha2

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0-or-later

The Requires

 

ajax contao ajaxform ajax reload

19/11 2017

dev-master

9999999-dev

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

19/11 2017

v2.0.x-dev

2.0.9999999.9999999-dev

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

19/11 2017

v2.0

2.0.0.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

19/11 2017

v2.1-alpha.1

2.1.0.0-alpha1

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

02/11 2017

v2.0-alpha.3

2.0.0.0-alpha3

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

02/11 2017

v2.0-alpha.2

2.0.0.0-alpha2

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

22/10 2017

v2.0-alpha.1

2.0.0.0-alpha1

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

22/10 2017

dev-feature/v2.0.0-no-simple-ajax

dev-feature/v2.0.0-no-simple-ajax

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

20/10 2017

dev-feature/v2.0.0

dev-feature/v2.0.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

04/01 2017

dev-dev/request-uri-params

dev-dev/request-uri-params

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

30/12 2016

v1.0.3

1.0.3.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

30/12 2016

v1.0.x-dev

1.0.9999999.9999999-dev

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

28/12 2016

dev-feature/event-dispatcher

dev-feature/event-dispatcher

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

12/12 2016

v1.0.2

1.0.2.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

07/10 2016

v1.0.1

1.0.1.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload

05/06 2016

v1.0.0

1.0.0.0

AjaxReloadElement for Contao OpenSource CMS

  Sources   Download

LGPL-3.0+

The Requires

 

ajax contao ajaxform ajax reload