Please Moodle can you rethink the jQuery issue for Bootstrap themes?

Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Mary Evans -
Number of replies: 24
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

... because I really think this would be a great step forward...

http://view.jquerymobile.com/1.3.2/dist/demos/widgets/panels/panel-fixed.html

Average of ratings: -
In reply to Mary Evans

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

To be honest Mary the chances of getting jQuery back into Moodle core at the moment are the same as the English Cricketers winning back the ashes.

In fact upon reflection, I think the Cricketers have a better chance of winning the Superbowl and doing well at the Sochi Winter Olympics.

In reply to Gareth J Barnard

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

So more chance than winning back the Ashes then! That's good news! ;)

+1 Mary!!!

In reply to Gareth J Barnard

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Julian Ridden -

I really want to add my +100 to this although I know that the chances of anything happening here are a million to one. I don't see why it has to be YUI or jQuery. I think personally it is about best tool for the right rob. And by that reasoning I see both as useful.

The current status quo is as good as I think it will get. As long as Moodle continues to have jQuery stored in lib and make it easy for me to dynamically load modules. Then that is a great bonus for us theme developers. If themes like Essential continue to gain traction with users then HQ will need to decide to that constantly want to port jQuery to YUI (aka the bootstrap code), leave all jQuery dependant code as plugins or make a philosophy shift based on what the community wants. In short the demand and need will both need to be greater before I see any such shift being contemplated.

That being said, I am working on a new theme at the moment that uses a great set of jQuery plugins. These will include:

  • nprogress - Generates a page loading indicator
  • unslider - A lightweight and responsive frontpage slider
  • eventswipe - Makes the slider responsive to touch gestures on mobile devices
  • modernizrmakes it easy to write conditional JavaScript and CSS to handle situations whether an older browser supports a feature or not and deliver an alternative.
  • backstretch - creates a slideshow on the background of the login page
  • kearning - more advanced typography control
  • favico - will put a badge into the favicon with number of moodle messages

Each of these provide great functionality and visual flair with minimal impact on load. The jQuery development community is flourishing with many fantastic plugins such as these. It is for this reason that I am a huge fan. To do this in YUI, well, I would not even want to think about it.

Julian

Average of ratings: Useful (1)
In reply to Julian Ridden

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

This is exactly why I think it is important that we have access to the most state of the art methods that can enhance a theme. How are we going to get themes like Essential into Moodle otherwise, or we will just end up with a bland set of boring themes.

In reply to Mary Evans

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
In reply to Martin Dougiamas

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Stuart Lamour -
Picture of Plugin developers

i love visiting yahoo sites - its like a trip to the land design forgot.

Average of ratings: Useful (3)
In reply to Stuart Lamour

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Rodney Wolford -

As an almost capable user, I am sorry to say that the list of yui scripts posted by Dougiamas didn't do much to convince me that yui is the way forward. Seems mostly like eye-candy. Currently, I don't use jquery on moodle, mainly because it is not recommended. But I find many more jquery routines that offer user interactive options not seen in yui. Of course, the best option would be to have the both, and may the best javascript win. But not likely.

In reply to Martin Dougiamas

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Derek Chirnside -

@Martin, what are you actually saying here?  That there are enough functions in YUI that there should be no complaints? or??

@Julian: are you saying what you want to do (effectively and fast and powerfully with style) cannot be done with YUI?  Or is it just difficult to do?  Or fiddly?

@whoever: Is YUI quite difficult to learn, or just different to JQuery?

---

I guess my basic question to MoodleHQ has to do with why there are so few really nice looking themes in the core? Is it just priorities, or are there no coders with the inclination to do it?

Why is something like Essential not in core?  Can it be coded in YUI and come with a shiney new core Moodle install??  

@You guys wanting JQuery: can YUI really not cut it to get nice looking themes?  

I kind of wonder how rational talented literate wonderful smart hardworking coders cannot get themselves together and create something in core us pond scum end users can actually live with on a daily basis and like.  Really like.

I may regret making this post, but I am curious, having just spent a little while trawling the docs and it is not really clear.

-Derek

In reply to Derek Chirnside

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Mauno Korpelainen -

@Derek

For a typical moodler both jQuery and YUI are difficult to learn and write and that's why many of us want to use ready-to-use widgets and scripts if we can easily modify them...

http://w3techs.com/technologies/history_overview/javascript_library tells something - developer forums may give some other reasons for using yui instead of jQuery.

Average of ratings: Useful (2)
In reply to Mauno Korpelainen

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Julian Ridden -

What he said!

I find the amount, quality and UI/UX focus of jQuery plugins significantly superior to what is out there for YUI.

There is no way I could write these from scratch (in either language) and hence like using (well tested an solid) jQuery plugins in my themes.

Julian

In reply to Derek Chirnside

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by David Scotson -
> I guess my basic question to MoodleHQ has to do with why there are so few really nice looking themes in the core? Is it just priorities, or are there no coders with the inclination to do it?

The fundamental cause is the structure of the front-end code, large areas of Moodle are simply not "themeable", and the bits that can be themed are often complicated and brittle, which doesn't reward experimentation. A Bootstrap theme was achieved via a series of complicated hacks (e.g. using LESS to compile Bootstrap's CSS so that it's compatible with Moodle's often self-contradictory HTML). This is simply not feasible for average themers, the effort involved is simply not worth it, though by working together on the Bootstrap base multiple people have been able to build on that shared foundation. But even though it smooths over some of the gaps there's still plenty of things are still too hard e.g. the latest thread in this forum is about not being able to theme the login page with a renderer, and even the "easy" bits require more knowledge of how Bootstrap works than most other Bootstrap themes for other similar web applicaions, since they don't require as many technical gymnastics and can often just import the CSS direct from Bootstrap and take advantage of 3rd party themes bought from WrapBootstrap.com, or downloaded for free from Bootswatch.com etc.

I was hopeful that the Bootstrap theme would provide a good map for where these things in the front end need to be fixed and that as they were fixed, each of the workarounds could be removed until we get to the point where Moodle can be themed with relative ease, whether building on Bootstrap or not.

Unfortunately we're not there yet, even upgrading the Bootstrap theme to the latest version of Bootstrap is considered to be at the very edge of possibility, even with the combined focus of the the community and Moodle HQ, so that gives you some idea of how much work would be involved in building a theme from scratch based on a popular 3rd party framework, and I'd suggest writing a custom one for Moodle would be an order of magnitude more work (at least). You can change the headers and footer with relative ease though, to wrap Moodle in a modern look, but I think that mostly serves to mask the deeper problems.
Average of ratings: Useful (1)
In reply to David Scotson

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Perhaps we should all be working on changing Moodle 2.6 on a new branch to work as we want it and see how long it takes us to do. smile

In reply to Mary Evans

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

The YUI / jQuery debate could go on for years with each faction buffeting against the other.  A Catch-22.  Given the current state of play, the only workable solution is for core to be YUI only and contributed plugins permitted to use jQuery, as it currently is.  Then when the JavaScript Framework arms race is resolved, then so can this feud.

I think more effort needs to be expended on refactoring base / bootstrapbase core CSS to reduce and remove duplications, more renderers.... etc.  My New Years wish list smile

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by David Scotson -
Gareth, much (though not all) of that work can be done from within a theme. I'd appreciate your help with doing exactly that in Bas's Bootstrap3 repository if you're up for it.
In reply to David Scotson

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Will do as much as I can, and have started already -> https://github.com/bmbrands/theme_bootstrap/pull/74 smile.  Please see my comment on https://github.com/bmbrands/theme_bootstrap/pull/80.

In reply to Gareth J Barnard

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Just seen the bit about the FONTS why is no one is using the setting that Petr added?

url([[font:theme|glyphicons-halflings-regular.eot]]) format('embedded-opentype');

Also what is the point of CDN fonts if we can use the above font setting and add  fonts to the theme?

If the font is not stored in a theme...then yes I can see an advantage, however, I did read somewhere that these linked to fonts can slow Moodle down.

Cheers

Mary

In reply to Gareth J Barnard

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Julian Ridden -

MD has made his position clear, and being his project I respect that. Having core rely purely on YUI is his call and I even understand the reasons.

What I a happy about is that jQuery is in moodle's lib and is easily accessible from theme's. This is a great win for us still and allows us to do the "edgy" stuff that we want. Sure, it means it won't get into core, but judging by the downloads of Essential alone (over 47,000) and the other jQuery using themes I think it really matters not.

My last comment, which I have made before, is that MD has been known to change his mind when there has been strong community push for certain features. So I say we keep building cool themes, see if the community gets on board, then and only then can we make a big push for change.

In the meantime, lets focus o fixing core. The icons is a great start, next should be a focus on new renderers and better css guidelines. I think that would help us far more.

Julian

Average of ratings: Useful (4)
In reply to Mary Evans

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Stuart Lamour -
Picture of Plugin developers

on an internal cms a colleague used to have nice pictures of snowmen, easter eggs and other seasonal gifs depending on the time of year.

managers complained it was off brand etc, so he restricted the display of the images to not be visible to their IP address.

if (!$moodlehq) {

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

}

 

simples.

 

 

In reply to Mary Evans

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Stuart Lamour -
Picture of Plugin developers

otherwise, just do a julian and build a theme with jquery that becomes the best moodle theme ever?

In reply to Stuart Lamour

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Indeed!  Contributed code does not suffer from some of the constraints that core code has upon it.

YUI is a powerful library.  But jQuery has its place too.  I sort of get the reasons that HQ does not want to support yet another technology as have been stated in other threads.  So, perhaps lets see how things go.  Perhaps by 2020, Moodle will be written in Node.js and served portably on our wrist watches over WiFi.

Average of ratings: Useful (2)
In reply to Mary Evans

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Stuart Lamour -
Picture of Plugin developers
In reply to Stuart Lamour

Re: Please Moodle can you rethink the jQuery issue for Bootstrap themes?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

There is something inherently wrong with this article - https://medium.com/cool-code-pal/e030d01321ec.

I think its missing the understanding of the nature of the client / server architecture.  PHP is run server side and JavaScript (YUI / jQuery.... frameworks) client side.  At the server end, PHP is dynamic and is used to produce static content which is then passed to the client.  The client can have no knowledge what so ever that the content was ever produced using PHP (or Java, Python, C++ or COBOL - yes somebody has made a COBOL web server with templating technology - etc.) or is in a position to dynamically adapt the content in PHP.  Hence the use of a different technology - JavaScript - to add dynamism to the static content.

Therefore as you have greater control over the server, you do as much as possible there, but to add dynamism at the client end you have to use JS or any other client side technology.  Its all about where the 'execution of code' takes place, so to simply say to ditch all jQuery and do everything in PHP is misguided and in fact wrong.  You will end up with the static web pages of the 1990's.

Unless somebody comes up with client side PHP where the server dispatches 'snippets' of code to be executed at the client end.  But this would mean internal browser support and a whole mine field of security issues to be sorted.