Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-37901 format_topics & format_weeks: Fix drag icon tooltip after m…

…ove.
  • Loading branch information...
commit dafa91279fde0cb3162cb6c8d0aa7e01a6e4f221 1 parent cce0d9a
@gjb2048 gjb2048 authored
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.
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.