Permalink
Browse files

Merge branch 'wip-MDL-37901_M23' of git://github.com/gjb2048/moodle i…

…nto MOODLE_23_STABLE
  • Loading branch information...
2 parents c6014dc + 92eeecd commit c2cef5809eb34867ec46c269fea90226caa94206 Sam Hemelryk committed Mar 5, 2013
Showing with 30 additions and 2 deletions.
  1. +15 −1 course/format/topics/format.js
  2. +15 −1 course/format/weeks/format.js
View
16 course/format/topics/format.js
@@ -56,6 +56,9 @@ M.course.format.swap_sections = function(Y, node1, node2) {
M.course.format.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) {
var CSS = {
SECTIONNAME : 'sectionname'
+ },
+ SELECTORS = {
+ SECTIONLEFTSIDE : '.left .section-handle img'
};
if (response.action == 'move') {
@@ -65,9 +68,20 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
sectionto = sectionfrom;
sectionfrom = temp;
}
- // Update titles in all affected sections.
+
+ // Update titles and move icons in all affected sections.
+ var ele, str, stridx, newstr;
+
for (var i = sectionfrom; i <= sectionto; i++) {
+ // Update section title.
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
+ // Update move icon.
+ ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
+ str = ele.getAttribute('alt');
+ stridx = str.lastIndexOf(' ');
+ newstr = str.substr(0, stridx +1) + i;
+ ele.setAttribute('alt', newstr);
+ ele.setAttribute('title', newstr); // For FireFox as 'alt' is not refreshed.
}
}
}
View
16 course/format/weeks/format.js
@@ -56,6 +56,9 @@ M.course.format.swap_sections = function(Y, node1, node2) {
M.course.format.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) {
var CSS = {
SECTIONNAME : 'sectionname'
+ },
+ SELECTORS = {
+ SECTIONLEFTSIDE : '.left .section-handle img'
};
if (response.action == 'move') {
@@ -65,9 +68,20 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
sectionto = sectionfrom;
sectionfrom = temp;
}
- // Update titles in all affected sections.
+
+ // Update titles and move icons in all affected sections.
+ var ele, str, stridx, newstr;
+
for (var i = sectionfrom; i <= sectionto; i++) {
+ // Update section title.
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
+ // Update move icon.
+ ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
+ str = ele.getAttribute('alt');
+ stridx = str.lastIndexOf(' ');
+ newstr = str.substr(0, stridx +1) + i;
+ ele.setAttribute('alt', newstr);
+ ele.setAttribute('title', newstr); // For FireFox as 'alt' is not refreshed.
}
}
}

0 comments on commit c2cef58

Please sign in to comment.