Giter VIP home page Giter VIP logo

Comments (6)

aleayr avatar aleayr commented on August 12, 2024 2

Would this be better to leave implementing jQuery version to theme developers? As long as admin overlay is off, admin can run 1.4, and theme developers can run whatever version they like via the theme?

from govcms7.

aleayr avatar aleayr commented on August 12, 2024

Comment from @jozhao:

Working with module whitelist/blacklist, we can provide a jQuery update module https://www.drupal.org/project/jquery_update in distribution, then site developer/builder can enable this module if different version of jQuery is needed.

Did a local testing with this module enabled in a white label govCMS site, this module breaks some javascript plugins and brings issues to admin pages - need a confirmation here if the site developer can take this risk and they can fix such issues etc.

thanks, Joseph

from govcms7.

fiasco avatar fiasco commented on August 12, 2024

What modules in govCMS currently that would value from this module? If there are none, there there is no reason to add this module. Theme developers should use the version of jQuery provided (even if its not the latest) as to work with supported versions and not introduce software that can break exisiting govCMS functionality.

from govcms7.

invisigoth avatar invisigoth commented on August 12, 2024

For example there are a few agencies on GovCMS currently running Bootstrap-based themes such as Australia.gov.au. In the meantime some agencies running generic Drupal such as the Australian War Memorial are using Bootstrap-based themes. Bootstrap requires jQuery version 1.9.1 or higher and it is getting increasingly popular. It is therefore always desirable to allow theme developers to have the flexibility to choose jQuery.

Under certain circumstances however, jQuery Update module may not suffice. For example if the business wants to edit content using the front-end theme rather than the admin theme (e.g. Australia.gov.au).

Perhaps a simpler solution is to advise theme developers to use hook_js_alter. Example code below to include in theme's template.php.

The conditions can also be built as a configurable item on the theme's config page and assign permission to desired roles.

function hook_js_alter(&$javascript) {
  $replace_jquery = TRUE;

  $extra_admin_paths = array(
    'path/one',
    'path/two',
    'path/n',
  );

  // do not apply to admin pages that may require lower version of jQuery provided by Drupal core
  if (path_is_admin(current_path())) {
    $replace_jquery = FALSE;
  }   else {
    foreach ($extra_admin_paths as $extra_admin_path) {
      if (drupal_match_path(current_path(), $extra_admin_path)) {
        $replace_jquery = FALSE;
      }
    }
  }

  if ($replace_jquery) {
    $javascript['misc/jquery.js']['data'] = drupal_get_path('theme', 'your_theme') . '/path/to/alternative/jquery.min.js';
  }
}

from govcms7.

fiasco avatar fiasco commented on August 12, 2024

The use case for Bootstrap is certainly building and if running a higher version of jQuery is a prerequisite then so be it. Have have noticed on several sites however that admin sections of the site can break when using high levels of jQuery (e.g. Views). So I wouldn't be comfortable offering a module in govCMS that could break things when its turned on. Instead, I'd prefer to have it turned on by default and we have good defaults set for the module so that it doesn't impact the administration interface.

That would put govCMS is a better a position of support bootstrap which seems like a growing preference of choice for government themes.

from govcms7.

fiasco avatar fiasco commented on August 12, 2024

Many govCMS features my rely on specific version of govCMS which we won't be able to guarantee if we give the ability to change the version of jQuery. So we've decided to not support this feature but will review opportunities to update jQuery as required.

from govcms7.

Related Issues (20)

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.