From 82ef49ea65cc07e55e82f03a9ab0227eabe2660e Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 28 Oct 2013 14:10:45 +0800 Subject: [PATCH] MDL-40975 Course: Set the show/hide activity toggle --- course/yui/toolboxes/toolboxes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/course/yui/toolboxes/toolboxes.js b/course/yui/toolboxes/toolboxes.js index d379a898137..e3a62407eba 100644 --- a/course/yui/toolboxes/toolboxes.js +++ b/course/yui/toolboxes/toolboxes.js @@ -460,7 +460,8 @@ YUI.add('moodle-course-toolboxes', function(Y) { var toggleclass = CSS.DIMCLASS, dimarea = activity.one('a'), availabilityinfo = activity.one(CSS.AVAILABILITYINFODIV), - nextaction = (action === 'hide') ? 'show' : 'hide'; + nextaction = (action === 'hide') ? 'show' : 'hide', + buttontext = button.one('span'), newstring = M.util.get_string(nextaction, 'moodle'); // Update button info. @@ -471,9 +472,12 @@ YUI.add('moodle-course-toolboxes', function(Y) { button.set('title', newstring); button.replaceClass('editing_'+action, 'editing_'+nextaction); button.setData('action', nextaction); + if (buttontext) { + buttontext.set('text', newstring); + } // If activity is conditionally hidden, then don't toggle. - if (Y.Moodle.core_course.util.cm.getName(activity) == null) { + if (Y.Moodle.core_course.util.cm.getName(activity) === null) { toggleclass = CSS.DIMMEDTEXT; dimarea = activity.all(SELECTOR.MODINDENTDIV + ' > div').item(1); }