Moodle

JS improvements META

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: DEV backlog
  • Component/s: General
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE

Description

List of tasks related to new recommended JS usage, JS API improvements and conversion to YUI3

Progress
Resolved Sub-Tasks Unresolved Sub-Tasks

Sub-Tasks

Activity

Hide
Sam Hemelryk added a comment -

Hi Petr,

I found that the collapsible region code wasn't working for me today, there was a problem with the way in which it was getting+setting heights when toggling the animation on the click event. After looking at the code I decided that I wasn't a big fan of code behind the collapsible region and came up with the attached patch.

Changes are as follows:

  • Class is written in the set and forget method it seemed to be used in, no methods after construct.
  • Upgraded the code to YUI 3, now makes full use of YUI nodes and the cool stuff they can do.
  • Off loaded CSS class toggling into the animation module instance events.
  • Fixed up the way the animation toggled (there is a reverse property... much better than changing to and from each click).
  • Fixes the issue with animation and heights whereby elements would override due to crazy heights madness as above.
  • Tidied up the jsdocs.

What this doesn't do that could be done.

  • This doesn't change the underlying HTML in weblib's print collapsible region function however I am 99% sure half of the HTML it generates is not needed. Not really a problem so I didn't change anything there.
  • Clean up the CSS for the structure, only one of the CSS rules is actually relevant, the rest could disappear and not be missed. This could be cleaned up when we migrate the CSS into the base theme.

See what you think of this patch.

Cheers
Sam

Show
Sam Hemelryk added a comment - Hi Petr, I found that the collapsible region code wasn't working for me today, there was a problem with the way in which it was getting+setting heights when toggling the animation on the click event. After looking at the code I decided that I wasn't a big fan of code behind the collapsible region and came up with the attached patch. Changes are as follows:
  • Class is written in the set and forget method it seemed to be used in, no methods after construct.
  • Upgraded the code to YUI 3, now makes full use of YUI nodes and the cool stuff they can do.
  • Off loaded CSS class toggling into the animation module instance events.
  • Fixed up the way the animation toggled (there is a reverse property... much better than changing to and from each click).
  • Fixes the issue with animation and heights whereby elements would override due to crazy heights madness as above.
  • Tidied up the jsdocs.
What this doesn't do that could be done.
  • This doesn't change the underlying HTML in weblib's print collapsible region function however I am 99% sure half of the HTML it generates is not needed. Not really a problem so I didn't change anything there.
  • Clean up the CSS for the structure, only one of the CSS rules is actually relevant, the rest could disappear and not be missed. This could be cleaned up when we migrate the CSS into the base theme.
See what you think of this patch. Cheers Sam
Hide
Petr Škoda (skodak) added a comment -

hi, yes, it was far from perfect, +1 for commit

Show
Petr Škoda (skodak) added a comment - hi, yes, it was far from perfect, +1 for commit

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: