Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

Work in progress. Will be implemented in Rogo 7.1 (October/November 2019)

Warning

Not yet merged into develop



In order to modernise Rogo we are modularising our javascript and implementing requirejs.

...

Code Block
languagejs
titleexample.js
requirejs(['ui', 'jquery', 'jqueryvalidate', 'jqueryui'], function (UIUi, $) {
    var ui = new UIUi();
    // Validate ldap options, and toggle extra settings.
    $("#installForm").validate();
    $('#useLdap').change(function () {
        $('#ldapOptions').toggle();
    });
    $('#uselookupLdap').change(function () {
        $('#ldaplookupOptions').toggle();
    });

    $('#config').click(function() {
        ui.go_config();
    });
});

...

Code Block
languagejs
titleexample.js
requirejs(['jsxls', 'jquery', 'jqueryvalidate'], function (jsxlsJsxls, $) {
    $('#forgotten_pw').validate({
        messages: {
            email: jsxlsJsxls.lang_string['emailaddressinvalid'],
        }
    });
});

Coding Standards


  1. The first letter of variables included via RequireJS should be capitalised, and local variables should be lowercase


    Code Block
    languagejs
    titleexample.js
    requirejs(['ui', 'jquery'], function (Ui, $) {
        var ui = new Ui();
        
        $('#config').click(function() {
            ui.go_config();
        });
    });